I'm trying to configure static IPv6 with netplan on a cloud server (public cloud from OVH) running Ubuntu 18.04
I have created a /etc/netplan/66-ipv6.yaml
yaml file in addition to the existing /etc/netplan/50-cloud-init.yaml
:
network:
version: 2
ethernets:
ens3:
match:
name: ens3
addresses:
- '2001:what:ever::1234/128'
gateway6: '2001:what:ever::1'
Wether manually with netplan generate; netplan apply
or on reboot, the interface get its static IPv6 address but gateway6:
seems to have no effect at all.
me@server:~$ ip -6 route
2001:what:ever::1234 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium
Obviously the server can't reach any public IPv6 address at this point.
me@server:~$ ping6 google.com
connect: Network is unreachable
Manually adding the default route works fine.
me@server:~$ sudo ip -6 route add 2001:what:ever::1 dev ens3
me@server:~$ sudo ip -6 route add default via 2001:what:ever::1 dev ens3
me@server:~$ ip -6 route
2001:what:ever::1 dev ens3 metric 1024 pref medium
2001:what:ever:1234 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium
default via 2001:what:ever::1 dev ens3 metric 1024 pref medium
me@server:~$ ping6 -c 1 google.com
PING google.com(par10s27-in-x0e.1e100.net (2a00:1450:4007:809::200e)) 56 data bytes
64 bytes from par10s27-in-x0e.1e100.net (2a00:1450:4007:809::200e): icmp_seq=1 ttl=53 time=7.54 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 7.544/7.544/7.544/0.000 ms
Am I missing something very obvious ?
Subnets are (almost) always a /64. You configured your interface as a /128, which is only a single address. That means the gateway is on a different subnet and can't be reached.
What you probably want is to configure the address as a /64, and everything should work. The /64 is just a subnet mask. You're still assigning only a single address.