<分区>
这个问题似乎不是关于 a specific programming problem, a software algorithm, or software tools primarily used by programmers 的.如果您认为这个问题是关于 another Stack Exchange site 的主题,您可以发表评论以说明问题可能在哪里得到解答。
关闭 4 年前。
<分区>
这个问题似乎不是关于 a specific programming problem, a software algorithm, or software tools primarily used by programmers 的.如果您认为这个问题是关于 another Stack Exchange site 的主题,您可以发表评论以说明问题可能在哪里得到解答。
关闭 4 年前。
我安装了最低配置的 CentOS 7(操作系统 + 开发工具)。我正在尝试为 httpd
服务打开 80 端口,但是我的 iptables 服务出了点问题……它出了什么问题?我究竟做错了什么?
# ifconfig/sbin/service iptables save
bash: ifconfig/sbin/service: No such file or directory
# /sbin/service iptables save
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.
# sudo service iptables status
Redirecting to /bin/systemctl status iptables.service
iptables.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
# /sbin/service iptables save
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.
# sudo service iptables start
Redirecting to /bin/systemctl start iptables.service
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.
最佳答案
使用 RHEL 7/CentOS 7,firewalld被引入来管理 iptables。恕我直言,firewalld 比服务器环境更适合工作站。
可以回到更经典的 iptables 设置。首先,停止并屏蔽 firewalld 服务:
systemctl stop firewalld
systemctl mask firewalld
然后,安装 iptables-services 包:
yum install iptables-services
在启动时启用服务:
systemctl enable iptables
管理服务
systemctl [stop|start|restart] iptables
可以按如下方式保存防火墙规则:
service iptables save
或
/usr/libexec/iptables/iptables.init save
关于networking - 如何在 centos 7 上使用 iptables?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24756240/