网络高可用设计
# 网络高可用设计
# 掌握要点
(1)熟悉 bonding 的工作模式、功能、使用场景等。
(2)熟悉 bonding 模式的工作原理。
(3)熟悉各个 bonding 模式的配置方法。
# 节点规划
IP 地址 | 网卡名称 | bond 名称 |
---|---|---|
192.168.100.10 | ens33、ens34 | bond |
# 网卡做 bond0 模式
# 1.ens33 网卡配置信息
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
BOOTPROTO="none"
NAME="ens33"
DEVICE="ens33"
ONBOOT="yes"
MASTER="bond"
SLAVE="yes"
# 2.ens34 网卡配置信息
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens34
TYPE="Ethernet"
BOOTPROTO="none"
NAME="ens34"
DEVICE="ens34"
ONBOOT="yes"
MASTER="bond" SLAVE="yes"
# 3.创建 bond0 网卡配置文件
需要用到什么模式在mode中可以修改相应的数字。
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond
DEVICE=bond
TYPE=Bond
IPADDR=192.168.100.10
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=0 miimon=100"
# 4.重启网卡服务
[root@localhost ~]# systemctl restart network
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
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: ens33: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond state UP qlen 1000
link/ether 00:0c:29:5b:43:41 brd ff:ff:ff:ff:ff:ff
3: ens34: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond state UP qlen 1000
link/ether 00:0c:29:5b:43:41 brd ff:ff:ff:ff:ff:ff
5: bond: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
link/ether 00:0c:29:5b:43:41 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.10/24 brd 192.168.100.255 scope global bond
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe5b:4341/64 scope link tentative dadfailed
valid_lft forever preferred_lft forever
# 5.查看 bond 状态信息
[root@localhost ~]# cat /proc/net/bonding/bond
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (round-robin)
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:5b:43:41
Slave queue ID: 0
Slave Interface: ens34
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:5b:43:4b
Slave queue ID: 0
上次更新: 2023/11/28, 22:03:59