Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to understand how dhcp for IPv4 is used with bridging.

eth0 is configured to be in br0. This is working just fine but only br0 gets a dhcp lease, while eth0 doesn't. Both are configured with BOOTPROTO=dhcp. If anything, I would have expected eth0 to have the IP address and br0 as a "layer 2 device" to have none, not the other way around.

Any suggestion would be greatly appreciated.

share|improve this question
add comment

2 Answers

If both interfaces are set up for dhcp, the "tenant interface" cannot receive a dhcp lease before the "host interface". There is no way for eth0 to communicate with dhcp if br0 has no method to communicate on the network. IMO you should set up br0 to be static then have eht0 setup for dhcp.

share|improve this answer
    
Thank you for the answer, which makes a lot sense. But, who is the dhcp server here? the host OS? –  xczzhh Oct 24 '12 at 10:05
    
the host can be the DHCP as long as you specify it in the config. See: libvirt.org/formatnetwork.html –  midnightsteel Oct 24 '12 at 11:49
add comment

From here:

Normally it does not make sense to put any L3 protocol address on port interfaces - because incoming packets are diverted to the bridge interface before the L3 protocol is examined. This means the L3 protocol running on the port interface will never see any incoming packets.

(port interface = eth0, bridge interface = br0)

share|improve this answer
    
Thank you for the answer. Well, now, I do agree that an IP address is needed for the bridge to connect the network. But I am not so sure what you mean by it doesn't make sense to put any L3 protocol address on port interfaces. Do you mean, in this case, the bridge interface(br0) is acting as an ethernet interface of the whole virtual machine so that there is no need for the port interface(eth0) to have an IP? –  xczzhh Oct 24 '12 at 9:58
    
You have a bridge (br0) with multiple port interfaces (eth0, eth1). What it means is that, when a packet comes in on eth0 or eth1, the Linux kernel will divert the packet to the br0 before the IP stack gets a chance to do anything with it. Only after the packet gets routed to br0 does it get handed up to IP layer, so the IP address has to be assigned to br0. –  Jim Paris Oct 24 '12 at 18:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.