1、基本操作
service iptables status
service iptables stop
service iptables start
service iptables restart
chkconfig iptables off
chkconfig iptables on
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
service iptables restart
systemctl status firewalld
firewall-cmd --state
service firewalld start
service firewalld restart
service firewalld stop
firewall-cmd --list-all
firewall-cmd --query-port=8080/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --remove-port=8080/tcp
firewall-cmd --reload
systemctl status firewalld
firewall-cmd --state
service firewalld start
service firewalld restart
service firewalld stop 4、查看防火墙规则
firewall-cmd --list-all 5、查询、开放、关闭端口
firewall-cmd --query-port=8080/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --remove-port=8080/tcp
firewall-cmd --reload 2. 防火墙的开启与关闭
(1)开启防火墙 [root@localhost ~]# systemctl start firewalld.service (2)关闭防火墙 [root@localhost ~]# systemctl stop firewalld.service (3)重启防火墙 [root@localhost ~]# systemctl restart firewalld.service (4)禁止开机启动 [root@localhost ~]# systemctl disable firewalld.service (5)开启开机启动 [root@localhost ~]# systemctl enable firewalld.service