【问题标题】:How to convert iptables-service rules into firewalld rules?如何将 iptables-service 规则转换为 firewalld 规则?
【发布时间】:2019-09-06 09:49:48
【问题描述】:

我正在设置 vpnserver,我有需要转换为 Firewalld 规则的 IPTables 规则

启用 nat 和后路由:

iptables -t nat -A POSTROUTING -s 192.168.7.0/24 -j SNAT --to-source [YOUR SERVER IP ADDRESS]

iptables-save > /etc/sysconfig/iptables

感谢您的帮助!

【问题讨论】:

    标签: linux centos firewall iptables


    【解决方案1】:

    我不会说必须使用 firewalld,但是,有一个指南可以帮助您从 iptables 迁移到 firewalld,然后是 RHEL 6 --> RHEL 7 guide

    TL;DR - 如果您在升级到 CentOS 7 并安装 firewalld 后配置了 system-config-firewall,则可以使用 firewall-cmd-offline 工具 将/etc/sysconfig/system-config-firewall中的配置迁移到firewalld的默认区域/etc/firewalld

    其他选项是禁用 firewalld 并继续使用旧的 iptables 和 ip6tables 服务。这将允许您保留现有的防火墙规则。复制 iptables-save 导出并使用 iptables-restore 加载它。

    只需使用 firewall-cmd 或 firewall-config 创建一个新配置。

    【讨论】:

    • 幸运的是,我在启用 iptables 时遇到了问题,我安装了但无法使用任何命令启用它,例如:sudo systemctl enable iptablessudo systemctl start iptables'systemctl unmask iptables ---> 回复是:Failed to start iptables.service: Unit is masked 或 @ 987654329@
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-10
    • 2014-07-03
    • 1970-01-01
    • 2014-01-30
    • 2011-04-10
    • 2015-07-27
    相关资源
    最近更新 更多