modprobe ip_tables
modprobe iptable_filter
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ipt_state
关闭:firewalld
systemctl stop firewalld
systemctl disable firewalld
开启防火墙服务
[root@firewalld ~]# systemctl start iptables.service [root@firewalld ~]# systemctl enable iptables.service Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
清楚默认规则:
iptables -F ==> --flush:清楚所有规则,不会默认的规则 iptables -X :删除用户自定义的链 iptables -Z :链的计数器清零
禁止访问22端口:
[root@firewalld ~]# iptables -A INPUT -p tcp --dport 22 -j DROP