Linux RHEL 7.9网卡配置bond0(主备模式)
一、实验环境准备及规划
系统:RHEL 7.9
网卡bond0(主备模式):
ens33
ens37
bond0:192.168.100.40
vmware虚拟机网卡:仅主机模式
二、方法1(nmcli命令行配置)操作步骤
[root@localhost network-scripts]
连接 "bond0" (b64b136c-e2d4-4d79-98d6-7022e2a9bc0e) 已成功添加。
[root@localhost network-scripts]
连接 "bond0-1" (708b9336-d09d-47ab-baaf-f15c93fd5dc7) 已成功添加。
[root@localhost network-scripts]
连接 "bond0-2" (f0204cc0-2be3-4f23-a88f-593bf0cf1280) 已成功添加。
[root@localhost network-scripts]
[root@localhost network-scripts]
连接已成功激活(master waiting for slaves)(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/19)
[root@localhost network-scripts]
[root@localhost network-scripts]
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.100.40 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::c9c9:48ca:d7ab:190b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:78:3a:f1 txqueuelen 1000 (Ethernet)
RX packets 4 bytes 240 (240.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 40 bytes 5057 (4.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:0c:29:78:3a:f1 txqueuelen 1000 (Ethernet)
RX packets 16 bytes 3104 (3.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 162 bytes 18332 (17.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens37: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:0c:29:78:3a:f1 txqueuelen 1000 (Ethernet)
RX packets 14 bytes 903 (903.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 86 bytes 8666 (8.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 220 bytes 18764 (18.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 220 bytes 18764 (18.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:84:25:5a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost network-scripts]
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens33
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens33
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:78:3a:f1
Slave queue ID: 0
Slave Interface: ens37
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:78:3a:fb
Slave queue ID: 0
三、方法2(nmtui图形页面配置)操作步骤
1、在命令行终端使用nmtui命令,进入nmtui页面
2、添加bond组,如图所示
3、配置bond信息,如图所示
4、选择add时,在bond0设备中添加网卡时,需分别添加ens33和ens37,具体配置如下
5、添加完成后,在网卡页面会新增一个bond类型的网卡,如图所示
6、重启激活bond0网卡
7、登陆终端验证bond0网卡是否生效
[root@localhost ~]
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens33
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens33
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:78:3a:f1
Slave queue ID: 0
Slave Interface: ens37
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:78:3a:fb
Slave queue ID: 0
[root@localhost ~]
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.100.40 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::10d:90b:59bb:a41f prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:78:3a:f1 txqueuelen 1000 (Ethernet)
RX packets 102 bytes 11808 (11.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 110 bytes 23827 (23.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:0c:29:78:3a:f1 txqueuelen 1000 (Ethernet)
RX packets 9911 bytes 933898 (912.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4312 bytes 1347298 (1.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens37: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:0c:29:78:3a:f1 txqueuelen 1000 (Ethernet)
RX packets 2600 bytes 237471 (231.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 115 bytes 12729 (12.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 430 bytes 36710 (35.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 430 bytes 36710 (35.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:84:25:5a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|