Instructions to install CSF Firewall on CentOS 7 - HOSTVN Blog

Install CSF Firewall - ConfigServer Security & Firewall (CSF) is a firewall application that allows login / intrusion detection and security for Linux servers.

CentOS 7 uses Firewalld instead of iptables. Many loyal CentOS users find Firewalld too complex for their needs and are returning to iptables. Iptables is the standard firewall for CentOS 5 and 6.

In this article HOSTVN I will show you how to turn off Firewalld, install iptables in combination with ConfigServer Security & Firewall (CSF) to enhance the security for my VPS / Server Linux.

Install CSF Firewall

Install CSF Firewall on CentOS 7

Step 1: Stop and disable the firewall.

To stop and disable Firewalld on centos, you use the following 2 commands

Step 2: Install iptables.

After stopping and disabling Firewalld, we will install ibtables

  • Create the necessary file by iptables.
  • Activate iptables every time you restart VPS / Server.

Step 3: Install the necessary libraries.

Next, you need to install the libraries needed for the operation of CSF

Step 4: install CSF.

After fully installing the libraries we install CSF. Installation is as simple as the commands below

  • Remove the installation file.

Now we will check if CSF actually works on the server. We will do a test to verify.

If you see results as shown below, then CSF will work without any problems on your server.

Step 5: Configure CSF

Next, we will need to configure CSF by editing the file /etc/csf/csf.confcsf.conf. In this article HOSTVN Using the nano editor for editing, you can use VIM if you want.

If meeting notice -bash: nano: command not found meaning that you have not installed nano, you can install nano with the following command

You will need to correct some of the parameters below

  • Note: For convenience when using nano you can use keystrokes ctrl + w to search. (Details you can see in the video tutorial).

After editing you proceed to start csf

To check if csf is working or not you can use the following command


Some basic commands

Start CSFcsf -s
Flush / Stop firewall rules (note: lfd may restart csf)csf -f
Restart CSFcsf -r
Allow an IPcsf -a ip-address
Deny IPcsf -d ip-address
Remove and unblock all entriescsf -df
Stop firewallcsf -x
Enable firewallcsf -e


In this article, HOSTVN will guide you how to turn off Firewalld, install iptables in combination with ConfigServer Security & Firewall (CSF) to enhance the security for your VPS / Server Linux. If you have any comments you can leave a comment below. Also you can see more 10 criteria to choose the best VPS in 2020.

Nguyen Diep

My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently

Post a Comment

Previous Post Next Post

Đọc nhiều trong tuần

10 Grands Sites de modèles PowerPoint gratuit
10 Grands Sites de modèles PowerPoint gratuit

PowerPoint est toujours le roi quand il vient à un logiciel de présentation. Il a été autour depuis des siècles et chaque nouvelle version ajoute plus de fonctionnalités et rend …

17 best home jobs in 2020
17 best home jobs in 2020

Earning Money blog access_time April 13, 2020 hourglass_empty 28 least Read Finding work from home is easier thanks to high technology. Not only suitable for tho…

How much RAM is the iPhone 12 Pro?
How much RAM is the iPhone 12 Pro?

The RAM of the iPhone 12 Pro is up to 6GB.
Based on information in the latest Xcode beta from Hiraku, it can be said that both of Apple's new iPhone 12 Pro models have 6GB of R…


JavaScript is a programming language of HTML and WEB. It is lightweight and most commonly used as part of web pages, but their implementation allows Client-Side scripts to interac…