IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    ubuntu 22.04 VPS ping: connect: Network is unreachable

    冷轩信发表于 2023-03-05 13:00:00
    love 0

    新买了个VPS 有ipv6/64 但是ping不通ipv6 ping: connect: Network is unreachable
    查看 /etc/netplan/50-cloud-init.yaml

    network:
        version: 2
        ethernets:
            eth0:
                addresses:
                - 123.123.123.123/24
                - 2a10:cccc:ccc:ccc::/64
                gateway4: 123.123.123.1
                gateway6: 2a10:cccc:ccc::1
                match:
                    macaddress: 22:ed:f8:f7:9f:a2
                nameservers:
                    addresses:
                    - 1.1.1.1
                    - 8.8.4.4
                    - 2606:4700:4700::1111
                    search:
                    - ht-hosting.de
                set-name: eth0
    

    netplan apply 提示

    gateway4 has been deprecated, use default routes instead. See the
    'Default routes' section of the documentation for more details.
    gateway6 has been deprecated, use default routes instead. See the
    'Default routes' section of the documentation for more details.

    于是去看 https://netplan.io/examples/
    修改 /etc/netplan/50-cloud-init.yaml

    network:
        version: 2
        ethernets:
            eth0:
                addresses:
                - 123.123.123.123/24
                - 2a10:cccc:ccc:ccc::/64
                routes: 
                  - to: default
                    via: 123.123.123.1
                  - to: default
                    via: 2a10:cccc:ccc::1
                    on-link: true
                match:
                    macaddress: 22:ed:f8:f7:9f:a2
                nameservers:
                    addresses:
                    - 1.1.1.1
                    - 8.8.4.4
                    - 2606:4700:4700::1111
                    search:
                    - ht-hosting.de
                set-name: eth0
    
    

    然后

    netplan generate
    netplan apply
    

    ping ipv6.google.com

    PING ipv6.google.com(fra16s56-in-x0e.1e100.net (2a00:1450:4001:82f::200e)) 56 data bytes
    64 bytes from fra16s56-in-x0e.1e100.net (2a00:1450:4001:82f::200e): icmp_seq=2 ttl=122 time=0.973 ms
    64 bytes from fra16s56-in-x0e.1e100.net (2a00:1450:4001:82f::200e): icmp_seq=3 ttl=122 time=0.940 ms
    64 bytes from fra16s56-in-x0e.1e100.net (2a00:1450:4001:82f::200e): icmp_seq=4 ttl=122 time=0.953 ms



沪ICP备19023445号-2号
友情链接