CentOS7
关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
查看防火墙状态
systemctl status firewalld
CentOS6
查看防火墙状态方式一:service iptables status
查看防火墙状态方式二:/etc/init.d/iptables status
查看防火墙是否开机启动:chkconfig iptables --list设置防火墙开机启动:chkconfig iptables on
设置防火墙开机不启动:chkconfig iptables off
关闭防火墙指令:/etc/init.d/iptables stop
永久关闭防火墙指令:chkconfig iptables off
开启防火墙指令:/etc/init.d/iptables start
永久开启防火墙指令:chkconfig iptables on
重启防火墙:service iptables restart