How to request dhcp (using dhclient) on a virtual interface (i.e. eth0:1)

You can’t really do this. Your card only has one MAC address but multiple IP interfaces. They will need to have their addresses statically assigned.

When the DHCP server sends back the DHCPOFFER how does it get delivered to eth0:1 and not to eth0? eth0:1 sends out a DHCPDISCOVER or a DHCPREQUEST by broadcasting. The DHCP server responds with a DHCPOFFER to inform the client of its IP address. But how will the DHCPOFFER arrive if eth0:1 doesn’t yet have an IP address? The DHCP server broadcasts back and relies on the link layer to correctly deliver the ethernet frame (with the other associated layers stacked on top of it) to the right MAC address. And now your device has an IP address.

The problem for the DHCPOFFER is that from a Layer-2 perspective the two “devices” (eth0 and eth0:1) are indistinguishable, and so (from a Layer-3 perspective) the DHCPOFFER is destined for (because eth0:1 doesn’t yet have an IP address).

You can get around this by using VLANs. VLANs will allow you to take the same physical broadcast domain and treat it like multiple “virtual” broadcast domains (hence the name).

Leave a Comment