Linux The service command supports only basic LSB actions (start, stop, restart, try-restart, reload,force-reload, status)

当前位置: 首页 » 记录 » Linux The service command supports only basic LSB actions (start, stop, restart, try-restart, reload,force-reload, status)

分类: 记录 7911阅读阅读模式

CentOS 7 干掉了iptables 改用 firewalld ,默认的 /etc/sysconfig/iptables 是没有的,可以通过以下办法停用 firewalld ,启用 iptables 。

linux 保存防火墙服务提示:

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload,force-reload, status)

出现该提示表示缺少 iptables 文件。

ps:对于 RHEL 7 / CentOS 7,用 firewalld 来管理 iptables / IMHO / firewalld 是比较合适方便的。

 

1、停止防火墙「firewalld」

安装 iptables 前,需要先停止 firewalld ,否则会打架,导致安装失败。

  1. systemctl stop firewalld
  2. systemctl mask firewalld

 

2、安装 iptables

  1. yum install iptables-services

 

3、添加 iptables 到开机启动

  1. systemctl enable iptables

3.1、管理 iptables 命令

通过 systemctl 或者 service 来管理。

  1. systemctl [stop停止|start启动|restart重启] iptables
  2. service iptables start|stop|restart

 

4、改回使用 firewalld

如果不想用 iptables 了,想改回 firewalld 。可以通过以下命令。

停止 iptables

  1. systemctl stop iptables

移除 iptables 自启动

  1. systemctl disable

反屏蔽 firewalld

  1. systemctl unmask firewalld

启动 firewalld

  1. systemctl start firewalld

 

完毕!

参考

http://blog.csdn.net/allenmyth/article/details/41410799

http://blog.csdn.net/song_csdn1550/article/details/51768671

http://www.cnblogs.com/love3556/p/5923392.html

相关文章

评论已关闭。