netplan - 无法将 gateway6 转换为“to/via”指令

netplan - 无法将 gateway6 转换为“to/via”指令

我正在尝试更新我的 netplan 配置以使用routes指令而不是gateway6因为gateway6已被弃用。

我的工作配置文件如下所示:

# /etc/netplan/51-cloud-init-ipv6.yaml
network:
    version: 2
    ethernets:
        eno1:
            dhcp6: no
            match:
              name: eno1
            addresses:
              - "2607:5300:60:2e26::1/128"
            gateway6: "2607:5300:0060:2eff:ff:ff:ff:ff"
            routes:
              - to: "2607:5300:0060:2eff:ff:ff:ff:ff"
                scope: link

在研究过程中,我发现这个答案建议我更新我的配置使其看起来像这样:

# /etc/netplan/51-cloud-init-ipv6.yaml
network:
    version: 2
    ethernets:
        eno1:
            dhcp6: no
            match:
              name: eno1
            addresses:
              - "2607:5300:60:2e26::1/128"
            routes:
              - to: default
                via: "2607:5300:0060:2eff:ff:ff:ff:ff"

但是,使用此配置,ping6会失败并出现错误Temporary failure in name resolution

我尝试了 的多种选项组合routes,包括:

routes:
  - to: default
    via: "2607:5300:0060:2eff:ff:ff:ff:ff"
    scope: link

routes:
  - to: default
    via: "2607:5300:0060:2eff:ff:ff:ff:ff"
    scope: link

routes:
  - to: "2607:5300:0060:2eff:ff:ff:ff:ff"
    via: "2607:5300:0060:2eff:ff:ff:ff:ff"

等等。我不确定如何成功地将gateway6指令转换为routes指令。任何建议都将不胜感激。谢谢!

答案1

您之前的配置中有:

        routes:
          - to: "2607:5300:0060:2eff:ff:ff:ff:ff"
            scope: link

gateway6这是一条独立于默认路由的路由。从 移动到 时,您不应删除或修改此路由routes

您最终的路线节应如下所示:

        routes:
          - to: "2607:5300:0060:2eff:ff:ff:ff:ff"
            scope: link
          - to: default
            via: "2607:5300:0060:2eff:ff:ff:ff:ff"

相关内容