Dominik Szymański asked:
For some time I am struggling with configuration of IPv6 in my Ubuntu VPS. I followed many tutorials on this matter, but none worked for me.
The problem is, when I use one-time configuration in console:
ip addr add 2001:41D0:401:3000::XXXX/128 dev eth0 ip -6 route add 2001:41D0:401:3000::1 dev eth0 ip -6 route add default via 2001:41D0:401:3000::1 dev eth0
Everything is OK (of course I replaced last part of my IP with
However when I tried to put these into my
/etc/network/interfaces, after reboot I am left with only autoconfig IPv6 address.
No matter what I tried to enter into this file, what I get on
ip addr show eth0 (
eth0 is my interface) is:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether fa:16:3e:7e:48:85 brd ff:ff:ff:ff:ff:ff inet 164.132.XXX.XXX/32 brd 164.132.XXX.XXX scope global eth0 valid_lft forever preferred_lft forever inet 145.239.XXX.XXX/32 brd 145.239.XXX.XXX scope global eth0:0 valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fe7e:4885/64 scope link valid_lft forever preferred_lft forever
I have 2 IPv4 addresses, and they both work, but I’d love to have IPv6 too. I have one assigned by OVH.
# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 164.132.XXX.XXX netmask 255.255.255.255 post-up /sbin/ip route add 164.132.XXX.1 dev eth0 post-up /sbin/ip route add default via 164.132.XXX.1 post-up /sbin/ifconfig eth0:0 145.239.XXX.XXX netmask 255.255.255.255 broadcast IP_FAIL_OVER pre-down /sbin/ifconfig eth0:0 down pre-down /sbin/ip route del default via 164.132.XXX.1 pre-down /sbin/ip route del 164.132.XXX.1 dev eth0 dns-nameserver 22.214.171.124 dns-search ovh.net iface eth0 inet6 static address 2001:41D0:401:3000::XXXX netmask 128 post-up /sbin/ip -6 route add 2001:41D0:401:3000::1 dev eth0 post-up /sbin/ip -6 route add default via 2001:41D0:401:3000::1 dev eth0 pre-down /sbin/ip -6 route del default via 2001:41D0:401:3000::1 dev eth0 pre-down /sbin/ip -6 route del 2001:41D0:401:3000::1 dev eth0 auto eth0:0 iface eth0:0 inet static address 145.239.XXX.XXX netmask 255.255.255.255
I also tried adding IPv6 like this:
iface eth0 inet6 static address 2001:41D0:401:3000::XXXX netmask 128 gateway 2001:41D0:401:3000::1
and with full (expanded) IP addresses, but without any success.
net.ipv6.conf.eth0.autoconf=0 net.ipv6.conf.default.autoconf=0 net.ipv6.conf.all.autoconf=0 net.ipv6.conf.eth0.accept_ra=0
to my sysctl.conf, as OVH tutorial and some other suggested, but it didn’t change anything, whether it was there or not.
Between each check I rebooted whole machine, to make sure all configs were reloaded, and as
service networking restart fails with
sty 04 15:54:21 vpsXXXXXX.ovh.net ifup: RTNETLINK answers: File exists sty 04 15:54:21 vpsXXXXXX.ovh.net ifup: Failed to bring up eth0. sty 04 15:54:21 vpsXXXXXX.ovh.net ifup: RTNETLINK answers: File exists sty 04 15:54:21 vpsXXXXXX.ovh.net ifup: Failed to bring up eth0:0. sty 04 15:54:21 vpsXXXXXX.ovh.net systemd: networking.service: Main process exited, code=exited, status=1/FAILURE sty 04 15:54:21 vpsXXXXXX.ovh.net systemd: Failed to start Raise network interfaces.
Thank you very much for all your help and I will be glad to provide more information if needed.
The format of specifying a network interface alias as
interface:number has been deprecated in Linux for many years, and should not be used anymore (being deprecated, it may be removed in the future). Today, all of the IP addresses you may need are added directly to the interface, without the need for aliasing.
So you need to change
auto eth0 only needs to appear once.) You currently have:
auto eth0:0 iface eth0:0 inet static address 145.239.XXX.XXX netmask 255.255.255.255
This should instead be:
iface eth0 inet static address 145.239.XXX.XXX netmask 255.255.255.255
Applications which were configured to use the old-style interface alias should instead be set up to use the corresponding IP address, or to listen to all addresses, as appropriate.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.