I'm configuring a dual stack network on a KVM server using static IPv4 and IPv6 addresses furnished by my provider.
I input all addresses, nameservers and gateways as required when installing Ubuntu. After that, I checked the /etc/network/interfaces file and noticed that the IPv6 stanza was absent (an ifconfig execution confirmed this), so I added the relevant lines. This is the final file:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static address 151.236.18.86 netmask 255.255.255.0 network 151.236.18.0 broadcast 151.236.18.255 gateway 151.236.18.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 91.227.204.227 91.227.205.227 dns-search mydomainname.com
iface eth0 inet6 static pre-up modprobe ipv6 address 2001:b60:1000:151:236:18:86:0 netmask 112 gateway 2001:b60:1000::1 dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844 dns-search mydomainname.comI then restarted networking via sudo /etc/init.d/networking stop && sudo /etc/init.d/networking restart and noticed that, while IPv4 was working, outbound IPv6 connectivity was not available (I did not check for inbound connectivity yet).
ifconfig and ip -6 addr show the IPv6 address is recognized:
eth0 Link encap:Ethernet HWaddr 52:54:00:b1:27:87 inet addr:151.236.18.86 Bcast:151.236.18.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:feb1:2787/64 Scope:Link inet6 addr: 2001:b60:1000:151:236:18:86:0/112 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:16409 errors:0 dropped:0 overruns:0 frame:0 TX packets:1178 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1126656 (1.1 MB) TX bytes:763658 (763.6 KB)
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000 inet6 2001:b60:1000:151:236:18:86:0/112 scope global valid_lft forever preferred_lft forever inet6 fe80::5054:ff:feb1:2787/64 scope link valid_lft forever preferred_lft foreverOn the contrary, no default route exists for the IPv6 stack:
$ ip -6 route
2001:b60:1000:151:236:18:86:0/112 dev eth0 proto kernel metric 256
fe80::/64 dev eth0 proto kernel metric 256 Trying to add the missing route leads to "No route to host" error:
$ sudo ip -6 route add default via 2001:b60:1000::1
RTNETLINK answers: No route to hostWhat could be wrong, and how can I fix the network configuration so that I can get the IPv6 stack working?
3 Answers
Inside your virtual machine, run the following:
ping6 ff02::2%eth0This ff02::2 is the IPv6 "all routers" multicast address. The on-link router will respond to the ping with its own address. For example:
64 bytes from fe80::56e6:fcff:fef4:66f1: icmp_seq=1 ttl=64 time=0.347 msYou can then add this in as the gateway address.
iface eth0 inet6 static ..... gateway fe80::56e6:fcff:fef4:66f1 ..... 2 Your netmask should be 64. With IPv6 every LAN is usually a /64. I guess your provider allows you to use a /112 from that /64, but you should configure a /64 on the interface.
3It turned out that the network mask length given to me by the provider was incorrect: the right one was 48. Changing it did the trick.