新买了个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

标签: none