iptables基础-配置iptables
配置iptables
centos7以上版本,默认防火墙为firewall,需要将fairewall关闭后开启iptables,如下为配置步骤及命令。
查看firewall状态并关闭
查看防火墙状态
[root@hostname ~]# firewall-cmd --state
running
关闭firewall
[root@hostname ~]# systemctl stop firewalld.service
关闭firewall开机自启动
[root@hostname ~]# systemctl disable firewalld.service
再次查看防火墙状态
[root@hostname ~]# firewall-cmd --state
not running
启动iptables
查看yum源是否有iptables的安装包
[root@localhost ~]# yum list | grep iptables
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
iptables.x86_64 1.4.21-33.el7 @anaconda
iptables-devel.x86_64 1.4.21-33.el7 base
iptables-services.x86_64 1.4.21-33.el7 base
查看是否安装了iptables
[root@hostname ~]# rpm -qa|grep iptables
iptables-1.4.21