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