centos7找不到iptables怎么办

网友投稿 2136 2022-10-11

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

centos7找不到iptables怎么办

centos7找不到iptables的解决办法:1、写一条iptables命令配置防火墙规则;2、通过service iptables save进行保存;3、执行service iptables restart命令重启即可。

本文操作环境:CentOS 7系统、Dell G3电脑。

centos7找不到iptables怎么办?

centos7下找不到iptables文件?

最近在centos7下,搭建ftp服务,按照步骤一步一步来,发现 etc/sysconfig/iptables这个文件并不存在,然后去找解决方案,

解决办法:

1. 随便写一条iptables命令配置个防火墙规则。如:iptables -P OUTPUT ACCEPT。

[root@iZ23gx7o02aZ /]# cd /etc/sysconfig/[root@iZ23gx7o02aZ sysconfig]# iptables -P OUTPUT ACCEPT

2. service iptables save进行保存。

[root@iZ23gx7o02aZ sysconfig]# service iptables saveiptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ][root@iZ23gx7o02aZ sysconfig]# lsatd firstboot iptables-config networking readonly-root sshdauditd grub irqbalance network-scripts rhn sysstatauthconfig htcacheclean kdump ntpd rngd sysstat.ioconfcbq httpd kernel ntpdate rsyslog system-config-firewallclock i18n keyboard prelink sandbox system-config-firewall.oldconsole init modules quota_nld saslauthd udevcpuspeed ip6tables-config netconsole raid-check selinuxcrond iptables network readahead smartmontools[root@iZ23gx7o02aZ sysconfig]#

3. service iptables restart命令重启:

[root@iZ23gx7o02aZ sysconfig]# service iptables restartiptables: Setting chains to policy ACCEPT: filter [ OK ]iptables: Flushing firewall rules: [ OK ]iptables: Unloading modules: [ OK ]iptables: Applying firewall rules: [ OK ][root@iZ23gx7o02aZ sysconfig]#

但是在service iptables save进行保存操作时,提示save指令不存在,于是继续找解决方案,

首先不管防火墙有没有关 都使用systemctl stop firewalld 关闭防火墙

然后使用 yum install iptables-services 安装或更新服务

再使用systemctl enable iptables 启动iptables

最后 systemctl start iptables 打开iptables

大功告成

试试service iptables save

推荐教程:《centos教程》

php入门到就业线上直播课:查看学习

上一篇:linux 怎么增加用户
下一篇:如何解决java linux文件中文乱码问题
相关文章

 发表评论

暂时没有评论,来抢沙发吧~