-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Description
Kathará currently has two limitations with respect to Netkit that complicate the deployment of a DHCP server inside a lab.
- By default Docker bind-mounts both files
/etc/hosts
and/etc/resolv.conf
limiting the ability of the DHCP client to change the last one when a DNS server is specified ; - Netkit provides deterministic pseudo-random MAC address for the machines interfaces (thanks to this patch), facilitating static DHCP leases.
To circumvent these limitations, we currently invoke the following shell script from shared.startup
:
umount /etc/resolv.conf
umount /etc/hosts
echo '127.0.0.1 localhost' > /etc/hosts
for eth in $(ip -br a | grep '^eth' | cut -d@ -f1); do
ip link set $eth address $(/shared/mojo/macaddr $HOSTNAME $eth)
done
where macaddr
is a small Python script:
#!/usr/bin/env python3
from hashlib import sha1
from sys import argv
m = sha1()
m.update(argv[1].encode())
m.update(b"-")
m.update(argv[2].encode())
d = m.digest()
addr = [ (d[i]+d[i+6]) % 256 for i in range(6) ]
addr[0] &= 0xfe
addr[0] |= 0x02
print(':'.join(map(lambda x : ("00"+hex(x)[2:])[-2:],addr)))
It might be possible to directly provide these functionality inside Kathará.
Metadata
Metadata
Type
Projects
Status
Done