针对于CentOS-6(CentOS-7命令不同,CentOS-8输入以下指令会自动定向,可以通用)
查看防火墙状态
# service iptables status
关闭防火墙
# service iptables stop
打开防火墙
# service iptables start
永久关闭防火墙
查询卡机防火墙是否自启动
[root@CactiEZ ~]# chkconfig --list | grep iptables
iptables 0:off1:off2:on3:on4:on5:on6:off
由此可见:2/3/4/5都是开机启动,数字代表runlevel等级
[root@CactiEZ ~]# chkconfig iptables off
[root@CactiEZ ~]# chkconfig --list | grep iptables
iptables 0:off1:off2:off3:off4:off5:off6:off
开启防火墙自动启动
[root@CactiEZ ~]# chkconfig iptables on
[root@CactiEZ ~]# chkconfig --list | grep iptables
iptables 0:off1:off2:on3:on4:on5:on6:off