The host has eth1 with many MacVlan interfaces attached and those MacVlan
interfaces are assigned to container namespace.
The host could run DHCP proxy on eth1 with the MAC address of these
MacVlan interfaces to get lease from DHCP server and also refresh the
lease afterwards.
Container will use this DHCP lease as static IPv4 without worry about
DHCP process at all.
The mozim API:
let config = DhcpV4Config::new_proxy(out_going_interface, mac_to_proxy)?;
let mut cli = DhcpV4Client::init(config, None)?
loop {
let events = cli.poll(POLL_WAIT_TIME)?;
for event in events {
if let Some(lease) = cli.process(event)? {
// Send this lease info to container
}
}
}
CLI:
The old mzc eth1 has changed to mzc run eth1 for normal DHCP
client process.
Introduced mzc proxy eth1 <MAC_TO_PROXY> to run DHCP proxy.
Limitation:
The renew stage is unicast to DHCP server. In proxy mode, it should
be done in raw socket in order to send package on behalf of other
interface. This requires ARP resolution. So this patch we skip renew
stage and only do rebind(broadcast) during T1 and T2 timerange.
Use case:
The host has eth1 with many MacVlan interfaces attached and those MacVlan interfaces are assigned to container namespace.
The host could run DHCP proxy on eth1 with the MAC address of these MacVlan interfaces to get lease from DHCP server and also refresh the lease afterwards.
Container will use this DHCP lease as static IPv4 without worry about DHCP process at all.
The mozim API:
CLI:
The old
mzc eth1
has changed tomzc run eth1
for normal DHCP client process.Introduced
mzc proxy eth1 <MAC_TO_PROXY>
to run DHCP proxy.Limitation:
Integration test case included.