Command To Check Firewall Status In Linux




I was just merely reminded that any installation of any Linux distro is usually by default already there firewallnya. Variations of the most common is iptables (the majority), the ufw (Ubuntu), and firewalld (CentOS 7). Although the VPSnya put up a minimal anyway there firewallnya ISO from my experience.

How do we know which installed and active? Could try the execution of the following commands:


iptables
iptables status

ufw
ufw status

firewalld
systemctl status firewalld

If there is a reward (not not found or such) means there is and it works. If all else fails we install new firewall them.



There is also the additional name Config Server Firewall (CSF) or Advanced Policy Firewall (APF), and replaced or at least modify the firewall is already installed. Install manual so its unlikely don't know wear this server except in the setting of a person or automated script installer.

View the Status and Rule of Iptables Firewall
To check the status and all of the iptables rule with the command:
# iptables -L -n
or
$ sudo iptables -L -n

Output results
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
droplist   all  --  0.0.0.0/0            0.0.0.0/0
droplist   all  --  0.0.0.0/0            0.0.0.0/0
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
ACCEPT     all  --  66.228.118.0/23      0.0.0.0/0
DROP       all  --  213.240.4.233        0.0.0.0/0
DROP       all  --  75.126.132.23        0.0.0.0/0
DROP       all  --  80.58.205.35         0.0.0.0/0
.....
...
.....
DROP       all  --  91.200.56.0/22       0.0.0.0/0
LOG        all  --  91.200.72.0/22       0.0.0.0/0           LOG flags 0 level 4 prefix `DROP List Block'
DROP       all  --  91.200.72.0/22       0.0.0.0/0



Next
Previous
Click here for Comments

0 comments: