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.

I'm trying to make network bridging to work on a Debian squeeze (I'm experimenting in order to make a QEMU/KVM virtual machine that will be visible to the outside network as if it were a distinct machine). The problem is that when I type brctl addif br0 eth0 then I lose connectivity to the network until I type brctl delif br0 eth0.

More specifically, here's how my machine looks like before I do anything (essentially eth0 is listening on 147.102.160.153):

root@laura:/home/anthony# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 8c:73:6e:db:1c:1b brd ff:ff:ff:ff:ff:ff
    inet 147.102.160.153/24 brd 147.102.160.255 scope global eth0
    inet6 2001:648:2000:a0:8e73:6eff:fedb:1c1b/64 scope global dynamic 
       valid_lft 2591848sec preferred_lft 604648sec
    inet6 fe80::8e73:6eff:fedb:1c1b/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 4c:ed:de:8e:44:d7 brd ff:ff:ff:ff:ff:ff
4: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
5: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN 
    link/ether ee:7c:88:59:d0:e8 brd ff:ff:ff:ff:ff:ff

Now let me add the bridge:

root@laura:/home/anthony# brctl addbr br0
root@laura:/home/anthony# ip tuntap add dev tap0 mode tap
root@laura:/home/anthony# ip link set tap0 up
root@laura:/home/anthony# brctl addif br0 tap0

Until here everything continues to work normally. Finally, I try to add eth0 to the bridge:

root@laura:/home/anthony# brctl addif br0 eth0

At this point, I no longer have a network connection. If I try to ping something, it tells "Destination Host Unreachable". The output of ip addr show seems normal:

root@laura:/home/anthony# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 8c:73:6e:db:1c:1b brd ff:ff:ff:ff:ff:ff
    inet 147.102.160.153/24 brd 147.102.160.255 scope global eth0
    inet6 2001:648:2000:a0:8e73:6eff:fedb:1c1b/64 scope global dynamic 
       valid_lft 2591908sec preferred_lft 604708sec
    inet6 fe80::8e73:6eff:fedb:1c1b/64 scope link 
       valid_lft forever preferred_lft forever
[snip wlan0, vboxnet0 and pan0, which are down and irrelevant]
8: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 16:30:f2:67:ab:75 brd ff:ff:ff:ff:ff:ff
9: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
    link/ether 16:30:f2:67:ab:75 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::1430:f2ff:fe67:ab75/64 scope link
       valid_lft forever preferred_lft forever

Also:

root@laura:/home/anthony# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
147.102.160.0   0.0.0.0         255.255.255.0   U     1      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
0.0.0.0         147.102.160.200 0.0.0.0         UG    0      0        0 eth0

I can't understand what I'm doing wrong. I want the machine to continue to listen on 147.102.160.153 on eth0, and in addition to that I want to have a tap0 interface, bridged to eth0, that will be available to the guest machine so that the latter listens on another ip address (say 147.102.160.205). (If there's another way to achieve what I want, I'm also interested.)

share|improve this question
1  
Did you try to configure br0 with an IP address and gateway after you bribged eth0? And what brctl show gives you after that? –  forcefsck Nov 29 '12 at 12:56

1 Answer 1

On Linux, one can but shouldn't assign IP addresses to interfaces before adding them to a bridge, but rather one assigns them to the bridge interface.

  1. Add the interfaces to the bridge.
  2. Add the address to the bridge.
  3. Set the bridge all bridge ports up.

By the way, route comes from the net-tools package, which is deprecated. Use ip route (or just the shorthand ip r) instead.

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.