找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8121|回复: 0

centos7中没有service iptables save无效的解决方法

[复制链接]
发表于 2019-4-2 11:17:53 | 显示全部楼层 |阅读模式
首先任意运行一条iptables防火墙规则配置命令如开通80端口:
' S9 n7 w' [" r9 `; a
iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
: U5 K, t2 l4 s) b# f3 j
然后对iptables服务进行保存:
8 p! w9 I; W( @( F
service iptables save

8 D2 d0 v" V4 D, T5 c* e5 k1 d
如果失败报出:The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

  g! w7 e6 R" e( [& t/ o
解决方法:
1 H9 w( s- R" n8 \systemctl stop firewalld 关闭防火墙
: {2 M7 @  B9 q0 [7 H
yum install iptables-services 安装或更新服务
$ y8 F4 i1 B* P
再使用systemctl enable iptables 启动iptables
/ ]' f7 T; l9 e0 v  Z  R  J* A
最后 systemctl start iptables 打开iptables
8 Y) S& w4 {: |) J* S1 F
再执行service iptables save

* u& w5 K: i2 J7 x
然后重启iptables服务:

# s9 E$ x8 z/ _
service iptables restart
) f) F5 B0 {7 N: k6 V
执行完毕之后/etc/syscofig/iptables文件就有了

/ A8 y. |! h+ p$ b  Q
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|第一站论坛 ( 蜀ICP备06004864号-6 )

GMT+8, 2025-12-16 21:01 , Processed in 0.054476 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表