I'm using Debian Wheezy on a dedicated server which uses IPv4 and IPv6 at the same time.
ifconfig eth0
eth0 Link encap:Ethernet HWaddr 11:11:11:11:11:11
inet adr:90.0.0.1 Bcast:90.0.0.255 Masque:255.255.255.0
adr inet6: fe80::21c:c0ff:feb9:829c/64 Scope:Lien
adr inet6: 2001:a100:1:bbbb::1/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1544 errors:0 dropped:0 overruns:0 frame:0
TX packets:2199 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:304146 (297.0 KiB) TX bytes:1376282 (1.3 MiB)
(Several minutes later, the RX dropped counter increases.)
cat /etc/network/interfaces
I first used the "gateway" keyword, but it didn't work, so I then tried to add the route in the file, but it didn't work either.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 90.0.0.1
netmask 255.255.255.0
network 90.0.0.0
broadcast 90.0.0.255
gateway 90.0.0.254
iface eth0 inet6 static
address 2001:a100:1:bbbb::1
netmask 64
# gateway 2001:a100:1:bbff:ff:ff:ff:ff
up ip -6 route add ::/0 via 2001:a100:1:bbff:ff:ff:ff:ff dev eth0
down ip -6 route del ::/0 via 2001:a100:1:bbff:ff:ff:ff:ff dev eth0
ip -6 route show
These are the routes shown several minutes after rebooting the server.
2001:a100:1:bbbb::/64 dev eth0 proto kernel metric 256
2001:a100:1:bb00::/56 dev eth0 proto kernel metric 256 expires 2591959sec
fe80::/64 dev eth0 proto kernel metric 256
default via fe80::224:c3ff:fe84:400 dev eth0 proto ra metric 1024 expires 1759sec
default via fe80::224:c3ff:fe84:800 dev eth0 proto ra metric 1024 expires 1759sec
Questions
Why isn't my default route taken into account (no matter using keyword
gateway
orip -6 route add
in the/etc/network/interfaces
, during boot time? Note that if I add the route manually, it works perfectly and I can TX and RX to and from the Internet using IPv6. (The problem is to make it automatic.)What are those strange kernel routes, that will expire? Do I need them? My server is connected directly to the same network as a rooter (2001:a100:1:bbff:ff:ff:ff:ff), which is itself connected directly to the internet.
EDIT
ifdown --force eth0; ifup --verbose eth0;
Configuring interface eth0=eth0 (inet)
run-parts --verbose /etc/network/if-pre-up.d
ip addr add 90.0.0.1/255.255.255.0 broadcast 90.0.0.255 dev eth0 label eth0
ip link set dev eth0 up
ip route add default via 90.0.0.254 dev eth0
run-parts --verbose /etc/network/if-up.d
run-parts: executing /etc/network/if-up.d/avahi-daemon
run-parts: executing /etc/network/if-up.d/bind9
run-parts: executing /etc/network/if-up.d/mountnfs
run-parts: executing /etc/network/if-up.d/ntpdate
run-parts: executing /etc/network/if-up.d/openssh-server
run-parts: executing /etc/network/if-up.d/openvpn
run-parts: executing /etc/network/if-up.d/postfix
run-parts: executing /etc/network/if-up.d/upstart
Configuring interface eth0=eth0 (inet6)
run-parts --verbose /etc/network/if-pre-up.d
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
sysctl -q -e -w net.ipv6.conf.eth0.autoconf=0
ip link set dev eth0 up
ip -6 addr add 2001:a100:1:bbbb::1/64 dev eth0
ip -6 route add default via 2001:a100:1:bbff:ff:ff:ff:ff dev eth0
RTNETLINK answers: File exists
Failed to bring up eth0.
Possibly these
sysctl
settings might help you?The following configuration in /etc/network/interfaces works for me: