求助 nftables ipv6 相关

30 天前
 WingOwO

配置了 nftables IPv6 防火墙, 打算是开放 22 和 1874 端口

发现更新配置后, 有时候配置不起效, 改成完全开放端口, 再改回去, 端口限制才会起效

也有时候起效了, 但只能持续一段时间, 过一段时间之后就无法访问

现在关闭 IPV6 防火墙之后是完全可以正常访问的

求助这里是有什么问题吗?

这里是整张配置表, 也顺便配置了路由

flush ruleset

define DEV_WORLD = enp0
define DEV_LAN = enp1
define DEV_WLAN = wlp

define DEV_COM = podman0
define NET_PRIVATE = 192.168.1.0/22
define NET_COM = 10.88.0.0/16


table ip global {

   chain inbound_world {
        icmp type echo-request limit rate 5/second accept
        ip protocol . th dport vmap { udp . 53 : accept, tcp . 53 : accept, udp . 67 : accept }
    }

    chain inbound_private_lan {
        icmp type echo-request limit rate 5/second accept
        ip protocol . th dport vmap { tcp . 22 : accept, udp . 53 : accept, tcp . 53 : accept, udp . 67 : accept, tcp . 1874 : accept }
    }

    chain inbound_private_wlan {
        icmp type echo-request limit rate 5/second accept
        ip protocol . th dport vmap { tcp . 22 : accept, udp . 53 : accept, tcp . 53 : accept, udp . 67 : accept, tcp . 1874 : accept}
    }

    chain inbound {
        type filter hook input priority 0; policy drop;
        ct state vmap { established : accept, related : accept, invalid : drop }
        iifname vmap { lo : accept, $DEV_WORLD : jump inbound_world, $DEV_LAN : jump inbound_private_lan, $DEV_WLAN : jump inbound_private_wlan }
    }

    chain forward {
        type filter hook forward priority 0; policy drop;
        ct state vmap { established : accept, related : accept, invalid : drop }
        meta iifname . meta oifname { $DEV_LAN . $DEV_WORLD, $DEV_WLAN . $DEV_WORLD, $DEV_WORLD . $DEV_LAN, $DEV_WORLD . $DEV_WLAN, $DEV_LAN . $DEV_WLAN, $DEV_WLAN . $DEV_LAN, $DEV_COM . $DEV_WORLD, $DEV_WORLD . $DEV_COM} accept
    }

    chain postrouting {
        type nat hook postrouting priority 100; policy accept;
        ip saddr $NET_PRIVATE meta oifname $DEV_WORLD counter masquerade
        ip saddr $NET_COM meta oifname $DEV_WORLD counter masquerade
    }
}

table ip6 ip6global {

    chain inbound_world {
        icmpv6 type { echo-request, nd-neighbor-solicit } limit rate 5/second accept
        tcp dport { 22, 1874 } accept #生效后, 一段时间后失效
    }

    chain inbound {
        type filter hook input priority 0; policy drop;
        ct state vmap { established : accept, related : accept, invalid : drop }
        iifname vmap { lo : accept, $DEV_WORLD : jump inbound_world }
    }

}
686 次点击
所在节点    宽带症候群
1 条回复
yjzll
30 天前
limit rate 5/second 加个重新计数的参数试试

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1033275

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX