Centos7操作系统关闭防火墙

  1、开启防火墙:

systemctl start firewalld

  2、重启防火墙:

firewall-cmd --state

  3、关闭防火墙:

systemctl stop firewalld

  4、关闭防火墙开机启动:

systemctl disable firewalld

  5、查看防火墙状态:

systemctl list-unit-files|grep firewalld

  添加规则

firewall-cmd --zone=public --add-port=22022/tcp --permanent

Centos6操作系统关闭防火墙

  1、查看防火前状态:

/etc/init.d/iptables status

  2、开启防火墙:

/etc/init.d/iptables start

  3、关闭防火墙:

/etc/init.d/iptables stop

  4、设置防火墙开机不起动:

chkconfig iptables off

  添加规则

iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 22022 -j ACCEPT