I'm trying to understand the logic behind the failure in the following scenario:
a. If a linux bridge with 2 interfaces, eth0 (LAN) and eth1 (WAN) is behind an ISP device e.g. a cable modem, it does not receive an ip address even if the bridge interface (br0) is set to do so. Instead, it forwards the DHCP offer to the device behind the bridge i.e. whatever device is connected to eth0.
The command dhclient br0
indicates that no leases get offered at all and dhclient then goes back to the leases recorded in dhclient.leases, which are old and irrelevant.
However,
b. if the bridge is inside the LAN itself with eth1 being exposed to an internal DHCP server, it does retrieve an ip address. And so do the devices behind it.
The /etc/network/interfaces contains:
auto lo eth0 eth1 br0
iface eth0 inet dhcp
iface eth1 inet dhcp
iface br0 inet dhcp
bridge_ports eth0 eth1
bridge_stp off
- This is puzzling. Any idea why this is happening? What's different in b vs. a?
- Is there a way to force br0 to obtain an ip address first and not pass it downstream?
Your cable modem is almost certainly restricted to serving IPs via DHCP to a single "learned" MAC address, which is the MAC of the eth1 interface, not the bridge's MAC.
Side note: If you're bridging those ports, then your LAN is directly connected to the WAN, hence not a LAN anymore... Hope you've accounted for this and have appropriate security.