IT/linux

creating bond devices on CentOS7, Redhat7

울티마 2022. 6. 10. 15:08

출처 : http://pathcre8or.tistory.com/13

1. checking device status and cleaning target d
(디바이스 확인 및 대상 디바이스 정보 삭제)

[root@centos7Test ~]# nmcli dev
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
ens224 ethernet connected Wired connection 1
ens192 ethernet disconnected —
lo loopback unmanaged —[root@centos7Test ~]# nmcli con
NAME UUID TYPE DEVICE
Wired connection 1 cf0ce2df-1055–4083-b970-ed5444f2ca17 802–3-ethernet ens224
ens192 95589cf4–9a4d-4194-a36d-5b4c5fa81d73 802–3-ethernet —
ens160 78d1cffd-192c-47e0–8c5e-399d8940301a 802–3-ethernet ens160

[root@centos7Test ~]# nmcli con del “Wired connection 1”
Connection ‘Wired connection 1’ (cf0ce2df-1055–4083-b970-ed5444f2ca17) successfully deleted.

[root@centos7Test ~]# nmcli con del ens192
Connection ‘ens192’ (95589cf4–9a4d-4194-a36d-5b4c5fa81d73) successfully deleted.

[root@centos7Test ~]# nmcli con
NAME UUID TYPE DEVICE
ens160 78d1cffd-192c-47e0–8c5e-399d8940301a 802–3-ethernet ens160


2. create and configure bond devices (본딩 디바이스 생성 및 구성)
- add new bond device : active-backup (디바이스 생성 : 기본 active-backup 모드)

[root@centos7Test ~]# nmcli con add type bond con-name bond0 ifname bond0 mode active-backup
Connection ‘bond0’ (1d28e459–3cdf-40a3-bd18-b1c9e32da1e9) successfully added.

- ip, gateway
[root@centos7Test ~]# nmcli con mod bond0 ipv4.address 192.168.1.92/24
[root@centos7Test ~]# nmcli con mod bond0 ipv4.gateway 192.168.0.254
[root@centos7Test ~]# nmcli con mod bond0 ipv4.method manual
[root@centos7Test ~]# nmcli con show bond0
connection.id: bond0
connection.uuid: 1d28e459–3cdf-40a3-bd18-b1c9e32da1e9
connection.interface-name: bond0
connection.type: bond
ipv4.addresses: 192.168.1.92/24
ipv4.gateway: 192.168.0.254
bond.options: mode=active-backup
GENERAL.NAME: bond0
GENERAL.UUID: 1d28e459–3cdf-40a3-bd18-b1c9e32da1e9
GENERAL.DEVICES: bond0

- adding member devices
[root@centos7Test ~]# nmcli con add type bond-slave con-name bond0-eth0 ifname ens192 master bond0
Connection ‘bond0-eth0’ (acb97933–7e47–45b1-a07f-f3d3b39b8fc6) successfully added.

[root@centos7Test ~]# nmcli con add type bond-slave con-name bond0-eth1 ifname ens224 master bond0
Connection ‘bond0-eth1’ (9e552534–6c3c-4290-b26c-77aa5c789f65) successfully added.


3. device up and checking status (디바이스 가동 및 확인)

[root@centos7Test ~]# nmcli con up bond0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)

[root@centos7Test ~]# nmcli con
NAME UUID TYPE DEVICE
ens160 78d1cffd-192c-47e0–8c5e-399d8940301a 802–3-ethernet ens160
bond0-eth1 9e552534–6c3c-4290-b26c-77aa5c789f65 802–3-ethernet ens224
bond0-eth0 acb97933–7e47–45b1-a07f-f3d3b39b8fc6 802–3-ethernet ens192
bond0 1d28e459–3cdf-40a3-bd18-b1c9qe32da1e9 bond bond0

[root@centos7Test ~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000
link/ether 00:50:56:ad:44:53 brd ff:ff:ff:ff:ff:ff
3: ens192: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:50:56:ad:30:ef brd ff:ff:ff:ff:ff:ff
4: ens224: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:50:56:ad:30:ef brd ff:ff:ff:ff:ff:ff
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 00:50:56:ad:30:ef brd ff:ff:ff:ff:ff:ff

[root@centos7Test ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens192
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens192
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:ad:30:ef
Slave queue ID: 0
Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:ad:72:56
Slave queue ID: 0