Making DHCP work without a Livebox
05 Feb 2023Context
I replaced my Livebox with a GPON, but recently, Orange reinforced the checks they do on DHCP requests options.
The most important ones are:
- authentication is actually verified, instead of relying on just identification as before
- DHCP requests must have a CoS value of 6 in the VLAN header
Debian 11 Linux setup
The most “challenging” part is having DHCP packets with a CoS value of 6. Various options to achieve this are:
- using the
CLASSIFY
target ofiptables
, which does not work asdhclient
uses raw sockets - using
tc
’sskbedit
target to change packet contents, which is a bit ugly - using
cgroups
v1net_prio
target, which is problematic in the long run, as cgroups v1 are deprecated and not really easy to setup “cleanly” on a modern dirstro usingsystemd
- using
LD_PRELOAD
withdhclient
to set the socket priority to 6 and map to vlan cos usingegress-qos-map
After fiddling with different options, I finally settled for the last one, using Xavier Guerrin’s code.
interfaces
:
auto internet
iface internet inet manual
pre-up ip link add link enp3s0 name internet type vlan id 832 egress-qos-map 0:0 6:6
up SO_PRIORITY_DEBUG=1 SO_PRIORITY_VALUE=6 LD_PRELOAD=/root/so_priority.so/so_priority.so dhclient -v in
ternet
post-down ip link del internet
Updated dhclient.conf
:
option rfc3118-authentication code 90 = string;
option orange code 125 = string;
interface "internet" {
timeout 60;
retry 1;
select-timeout 0;
send dhcp-client-identifier 01:00:0d:b9:45:7d:96;
send vendor-class-identifier "sagem";
send user-class "+FSVDSL_livebox.Internet.softathome.Livebox4";
# generated with https://jsfiddle.net/kgersen/3mnsc6wy/
2f:61:64:61:79:65:65:70;
send rfc3118-authentication 00:00:00:00:00:00:00:00:00:00:00:1a:09:00:00:05:58:01:03:41:01:0D:66:74:69:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
request subnet-mask, routers,
domain-name-servers, domain-name,domain-search,
broadcast-address,
dhcp-lease-time, dhcp-renewal-time, dhcp-rebinding-time,
rfc3118-authentication, orange;
}