IPv6, can't find a way to use dhclient with a given config file
Byh0ki opened this issue · comments
Hello,
I was previoulsy on Alpine 3.12 and was not using ifupdown-ng
. I recently
upgraded to 3.13 which brings ifupdown-ng
by default as the new Network
manager. My previous IPv6 configuration is no longer working and I end up
with no network because the interface stays down.
Here is my /etc/network/interfaces
:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
iface eth0 inet6 static
pre-up dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v $IFACE
post-down dhclient -x -pf /var/run/dhclient6.pid
address 2001::2
netmask 56
with /etc/dhcp/dhclient6.conf
:
interface "eth0" {
send dhcp6.client-id <duid>;
}
Here is the error I get most of the time when I try to bring the interface up:
Internet Systems Consortium DHCP Client 4.4.2
Copyright[...]
Can't bind to dhcp address: Address not available
Please make sure there is no other dhcp serveur
running and that there's no entry for dhcp or boopt
in /etc/initd.conf.
[...]
ifup: failed to change the interface eth0 state to `up`
ifup fails most of the time (something like 9/10). I think this a race
condition between multiple instances of dhcpclient, but I might be wrong.
Maybe ifupdown-ng
does something in the background that prevent my pre-up
command to run properly ?
Moreover, ifupdown-ng
doesn't seem to provide a simple way to configure
dhclient like it does for dhcpcd at:
ifupdown-ng/executor-scripts/linux/dhcp
Line 25 in e4fa275
Is there any plan regarding this ?
Edit: It was late, I missed this one, it's not yet available on Alpine but it's
in the code.
Lastly, is there a proper way to convert my config to take advantage of
ifupdown-ng
? I need to use dhcpclient to provide the DUID to my
network provider.
From the doc, I think I can do that:
auto lo
iface lo
use loopback
auto eth0
iface eth0
use dhcp
But I'm clueless for IPv6. :/ (the doc is quite minimal regarding IPv6)
Thanks,
--
Sevan
There’s two issues here.
One issue is that it appears $IFACE
is not substituted (though it should be, we use sh -c
), which causes your pre-up to fail. Not sure why this is happening, will investigate it.
Other issue is that dhcp-config is not respected for the dhcp executor. That one is in the code already and I can backport it to Alpine current release. Typically you would want to use a single dhclient for both ipv4 and ipv6, running two at once can cause problems.
Ok, it appears $IFACE
is being substituted as expected.
The configuration should be fine in that regard, so I have no idea why dhclient is failing there.
Can you provide a full log for ifup -v eth0
with eth0 already down?
In general, I recommend using dhcpcd here, which can be configured to handle both ipv4 and ipv6 dhcp and provide the DUID in a single process.
We could add some convenience functionality for configuring dhcpcd to use the DUID, with dhcp-duid
statement or such.
Let me know what your thoughts are on that.
Oh!
I think I know what is going on.
We are probably using dhcpcd for IPv4, as we prefer that implementation when it is available.
But, you are using dhclient for IPv6. dhcpcd normally manages both IPv4 and IPv6, which would cause the conflict.
One possibility you might try is adding a dhcp-program dhclient
statement to the interface to force dhclient to be used for IPv4-only DHCP.
But, you would ultimately be better off putting your DUID in /var/lib/dhcpcd/duid
I think.
Other issue is that dhcp-config is not respected for the dhcp executor. That one is in the code already and I can backport it to Alpine current release. Typically you would want to use a single dhclient for both ipv4 and ipv6, running two at once can cause problems.
Yup, using only one client should be better!
Can you provide a full log for ifup -v eth0 with eth0 already down?
The log I gave you (with the error) were obtained with eth0 already down.
In general, I recommend using dhcpcd here, which can be configured to handle both ipv4 and ipv6 dhcp and provide the DUID in a single process.
We could add some convenience functionality for configuring dhcpcd to use the DUID, with dhcp-duid statement or such.
Let me know what your thoughts are on that.
I will try dhcpcd for both IPv4 and IPv6 and will report here! I don't know how dhcpcd works but that would be nice to be able to specify a DUID from the interfaces file.
We are probably using dhcpcd for IPv4, as we prefer that implementation when it is available.
dhcpcd is not installed on my Alpine Linux so I don't think this is the issue :/
Strange. As far as I know, dhcpcd is the only one that could cause a conflict in this setup. Maybe I need to lab it.
With dhcpcd, you can put the DUID in /var/lib/dhcpcd/duid
. I think it makes sense for Alpine to just use dhcpcd as default, actually.
Hello,
I finally got it working. My linux box is at Online.net/Scaleway and
their way of doing IPv6 is not conventional. We have to setup IPv6
Prefix Delegation. Here is my configurations files:
End of /etc/dhcpcd.conf
:
# Online.net Prefix Delegation
noipv6rs
# eth0
interface eth0
ipv6rs
ia_pd 1 eth0/0
DUID in /var/lib/dhcpcd/duid
.
/etc/network/interfaces
:
auto lo
iface lo
use loopback
auto eth0
iface eth0
use dhcp
address <ipv6_prefix>:<ipv6_suffix>
netmask 64
So now, I'm using one client for IPv4 and IPv6.
Thanks you for your help.
--
Sevan