How to list iptables rules

To view all rules in iptables, run Or To list iptables rules without resolving IP to hostname To show the line number To list NAT rules If you run iptables-save command, it will list all iptables rules You can redirect the result of the iptables-save command to a file. You can restore with iptables-restore command. … Read more

Block an IP using iptables

To block an IP using iptables, use iptables -A INPUT -s IPADDR -j DROP Replace IPADDR with IP address you need to block. To block an IP range iptables -A INPUT -s IP_IN_CIDR_FORMAT -j DROP Example, bock IP range 159.138.0.0/16 iptables -A INPUT -s 159.138.0.0/16 -j DROP Unblock an IP address To unblock an IP … Read more

Open MySQL Port 3306 in CentOS 7

To allow MySQL to connect from remote server on CentOS 7 server, you need to enable port 3306 in firewall. To do this, edit file vi /etc/sysconfig/iptables Find -A INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT Add above -A INPUT -p tcp -m state –state NEW -m tcp –dport … Read more

Unban an IP from CSF Firewall

To unban an IP from CSF firewall, run csf -dr IP_ADDR Here i have an IP blocked in firewall. [root@server22 ~]# iptables -L -n | grep 13.224.29.193 DROP all — 13.224.29.193 0.0.0.0/0 LOGDROPOUT all — 0.0.0.0/0 13.224.29.193 [root@server22 ~]# To see if CSF is blocking the IP, run csf -g IP_ADDR Example This command also … Read more

iptables

How to list iptables rules Block an IP using iptables Open MySQL Port 3306 in CentOS 7 Saving iptables firewall rules Port forward using iptables iptables -F lock me out How to redirect traffic to another IP using iptables To list current rules, run iptables -S Or iptables -L To list rules in numeric format, … Read more

iptables -F lock me out

After i type iptables -F server goes down. Can’t connect to web or ssh, seems all connection is locked by iptables. SOLUTION This is because the chain policy for the firewall input chain was set to DROP check with “iptables –list” you will see “Chain INPUT (policy DROP)”. [root@server52 ~]# iptables -L |grep Chain Chain … Read more