1

I am learning the basics about Linux bridge, and I did an experiment.

My network info is like:

:)[00:32][root@openstack]~ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1430 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:df:9e:b2 brd ff:ff:ff:ff:ff:ff
    inet 10.140.28.35/24 brd 10.140.28.255 scope global dynamic enp0s8
       valid_lft 80937sec preferred_lft 80937sec
    inet6 2001:420:588c:1305:3c74:1500:63cd:fb4b/128 scope global dynamic
       valid_lft 1203623sec preferred_lft 598823sec
    inet6 fe80::a00:27ff:fedf:9eb2/64 scope link
       valid_lft forever preferred_lft forever

I can ping 10.140.28.35 from outside. Then I created a bridge:

:)[00:33][root@openstack]~ # brctl addbr br0; ip l set dev br0 up
:)[00:34][root@openstack]~ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1430 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:df:9e:b2 brd ff:ff:ff:ff:ff:ff
    inet 10.140.28.35/24 brd 10.140.28.255 scope global dynamic enp0s8
       valid_lft 80854sec preferred_lft 80854sec
    inet6 2001:420:588c:1305:3c74:1500:63cd:fb4b/128 scope global dynamic
       valid_lft 1203540sec preferred_lft 598740sec
    inet6 fe80::a00:27ff:fedf:9eb2/64 scope link
       valid_lft forever preferred_lft forever
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether b2:25:c0:ee:ad:d0 brd ff:ff:ff:ff:ff:ff

And then I added interface enp0s8 into the bridge:

:)[00:34][root@openstack]~ # brctl addif br0 enp0s8
:)[00:39][root@openstack]~ # brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.080027df9eb2       no              enp0s8

At this time, I can not ping 10.140.28.35 from outside any more.

I don't understand why this happen. And after I set the same ip address to the bridge, it became reachable again.

ip a add 10.140.28.35/24 dev br0

I notice that the MAC of br0 is the same as enp0s8:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1430 qdisc pfifo_fast master br0 state UP qlen 1000
    link/ether 08:00:27:df:9e:b2 brd ff:ff:ff:ff:ff:ff
    inet 10.140.28.35/24 brd 10.140.28.255 scope global dynamic enp0s8
       valid_lft 80515sec preferred_lft 80515sec
    inet6 2001:420:588c:1305:3c74:1500:63cd:fb4b/128 scope global dynamic
       valid_lft 1203201sec preferred_lft 598401sec
    inet6 fe80::a00:27ff:fedf:9eb2/64 scope link
       valid_lft forever preferred_lft forever
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1430 qdisc noqueue state UP
    link/ether 08:00:27:df:9e:b2 brd ff:ff:ff:ff:ff:ff
    inet 10.140.28.35/24 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fedf:9eb2/64 scope link
       valid_lft forever preferred_lft forever

Why it is unreachable at first and why I have to set the same ip address to br0?

2
  • 1
    Can I ask for more of an explanation? I've duplicated the original questioner's behavior of bringing down the pNIC <---> uplink connection by adding enp0s8 as an interface to br0. I've verified that the L2 addresses are the same once that's been done. However, in contrast to ruanhao's results, the connection is not restored by adding the pNIC's original IP address to the bridge. Jan 31, 2017 at 21:00
  • Same problem as @StefanJevtic, I came here after googling the error. I am trying a reboot now. Apr 7 at 10:26

1 Answer 1

2

Bridges are layer 2 abstractions, you can't have layer 3 addressing on interfaces that connect to it, actually enp0s8 and br0 are the same things. Try to get rid of the IP on enp0s8, and set an IP for br0.

2
  • Your answer is fairly good but OP already mentioned that setting the bridge IP does the trick. So to improve your answer, you should replace the fact that they should remove the IP from the interface and focus more on the fact that it is ignored once bridged. Sep 6, 2016 at 6:35
  • Thanks for you advice. I've updated the post, think this enough to understand and fix the issue. Sep 6, 2016 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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