AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 801350
Accepted
Roy Hinkley
Roy Hinkley
Asked: 2016-09-07 05:54:43 +0800 CST2016-09-07 05:54:43 +0800 CST 2016-09-07 05:54:43 +0800 CST

如何在 Redhat Enterprise Server 7 上保存 iptables 配置

  • 772

我有一个 Redhat 服务器 ( Red Hat Enterprise Linux Server release 7.2 (Maipo)),它在重新/启动时重置 iptable 规则。

根据版本 6 文档,我执行:

/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 systemctl iptables save

返回:

Unknown operation 'iptables'.

我找不到关于保存 ip 表的版本 7 文档,但以前的版本支持相同的命令。

我应该运行什么命令来保存 iptables 配置?

以供参考:

防火墙 d 状态:

systemctl status firewalld
firewalld.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
iptables rhel7
  • 2 2 个回答
  • 53910 Views

2 个回答

  • Voted
  1. Best Answer
    aesnak
    2016-09-07T06:14:56+08:002016-09-07T06:14:56+08:00

    你应该安装iptables-services包。

    然后service iptables save会工作。这些命令也将起作用:

    # iptables-save > /etc/sysconfig/iptables
    # ip6tables-save > /etc/sysconfig/ip6tables
    

    AFAIK,systemctl 没有任何选项来保存 iptables-services 的配置。

    注意:systemctl 语法如下:systemctl <operation> <unit>

    • 22
  2. Yuriy Vasylenko
    2018-04-14T00:44:04+08:002018-04-14T00:44:04+08:00

    这是 Red Hat 7 安全指南的链接: using_firewalls

    我用

    # cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 7.4 (Maipo)
    

    以及firewalld服务的状态:

    # systemctl status firewalld
    Active: active (running) since Fri 2018-04-13 10:00:18 CEST; 31min ago
    

    所以我认为,你也可以启用 firewalld服务:

    systemctl start firewalld
    systemctl enable firewalld
    

    并通过firewall-config更改规则

    1. 按超级
    2. 类型防火墙,
    3. 在下拉菜单中选择永久
    4. 进行必要的设置
    • 1

相关问题

  • OpenVPN 的 Linux IP 转发 - 正确的防火墙设置?

  • iptables 单个规则中的多个源 IP

  • 存储 iptables 规则的规范方法是什么

  • 使用 iptables 和 dhcpd 进行端口转发

  • 根据 Apache 日志数据自动修改 iptables 以阻止行为不良的客户端

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve