6

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

  1. Why isn't my default route taken into account (no matter using keyword gateway or ip -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.)

  2. 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.
Fox
  • 952
  • 2
  • 12
  • 21
  • I am confused `2001:a100:1:bbff:ff:ff:ff:ff` is not on the same network as `2001:41D0:2:4F51::1`. Those are different networks. Can you ping `2001:a100:1:bbff:ff:ff:ff:ff` without the gateway set? – Zoredache Jul 24 '13 at 20:17
  • Sorry, I made a mistake. I just updated. Yes, I can ping it when the route is not set. – Fox Jul 24 '13 at 20:30
  • 1
    IPv4 address `90.0.0.1/24` and gateway `90.0.200.254` are on different networks, as are `2001:41D0:2:4F51::1/64` and `2001:a100:1:bbff:ff:ff:ff:ff`. The default routes you see (the `fe80:` addresses) are learned from Router Advertisements (`proto ra`). Your configuration makes no sense, so it is no surprise that it doesn't work... – Sander Steffann Jul 24 '13 at 20:30
  • I also just corrected the IPv4 mistakes. There were just obfuscation mistakes! – Fox Jul 24 '13 at 20:35
  • If you do an `ifdown --force eth0`, followed by an `ifup --verbose eth0`, do you see any output or errors? – Zoredache Jul 24 '13 at 20:57
  • I just added the output of this command. – Fox Jul 24 '13 at 21:21
  • 3
    Don't configure a /56 on an interface, always use a /64 – Sander Steffann Jul 25 '13 at 18:21
  • The thing is, I didn't configure it, and don't know where it does come from. This route appears automatically after reboot, as well as other strange routes (which will all expire). – Fox Jul 26 '13 at 14:24
  • 2
    I've checked my config, and I am pretty sure you are getting 2001:a100:1:bb00::/56 gateway address from your router as part of the IPv6 auto-configuration handshake. I notice you disabled net.ipv6.conf.eth1.autoconf, but you also need to disable net.ipv6.conf.eth1.accept_ra, if you want to completely turn-off IPv6 auto-configuration. (ref: http://superuser.com/questions/33196/how-to-disable-autoconfiguration-on-ipv6-in-linux) – ab77 Sep 19 '13 at 17:16

2 Answers2

3

Possibly these sysctl settings might help you?

net.ipv6.conf.all.autoconf=0
net.ipv6.conf.all.accept_ra=0
sjas
  • 305
  • 1
  • 4
  • 12
2

The following configuration in /etc/network/interfaces works for me:

iface eth0 inet6 static
     address 2001:a100:1:bbbb::1
     netmask 64
     up ip -6 route add default via 2001:a100:1:bbff:ff:ff:ff:ff
     down ip -6 route del default via 2001:a100:1:bbff:ff:ff:ff:ff
eKKiM
  • 1,483
  • 9
  • 22