Linux Bridge의 기본을 배우고 실험을 해봤습니다.
내 네트워크 정보는 다음과 같습니다.
:)[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
외부적으로 10.140.28.35에 ping을 보낼 수 있습니다. 그런 다음 브리지를 만들었습니다.
:)[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
그런 다음 브리지에 enp0s8 인터페이스를 추가했습니다.
:)[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
이때,더 이상 외부에서 10.140.28.35에 ping을 보낼 수 없습니다.
왜 이런 일이 발생하는지 이해하지 못합니다. 브리지에 동일한 IP 주소를 설정하자 다시 액세스할 수 있게 되었습니다.
ip a add 10.140.28.35/24 dev br0
br0에는 enp0s8과 동일한 MAC이 있음을 확인했습니다.
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
애초에 접속이 안되는 이유는 무엇이며, br0과 동일한 IP 주소를 설정해야 하는 이유는 무엇인가요?
답변1
브리지는 레이어 2 추상화이므로 연결된 인터페이스에서 레이어 3 주소 지정을 수행할 수 없습니다. 실제로 enp0s8과 br0은 동일합니다. enp0s8에서 IP를 제거하고 br0에 IP를 설정해 보세요.