Host inacessível depois de adicionado à ponte linux

0

Estou aprendendo o básico sobre a ponte Linux e fiz um experimento.

As minhas informações de rede são semelhantes:

:)[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

Eu posso pingar 10.140.28.35 de fora. Então eu criei uma ponte:

:)[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

Em seguida, adicionei a interface enp0s8 à ponte:

:)[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

Neste momento, não consigo mais fazer ping de 10.140.28.35 de fora.

Eu não entendo porque isso acontece. E depois que eu configurei o mesmo endereço IP para a ponte, ele se tornou acessível novamente.

ip a add 10.140.28.35/24 dev br0

Eu noto que o MAC de br0 é o mesmo que 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

Por que é inacessível no início e porque eu tenho que definir o mesmo endereço IP para br0?

    
por ruanhao 06.09.2016 / 07:20

1 resposta

1

Bridges são abstrações da camada 2, você não pode ter o endereçamento da camada 3 em interfaces que se conectam a ele, na verdade, enp0s8 e br0 são as mesmas coisas. Tente se livrar do IP em enp0s8 e defina um IP para br0.

    
por 06.09.2016 / 07:57