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 / 问题 / 801131
Accepted
Jonny Barnes
Jonny Barnes
Asked: 2016-09-06 04:41:46 +0800 CST2016-09-06 04:41:46 +0800 CST 2016-09-06 04:41:46 +0800 CST

我的 nftables 规则阻止 IPv6

  • 772

我nftables.conf只是运行flush ruleset我include的防火墙规则。我从 Arch wiki 复制了它们。所以包含的firewall.rules内容包括:

# An iptables-like firewall

table firewall {
  chain incoming {
    type filter hook input priority 0;

    # established/related connections
    ct state established,related accept

    # invalid connections
    ct state invalid drop

    # loopback interface
    iifname lo accept

    # icmp
    icmp type echo-request accept

    # open tcp ports
    tcp dport {http, https, ...} accept

    # open udp ports
    udp dport {...} accept

    # drop everything else
    drop
  }
}

table ip6 firewall {
  chain incoming {
    type filter hook input priority 0;

    # established/related connections
    ct state established,related accept

    # invalid connections
    ct state invalid drop

    # loopback interface
    iifname lo accept

    # icmp
    icmpv6 type {echo-request,nd-neighbor-solicit,nd-router-solicit,mld-listener-query} accept

    # open tcp ports
    tcp dport {http, https, ....} accept

    # open udp ports
    udp dport {...} accept

    # drop everything else
    drop
  }
}

因此,当所有内容都加载完毕后,我无法使用 IPv6,ping6出现错误

From ams16s21-in-x0e.1e100.net icmp_seq=1 Destination unreachable: Address unreachable

但是,如果我运行sudo nft flush table ip6 firewall,ping6立即开始按预期工作。如果我然后重新建立 ip6 防火墙表,IPv6 连接不会立即失败,但等待几分钟我发现ping6命令返回上述错误。

我的托管服务提供商没有在网络级别提供任何 IPv6 自动配置或路由器广告。

以前有人见过这样的事情吗?

ipv6 nftables
  • 2 2 个回答
  • 5872 Views

2 个回答

  • Voted
  1. Best Answer
    Peter Green
    2016-09-06T04:53:47+08:002016-09-06T04:53:47+08:00

    IPv6 连接不会立即失败,但等待几分钟我发现 ping6 命令返回上述错误。

    我猜你已经破坏了邻居发现。最初,事情继续工作,因为您已经在邻居发现缓存中拥有了东西,但后来条目超时。

    您似乎允许邻居请求消息,但不允许邻居广告消息。

    • 3
  2. Sander Steffann
    2016-09-06T05:15:09+08:002016-09-06T05:15:09+08:00

    您正在删除太多 ICMPv6 类型。由于 ,应该允许大多数错误消息state established,related,但是您正在删除邻居广告和路由器广告。试试这个:

    icmpv6 type {echo-request,nd-neighbor-solicit,nd-neighbor-advert,nd-router-solicit,
                 nd-router-advert,mld-listener-query} accept
    

    它将允许未经请求的 NA 和 RA 进入,这可能会解决您的问题。

    如果您想确保错误消息也能通过(我没有测试是否state established,related确实适用于所有 ICMPv6 错误消息),那么还要添加这些:

    icmpv6 type {echo-request,nd-neighbor-solicit,nd-neighbor-advert,nd-router-solicit,
                 nd-router-advert,mld-listener-query,destination-unreachable,
                 packet-too-big,time-exceeded,parameter-problem} accept
    

    不应该是必要的,但以防万一:)丢弃 ICMPv6 错误消息会导致严重的延迟甚至阻塞连接,所以最好避免这种情况:)

    • 2

相关问题

  • IPv6 有哪些好的 IP 地址管理解决方案?[关闭]

  • 连接到 NAT 后启用 Teredo 的服务器

  • IPv4管理员的IPv6介绍[关闭]

  • 什么是支持 IPv6 胶水的又好又便宜的注册商?

  • 使用多少 IP V6 寻址?

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