最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網 會員登陸 & 注冊

Centos7多網卡綁定bond快速實踐

2022-04-10 17:56 作者:王忘杰-王土狗  | 我要投稿


圖片

一、準備環(huán)境
VMware軟件、Centos7虛擬機

二、添加網卡
為虛擬機再添加兩塊網卡,查看網卡信息,可以看到有ens32ens34、ens35三塊網卡
ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
? ?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: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
? ?link/ether 00:0c:29:54:02:06 brd ff:ff:ff:ff:ff:ff
? ?inet 192.168.30.142/24 brd 192.168.30.255 scope global noprefixroute dynamic ens32
? ? ? valid_lft 1615sec preferred_lft 1615sec
? ?inet6 fe80::d089:c15:e69a:8ce4/64 scope link noprefixroute
? ? ? valid_lft forever preferred_lft forever
3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
? ?link/ether 00:0c:29:54:02:1a brd ff:ff:ff:ff:ff:ff
? ?inet 192.168.30.143/24 brd 192.168.30.255 scope global noprefixroute dynamic ens34
? ? ? valid_lft 1765sec preferred_lft 1765sec
? ?inet6 fe80::a4af:b843:9032:9dd3/64 scope link noprefixroute
? ? ? valid_lft forever preferred_lft forever
4: ens35: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
? ?link/ether 00:0c:29:54:02:10 brd ff:ff:ff:ff:ff:ff
? ?inet 192.168.30.141/24 brd 192.168.30.255 scope global noprefixroute dynamic ens35
? ? ? valid_lft 1765sec preferred_lft 1765sec
? ?inet6 fe80::b7cf:76d7:23aa:63c2/64 scope link noprefixroute
? ? ? valid_lft forever preferred_lft forever

查看網卡配置文件,可以看到添加網卡后,并沒有生成對應的網卡文件
ls /etc/sysconfig/network-scripts/ifcfg*

/etc/sysconfig/network-scripts/ifcfg-ens32 ?/etc/sysconfig/network-scripts/ifcfg-lo

可以為網卡生成配置文件,但在本文中不需要這樣做

nmcli connection add type ethernet con-name ens34 ifname ens34 autoconnect yes
nmcli connection add type ethernet con-name ens35 ifname ens35 autoconnect yes

再次查看網卡配置文件,生成成功
ls /etc/sysconfig/network-scripts/ifcfg*

/etc/sysconfig/network-scripts/ifcfg-ens32 ?/etc/sysconfig/network-scripts/ifcfg-ens35
/etc/sysconfig/network-scripts/ifcfg-ens34 ?/etc/sysconfig/network-scripts/ifcfg-lo

三,選定網卡綁定模式
多網卡一共有7種bond模式,這里直接選用mode=6 (balance-alb) Adaptive load balancing(適配器適應性負載均衡),該模式不需要交換機支持

四、開始配置
1、加載bonding模塊,并設置開機啟動

[root@localhost ~]# lsmod | grep bonding
[root@localhost ~]# modprobe bonding
[root@localhost ~]# lsmod | grep bonding
bonding ? ? ? ? ? ? ? 152979 ?0

啟用rc.local開機啟動項
chmod +x /etc/rc.d/rc.local
在文件中寫入modprobe bonding

2、建立bond網口配置文件并進行配置
/etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
IPADDR=192.168.30.250
PREFIX=255.255.255.0
GATEWAY=192.168.30.2
DNS1=114.114.114.114
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS="mode=6 ?miimon=100"

3、修改三塊網卡的配置
vi /etc/sysconfig/network-scripts/ifcfg-ens32

DEVICE=ens32
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
MASTER=bond0
SLAVE=yes

vi /etc/sysconfig/network-scripts/ifcfg-ens34

DEVICE=ens34
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
MASTER=bond0
SLAVE=yes

vi /etc/sysconfig/network-scripts/ifcfg-ens35

DEVICE=ens35
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
MASTER=bond0
SLAVE=yes

4、重新加載網絡配置
注意:這一步會斷網!

nmcli connection reload && systemctl restart network.service

使用新IP鏈接ssh

五、驗證綁定是否生效
cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: ens32
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: ens32
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:54:02:06
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:54:02:1a
Slave queue ID: 0

Slave Interface: ens35
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:54:02:10
Slave queue ID: 0

查看網卡狀態(tài)
ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
? ?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: ens32: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
? ?link/ether 00:0c:29:54:02:06 brd ff:ff:ff:ff:ff:ff
3: ens34: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
? ?link/ether 00:0c:29:54:02:1a brd ff:ff:ff:ff:ff:ff
4: ens35: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
? ?link/ether 00:0c:29:54:02:10 brd ff:ff:ff:ff:ff:ff
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
? ?link/ether 00:0c:29:54:02:06 brd ff:ff:ff:ff:ff:ff
? ?inet 192.168.30.250/24 brd 192.168.30.255 scope global bond0
? ? ? valid_lft forever preferred_lft forever
? ?inet6 fe80::20c:29ff:fe54:206/64 scope link
? ? ? valid_lft forever preferred_lft forever

查看接口帶寬,帶寬為3G
ethtool bond0

Settings for bond0:
? ? ? ?Supported ports: [ ]
? ? ? ?Supported link modes: ? Not reported
? ? ? ?Supported pause frame use: No
? ? ? ?Supports auto-negotiation: No
? ? ? ?Supported FEC modes: Not reported
? ? ? ?Advertised link modes: ?Not reported
? ? ? ?Advertised pause frame use: No
? ? ? ?Advertised auto-negotiation: No
? ? ? ?Advertised FEC modes: Not reported
? ? ? ?Speed: 3000Mb/s
? ? ? ?Duplex: Full
? ? ? ?Port: Other
? ? ? ?PHYAD: 0
? ? ? ?Transceiver: internal
? ? ? ?Auto-negotiation: off
? ? ? ?Link detected: yes

連續(xù)ping測試,并禁用第一個網卡,此時會丟一個包,網絡依然正常運行

來自 192.168.30.250 的回復: 字節(jié)=32 時間<1ms TTL=64
來自 192.168.30.250 的回復: 字節(jié)=32 時間<1ms TTL=64
來自 192.168.30.250 的回復: 字節(jié)=32 時間=1ms TTL=64
請求超時。
來自 192.168.30.250 的回復: 字節(jié)=32 時間=1ms TTL=64
來自 192.168.30.250 的回復: 字節(jié)=32 時間<1ms TTL=64

完畢!


Centos7多網卡綁定bond快速實踐的評論 (共 條)

分享到微博請遵守國家法律
黄浦区| 澄江县| 会泽县| 昭苏县| 会东县| 普定县| 健康| 南华县| 龙陵县| 阆中市| 佛冈县| 溧水县| 金乡县| 田东县| 伊宁市| 准格尔旗| 禹州市| 朝阳县| 塘沽区| 祁连县| 分宜县| 惠水县| 玉龙| 浦县| 呼玛县| 响水县| 抚州市| 万载县| 积石山| 南和县| 宾川县| 鄱阳县| 山西省| 黑龙江省| 阿尔山市| 仙居县| 中方县| 盘锦市| 东乡族自治县| 监利县| 大港区|