Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The situation is that I have an Ubuntu box with multiple ethernet ports, which I'd like to behave as if connected to the computer through a switch. I can achieve this easily with a bridge. In /etc/network/interfaces:

iface br0 inet static
  bridge_ports regex eth.*
  address 192.168.1.1
  netmask 255.255.255.0

Under this config, another device can plug into any of the ports and ping this box at 192.168.1.1.

Now, the second part is that I'd like one of the ports to have an IP alias, whereby it also tries to get a DHCP address. I can do this on eth0 without the bridge, like so:

iface eth0 inet static
  address 192.168.1.1
  netmask 255.255.255.0

iface eth0:0 inet dhcp

Now the trick is, how would I combine this with the software switch functionality? Because brctl operates at layer 2, I can't create eth0:0 once eth0 is part of br0. The only thing I can do is create it as br0:0:

iface br0 inet static
  bridge_ports regex eth.*
  address 192.168.1.1
  netmask 255.255.255.0

iface br0:0 inet dhcp

This actually does almost exactly what I'd like, but with one weird problem: When the ethernet ports are disconnected or there's no DHCP server, the bridge doesn't get its proper static IP---or it'll get it, but not until a minute or two after the bootup is otherwise complete.

So my question is, what's up with the delay? Can I get rid of it somehow?

Alternatively, is there a better way I could accomplish what I want here? The ideal thing would be a daemon which would periodically poll for DHCP, and when it gets an IP assigns, puts it on the alias instead of the main interface.

Thanks.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

It looks like you're being bitten by the forwarding delay.

check out man brctl for details on how to tweak the various timing paramenters, but essentially what happens is that when brctl puts your bridge together it has to wait a little bit to learn the topology of your new network before it actually sends any packets.

Long answer short, this might fix your problem:

# brctl setfd br0 0
share|improve this answer
    
Very interesting. The need has passed at this point, but when I next encounter this, I'll give it a try. –  mikepurvis Feb 20 at 16:55

Usually an alias interface cannot get DHCP.

Try put DHCP on the br0 interface, and the static IP on the br0:0 alias.

share|improve this answer

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.