becool

20210713 (화) 리눅스 브릿지 본문

openstack

20210713 (화) 리눅스 브릿지

gusalstm 2021. 7. 13. 11:21
반응형

 

[root@host2 ~]# yum install -y bridge-utils

[root@host2 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.525400de717b       yes             virbr0-nic  → 현재 1개의 브릿지가 있음

[root@host2 ~]# brctl addbr demo-br  → demo-br 브릿지를 생성
[root@host2 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
demo-br         8000.000000000000       no                             → demo-br 생성 확인,if 연결없음 확인
virbr0          8000.525400de717b       yes             virbr0-nic
[root@host2 ~]# brctl addif demo-br enp0s9   → addif 로 인터페이스 추가
[root@host2 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
demo-br         8000.08002730623e       no              enp0s9  → if 연결 확인
virbr0          8000.525400de717b       yes             virbr0-nic

[root@host2 ~]# ip address add 192.168.100.1/24 dev demo-br → ip 주소 할당
[root@host2 ~]# ip a

4: enp0s9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master demo-br state UP group default qlen 1000
    link/ether 08:00:27:30:62:3e brd ff:ff:ff:ff:ff:ff
    inet 10.0.4.91/24 brd 10.0.4.255 scope global noprefixroute enp0s9
       valid_lft forever preferred_lft forever
    inet6 fe80::704:c243:e3fe:b8f4/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

7: demo-br: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 08:00:27:30:62:3e brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.1/24 scope global demo-br
       valid_lft forever preferred_lft forever

[root@host2 network-scripts]# vim ifcfg-demo-br → 런타임설정을 영구적용하기 위해 파일로 작성

[root@host2 network-scripts]# cat ifcfg-demo-br  
TYPE=Bridge
BOOTPROTO=none
NAME=demo-br
DEVICE=demo-br
ONBOOT=yes
IPADDR=192.168.100.1
PREFIX=24


[root@host2 network-scripts]# systemctl stop NetworkManager
[root@host2 network-scripts]# systemctl start network

[root@host2 network-scripts]# vim ifcfg-enp0s9

[root@host2 network-scripts]# cat ifcfg-enp0s9
DEVICE=enp0s9
ONBOOT=yes
BRIDGE=demo-br
[root@host2 network-scripts]# systemctl restart network

 

※ 네트워크 매니저 사용시

[root@host2 network-scripts]# nmcli con add type bridge con-name nm-br ifname nm-br → 브릿지 nm-br 생성
Connection 'nm-br' (bc3fbbc0-ab06-4f60-8316-a504b5a03430) successfully added.
[root@host2 network-scripts]# nmcli con mod nm-br ipv4.addresses 192.168.200.1/24 → 주소 입력

[root@host2 network-scripts]# nmcli con add type bridge-slave ifname enp0s9 con-name br-port master nm-br

  → 브릿지와 인터페이스 연결 (bridge-slave)
Warning: There is another connection with the name 'br-port'. Reference the connection by its uuid '2af367fe-250e-43fd-805c-bb7774bf7661'
Connection 'br-port' (2af367fe-250e-43fd-805c-bb7774bf7661) successfully added.

 

리눅스 브릿지

    물리적인 인터페이스 (enp0s9) 을 브릿지에 연결을 해서 내부 가상 머신들이 통신을 할 수 있도록 ip주소를 할당

    brctl 은 런타임 설정이므로 영구 설정을 원하면 /etc/sysconfig/network-scripts/ 경로에 ifcfg-demo-br 등의 파일을 생성해야한다.

   네트워크 매니저를 사용하게 되면 nmcli 명령어로 영구 설정까지 간단하게 연결이 가능하다.

  

 

728x90

'openstack' 카테고리의 다른 글

20210714 (수) cinder 실습  (0) 2021.07.14
20210713 (화) ovs 브릿지  (0) 2021.07.13
20210712 (월) 서비스 개념 설명  (0) 2021.07.12
20210709 (금) 설치 후 기초 #4  (0) 2021.07.09
20210708(목) 설치 후 기초#3  (0) 2021.07.08
Comments