CentOS 7.0关闭firewall防火墙,改iptables防火墙

1 关闭firewall:
#停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service

2安装iptables
#yum安装 iptables-services
yum install iptables-services
#设置开机时启用服务iptables
systemctl enable iptables
#如果需要使用 ip6tables , 需另外加一行
systemctl enable ip6tables
#开放443端口(HTTPS)
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
#保存上述规则
service iptables save
#重启服务
systemctl restart iptables.service

如下表示没有iptables服务需要安装
[root@localhost]# service iptables restart
Redirecting to /bin/systemctl restart iptables.service
Failed to restart iptables.service: Unit not found.
[root@localhost]# yum install iptables-services

报错解决方式
[root@localhost yum.repos.d]# service iptables restart
Redirecting to /bin/systemctl restart iptables.service
Job for iptables.service failed because the control process exited with error code. See “systemctl status iptables.service” and “journalctl -xe” for details.
[root@localhost yum.repos.d]# iptables -A INPUT -p tcp --dport 443 -j ACCEPT
[root@localhost yum.repos.d]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@localhost yum.repos.d]# service iptables restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值