1818IP-服务器技术教程,云服务器评测推荐,服务器系统排错处理,环境搭建,攻击防护等

当前位置:首页 - 网站技术 - 正文

君子好学,自强不息!

可能大家还对“centos7找不到iptables怎么办 centos7.3找不到iptables”有些不明白,下面由1818ip小编来为大家解答一下,现在我们来一起看看吧!

本文操作环境: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 save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@iZ23gx7o02aZ sysconfig]# ls
atd         firstboot         iptables-config  networking       readonly-root  sshd
auditd      grub              irqbalance       network-scripts  rhn            sysstat
authconfig  htcacheclean      kdump            ntpd             rngd           sysstat.ioconf
cbq         httpd             kernel           ntpdate          rsyslog        system-config-firewall
clock       i18n              keyboard         prelink          sandbox        system-config-firewall.old
console     init              modules          quota_nld        saslauthd      udev
cpuspeed    ip6tables-config  netconsole       raid-check       selinux
crond       iptables          network          readahead        smartmontools
[root@iZ23gx7o02aZ sysconfig]#

3. service iptables restart命令重启:

[root@iZ23gx7o02aZ sysconfig]# service iptables restart
iptables: 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

以上就是“centos7找不到iptables怎么办 centos7.3找不到iptables”的详细内容,更多请关注1818ip网其它相关文章!

本文来源:1818IP

本文地址:https://www.1818ip.com/post/6890.html

免责声明:本文由用户上传,如有侵权请联系删除!

发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。