Skip to contentSkip to conversation

Set second IP on bridge

Bridge Koen Vermeer 2 participants 4 messages Apr 23, 2008 – Apr 28, 2008 Ethernet bridge

lore
Share & tools
lore
#0 lore raw

[I posted this before subscribing; I couldn't find it in the archives after a few hours, so I'm trying again now. Apologies if it reaches the list twice!]

Hi,

I am connected through one ethernet interface to a network on which two subnets are available. One is in the 192.168.11.0 range, the other in the 172.31.1.0 range. On the first one, I have a static IP, on the second on, I obtain one by DHCP. Without bridging, I can set this up by using eth0 and eth0:1.

Now, for virtualization, I want to set up a bridge on my one ethernet interface. I can do this just fine, and end up with (let's say) br0. Then, I can set an IP address to br0. But what I want to do is set two IP addresses. I have been unable to do so thus far. Trying to use br0:1 didn't produce anything useful.

So, before trying further with br0:1 or something similar, I was wondering whether what I like to do is actually possible. If it is, am I on the right track? If it isn't, is there some other way to work around this?

Best,
Koen

#1 lore raw
Quoted 5 lines · Koen Vermeer

Now, for virtualization, I want to set up a bridge on my one ethernet interface. I can do this just fine, and end up with (let's say) br0. Then, I can set an IP address to br0. But what I want to do is set two IP addresses. I have been unable to do so thus far. Trying to use br0:1 didn't produce anything useful.

That should work. What happens?

You can also try "ip address add (...) dev br0" to avoid the old-style subinterfaces.

Signature · 3 lines
Malcolm Scott
Research Assistant
University of Cambridge Computer Laboratory
#2 lore raw
Quoted 8 lines · Malcolm Scott
Quoted 5 lines

Now, for virtualization, I want to set up a bridge on my one ethernet interface. I can do this just fine, and end up with (let's say) br0. Then, I can set an IP address to br0. But what I want to do is set two IP addresses. I have been unable to do so thus far. Trying to use br0:1 didn't produce anything useful.

That should work. What happens?
You can also try "ip address add (...) dev br0" to avoid the old-style subinterfaces.

Thanks for the quick reply! I tried again today, and it suddenly works just fine. I may have messed up my network settings earlier, and the reboot might have fixed that. It now works with both 'ifconfig br0:1 ...' and 'ip addr add ... dev br0'.

I'm still strugling to get this incorporated in my
Debian /etc/network/interfaces file, but I guess that's off-topic here. In case it isn't, or if you know the right place to ask about that, please let me know.

Thanks for the help!

Best,
Koen Vermeer

#3 lore raw
Quoted 4 lines · Koen Vermeer

I'm still strugling to get this incorporated in my
Debian /etc/network/interfaces file, but I guess that's off-topic here. In case it isn't, or if you know the right place to ask about that, please let me know.

This should work:

auto br0:1
iface br0:1 inet static
address ...
netmask ...

(after your definition for br0)

Or alternatively

auto br0
iface br0 inet (...)
...
up ip address add ... dev $IFACE
down ip address del ... dev $IFACE

Signature · 3 lines
Malcolm Scott
Research Assistant
University of Cambridge Computer Laboratory