5

Original post

I'm trying to configure a static IPv6 address for my Debian container (running on LXD) but the system keeps ignoring my configuration.

Currently my /etc/network/interfaces looks like this:

auto eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp

auto eth1
iface eth1 inet static
    address 10.1.0.10/16
    gateway 10.1.0.1
iface eth1 inet6 static
    address fd01::10/64
    gateway fd01::1
    autoconf 0

The static IPv4 configuration and the DHCP option for IPv6 (on eth0) work fine as the command ip addr shows:

76: eth0@if77: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:53:50:bc brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.0.0.10/16 brd 10.0.255.255 scope global dynamic eth0
       valid_lft 84286sec preferred_lft 84286sec
    inet6 fd00::10/128 scope global
       valid_lft forever preferred_lft forever
78: eth1@if79: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:83:c3:49 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.1.0.10/16 brd 10.1.255.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fd01::658:fe25:52de:cc45/64 scope global dynamic mngtmpaddr
       valid_lft 3372sec preferred_lft 3372sec

But my system constantly keeps ignoring the static IPv6 configuration part and always generates it's own dynamic IPv6 address instead of using the preconfigured one. The output above also says that the ip address on this interface was generated dynamically.

But if I set the static IPv6 address with the command ip addr add fd01::10/64 dev eth1 it works but that's not an appropriate and permanent solution for this problem.

Edits

(1) systemd network manager

The command networkctl list returns the following output:

IDX LINK     TYPE     OPERATIONAL SETUP
 WARNING: systemd-networkd is not running, output will be incomplete.
 (...)
 16 eth0     ether    n/a         unmanaged
 18 eth1     ether    n/a         unmanaged
 (...)

I think that this means that the systemd network manager is disabled.

(2) /etc/init.d/networking

After rebooting the container and fetching the log of the /etc/init.d/networking service with systemctl status networking.service the following message is displayed

● networking.service - Raise network interfaces
     Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2020-02-08 00:22:06 UTC; 1min 31s ago
       Docs: man:interfaces(5)
    Process: 31 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
   Main PID: 31 (code=exited, status=1/FAILURE)

Feb 08 00:22:06 Core dhclient[112]: message status code Success: "all addresses still on link"
Feb 08 00:22:06 Core ifup[137]: RTNETLINK answers: File exists
Feb 08 00:22:06 Core ifup[31]: ifup: failed to bring up eth1
Feb 08 00:22:06 Core systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Feb 08 00:22:06 Core systemd[1]: networking.service: Failed with result 'exit-code'.
Feb 08 00:22:06 Core systemd[1]: Failed to start Raise network interfaces.

If I configure eth0 to use a static IPv6 address, the error also rises for eth0. I found this error message by following this tutorial to configure a static IPv6 address.

(3) Host system

One thing I didn't thought about at first is that the problem could be related to my host operating system. Because of that I didn't wrote that my host system is Gentoo with a customized kernel.
At the moement I haven't solved my problem at all but a test with the same setup on another host (this time ArchLinux) worked fine. Because the configuration is actually the same but the host system is different I think my problem is related to a configuration error on my host system (e.g. I must enable another kernel feature).
I didn't use exactly the same configuration. My normal host (Gentoo) uses Debian 10 and my ArchLinux test machine used Debian 11. When using Debian 11 on my Gentoo host it works fine. But also if I create a new container with Debian 10 the ip configuration works as expected.

3
  • Which version of Debian? The current standard for network configuration is systemd. manpages.debian.org/stretch/systemd/systemd.network.5.en.html I believe that /etc/network/interfaces is ignored in the default config. Feb 4, 2020 at 20:11
  • 2
    Is this belief challenged at all by the fairly obvious fact that the questioner's system is not ignoring it, and applying the addresses and netmasks that are contained in it? (-:
    – JdeBP
    Feb 4, 2020 at 21:18
  • Debian 10 using the SID repositiry
    – Daniel
    Feb 5, 2020 at 17:18

3 Answers 3

4

Finally I solved my problem through changing the order of my entries in my /etc/network/interfaces file. Now it looks like that:

auto eth1
iface eth1 inet static
    address 10.1.0.10/16
    gateway 10.1.0.1
iface eth1 inet6 static
    address fd01::10/64
    gateway fd01::1

auto eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp

If the static entries are configured first, everything works fine.

0

I don't think I can give you a complete answer, just something to investigate...

This doesn't look to me like your configuration is being ignored, it looks like it's being overwritten by something. IPv6 addresses starting FDxx:: are local address IPs. Typically un-configured interfaces will have a link local address (beginning FE80::) as well as other addresses. But your system isn't showing these. FDxx:: addresses don't just appear randomly, so something has configured these.

I've previously had problems with Debian based distributions coming shipped with more than one network manager. Specifically on a fork of Debian that shipped with a Beagle Bone Black, there was a package called connman installed as well as the DHCP client that ships with regular Debian.

I would check your system to see if anything else is possibly overwriting your networking config for IPv6.

0

I had the same problem – iface enp0s31f6 inet6 static (with address, netmask and gateway) was configured in /etc/network/interfaces, but when the system booted, ip addr showed only the link-local IPv6 address.

I've checked the output of sudo systemctl status networking.service:

root@redacted ~ # systemctl status networking.service
● networking.service - Raise network interfaces
     Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2020-09-02 14:44:47 CEST; 1min 45s ago
       Docs: man:interfaces(5)
    Process: 467 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
   Main PID: 467 (code=exited, status=1/FAILURE)

Sep 02 14:44:47 lh-mhk01 systemd[1]: Starting Raise network interfaces...
Sep 02 14:44:47 lh-mhk01 ifup[509]: /bin/sh: 1: route: not found
Sep 02 14:44:47 lh-mhk01 ifup[467]: ifup: failed to bring up enp0s31f6
Sep 02 14:44:47 lh-mhk01 systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Sep 02 14:44:47 lh-mhk01 systemd[1]: networking.service: Failed with result 'exit-code'.
Sep 02 14:44:47 lh-mhk01 systemd[1]: Failed to start Raise network interfaces.

Notice the line

Sep 02 14:44:47 lh-mhk01 ifup[509]: /bin/sh: 1: route: not found

Solution: install the package that contains the route command

sudo apt install net-tools

After reboot the IPv6 address is configured correctly 🎉😊

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .