Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
hxm0070
V2EX  ›  Linux

IPTABLES 规则删除保存后重启自动恢复的问题

  •  
  •   hxm0070 · Apr 16, 2023 · 3159 views
    This topic created in 1300 days ago, the information mentioned may be changed or developed.
    求助各位老哥,遇到一个难题。
    前提:搞了个小主机,安装了 UBUNTU SERVER 22.04 ,安装了 zerotier 设置了转发,然后用 cockpit 安装了虚拟机,但是从 zerotier 网络的一个节点访问虚拟机的时候连不上,ping 的时候提示连接不到端口,后来确定问题出在了 iptables 规则的这两行上:

    Chain LIBVIRT_FWI (1 references)
    num target prot opt source destination
    2 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable

    Chain LIBVIRT_FWO (1 references)
    num target prot opt source destination
    2 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable

    我用“iptables -D”命令删除这两条规则后确实解决了,不过更恶心的问题是,用“iptables-save”命令或者“iptables-persistent”功能来保存修改,在重启后会再次出现这两条规则,这是怎么回事?是有别的程序自动加这两条?是的话怎么查是什么程序修改了呢?
    6 replies  •  2023-04-17 14:28:57 +08:00
    Jhma
    Jhma
    Apr 17, 2023
    2
    需要安装 iptables service ,我在 centos 上禁用了 firewalld ,firewalld 底层调用的就是 iptables
    AS4694lAS4808
    AS4694lAS4808
    Apr 17, 2023
    3
    @Jhma 禁用不至于吧,用 firewall-cmd --permanant 允许要用的端口更安全点?
    pagxir
    pagxir
    Apr 17, 2023 via Android
    4
    @Jhma firewalld 依赖 nftables ,而不是 iptables
    Jhma
    Jhma
    Apr 17, 2023
    5
    @pagxir 不好意思,我还在用 centos7 ,centos8 才是 nftables
    hxm0070
    hxm0070
    OP
    Apr 17, 2023
    6
    @jackyzy823 原来如此,多谢老哥!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1515 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 15:36 · PVG 23:36 · LAX 07:36 · JFK 10:36
    ♥ Do have faith in what you're doing.