AIOps 平台的误解,挑战及建议(中),AIOps常见的误解
2136
2022-10-11
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入门到就业线上直播课:查看学习
发表评论
暂时没有评论,来抢沙发吧~