借鑑:https://www.cnblogs.com/xwgcxk/p/10820518.html
1.查看系统是否安装防火墙
root@localhost:/usr# which iptables
/sbin/iptables
root@localhost:/usr# whereis iptables
iptables: /sbin/iptables /etc/iptables /usr/share/iptables /usr/share/man/man8/iptables.8.gz
如果是这样的信息,那么表明iptables就是安装了的。
如果没有安装,那么使用sudo apt-get install iptables 安装。
2.查看防火墙的配置信息
配置好了的,是这个样子。
root@localhost:/usr# sudo iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt: 22
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
ACCEPT icmp -- anywhere