We recently set up a server on Debian Wheezy Beta 3 (x86_64) which has a native IPv6 connection.
We configured the eth0 interface to get the IPv6 configuration through some post-up hook commands in
/etc/network/interfaces. The result is, that after the booting the system up, there is only IPv4 and an auto-configured link-local IPv6 address configured on the interface, as if the command has never been executed.
When we additionally place the commands after the call to
ifup -a inside the
/etc/init.d/networking init script, everything works as expected and we have a fully configured interface after booting up.
This is quite an ugly way to configure the interface. What are we doing wrong with the ifup post-up hooks? Or is this a bug?
Update: One additional fact is that I'm using a Dropbear SSH server to enable me to unlock my LUKS encrypted root file system. The Linux kernel is therefore given an IP address through the GRUB bootloader. That could mean that the IPv6 configuration is not done because eth0 is already up. I then tried to put an
ifdown eth0 before
ifup -a line in the /etc/init.d/networking script. It didn't change anything. Here an example of how it looked like:
ifdown eth0 if ifup -a $exclusions $verbose && ifup_hotplug $exclusions $verbose
Update: I set up a little script as post-up hook which configures the interface and writes the output to a log file. The result was that the log file was never written, which means the post-up hook wasn't called at all.
The section from
/etc/network/interfaces looks like this (IP-addresses changed):
allow-hotplug eth0 iface eth0 inet static address 184.108.40.206 netmask 255.255.255.192 network 220.127.116.11 broadcast 18.104.22.168 gateway 22.214.171.124 dns-nameservers 126.96.36.199 dns-search mydomain.tld post-up ip -6 addr add 2001:db8:100:3022::2 dev eth0 post-up ip -6 route add fe80::1 dev eth0 post-up ip -6 route add default via fe80::1 dev eth0
I also tried it in this alternative way:
auto eth0 iface eth0 inet static address 188.8.131.52 netmask 255.255.255.192 network 184.108.40.206 broadcast 220.127.116.11 gateway 18.104.22.168 dns-nameservers 22.214.171.124 dns-search mydomain.tld iface eth0 inet6 static address 2001:db8:100:3022::2 netmask 64 gateway fe80::1
What we added to
… case "$1" in start) process_options check_ifstate if [ "$CONFIGURE_INTERFACES" = no ] then log_action_msg "Not configuring network interfaces, see /etc/default/networking" exit 0 fi set -f exclusions=$(process_exclusions) log_action_begin_msg "Configuring network interfaces" if ifup -a $exclusions $verbose && ifup_hotplug $exclusions $verbose then # Our additions ip -6 addr add 2001:db8:100:3022::2 dev eth0 ip -6 route add fe80::1 dev eth0 ip -6 route add default via fe80::1 dev eth0 log_action_end_msg $? else log_action_end_msg $? fi ;; …
Update: The output of
ip -6 address show eth0 after booting up is:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000 inet6 fe80::abcd:abcd:abcd:abc/64 scope link valid_lft forever preferred_lft forever