2

I have a home brew PC-like router running debian 9 stretch (the current stable as of today).

For several months, I managed to have it auto configure WAN ipv4 and WAN ipv6 like this:

# WAN vlan 832 internet
auto enp1s0.832
iface enp1s0.832 inet dhcp
iface enp1s0.832 inet6 manual

The inet6 part uses two scripts:

  • a first /etc/network/if-up.d/99-ipv6 script, used to start ISC dhcp client in IPV6 prefix delegation mode
  • a second /etc/dhcp/dhclient-exit-hooks.d/dhclient-ipv6 script, used to assign an IPV6 "/64" subnet to the LAN interface

This was working fine for several months. On reboots, the system was coming up quickly with both IPV4 and IPV6 fully fonctional.

Following an routine update of packages, the debian systemd "networking.service" started to hang on boot, while configuring the router WAN interface. It hanged for 5 minutes, and was killed by the default "network.service" time out. As a result, the WAN interface is UP, but the dhclient instances for IPV4 and IPV6-PD were also killed. This is quite bad, as the router is not refreshing the DCHP leases, if the DHCP clients are not running.

The debian networking.service was hanging on configuring the IPV6 part. When I tried to comment the IPV6 part like this:

# WAN vlan 832 internet
auto enp1s0.832
iface enp1s0.832 inet dhcp

The system was rebooting normally, without IPV6 though.

I also tried to use the "cacher" way like this:

auto enp1s0.832
iface enp1s0.832 inet dhcp
iface enp1s0.832 inet6 dhcp
  request_prefix 1
  accept_ra 2

With the above, Debian "networking.service" start both ISC DHCP client instances for IPV4 and IPV6: https://wiki.debian.org/IPv6PrefixDelegation

However, debian systemd networking.service still hangs 5 minutes with this setup.

So, I had to resort to a very dirty last resort trick:

auto enp1s0.832
iface enp1s0.832 inet dhcp
  up /sbin/dhclient -6 -P -pf /run/dhclient6.enp1s0.832.pid -lf /var/lib/dhcp/dhclient6.enp1s0.832.leases -df /var/lib/dhcp/dhclient.enp1s0.832.leases enp1s0.832&

With this, the debian networking.service is not timing out, and both dhclient instances for IPV4 and IPV6 are let to run correctly.

What is the clean way to have debian auto configuring IPV4 and IPV6 without hanging on boot?

5
  • BTW, the "Debian" networking.service is really the systemd networking service, so my first thought would be systemd screwed up again...
    – dirkt
    Mar 23, 2018 at 10:08
  • Interesting. So this would basically managed by freedesktop.org . I may be able to find a current bug on this, or else, I will submit one. Mar 23, 2018 at 11:30
  • FTR, technically all the work to auto configure /etc/network/interfaces is done by ifupdown. This is maintained by debian as far as I can tell. The bug backlog is kind of a mess, I will need to reproduce myself in a sandbox to have the ball rolling on this problem. Mar 23, 2018 at 13:29
  • I am not running systemd here, but technically systemd is not needed for ifupdown, and if ifupdown really is the only thing responsible for configuring the interfaces (which I somehow don't believe), it shouldn't matter if networking.service is running, not running, or timed out (because here on my machine I'm using ifupdown completey without networking.service). All ifupdown does is go through the scripts, and start dhclient etc.
    – dirkt
    Mar 23, 2018 at 17:04
  • Yes that's exactly what you say. The debian systemd service "networking.service" is a "oneshot" type service, that just runs ifup on all interfaces tagged as "auto". It times out by killing ifup after 5 min by default. Mar 23, 2018 at 17:14

1 Answer 1

0

The correct way to do this is to use the /etc/network/interfaces file "native ipv6 features". Since a few years, ifupdown DHCP for IPV6 management as been improved. It's not widely known though...

Regarding how your ISP decides to provide you IPV6 addresses, the details may fluctuate.

In most cases, your ISP is using DHCPV6-PD (Prefix Delegation). In this case, the /etc/network/interfaces should look like this (in debian stretch):

auto wanif
iface wanif inet dhcp
iface wanif inet6 dhcp
  request_prefix 1
  accept_ra 2

request_prefix is mandatory for DHCPV6-PD. Else, the DHCP client started by ifupdown will request a single address. This may not work very well with your ISP. In my case, with Orange in France, bad DCHP v6 request are completely ignored, a rejection message is not even replied by my ISP DHCP server. Yuck...

The part that is not managed by debian is the allocation of IPV6 addresses on the LAN. For this, one has to use custom scripts, as explained here https://wiki.debian.org/IPv6PrefixDelegation

One word of warning, though. My own DHCPv6 hook script was causing an interlocking in systemd services. As I rely on radvd (router advertisement) to expose IPV6 adresses on the LAN interface, I need to restart the radvd service when the WAN IPV6 prefix changes. The normal command to achieve this is:

systemctl restart radvd

However, this was causing a systemd interlocking at boot time. The initial setup of interfaces is done by a systemd service called "networking.services" (this service is mainly calling ifup --all).

To avoid interlocking with "networking.service", one has to use instead:

systemctl --no-block restart radvd

See https://www.freedesktop.org/software/systemd/man/systemctl.html for details.

You must log in to answer this question.

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