双网卡配置 bond mode4 配置
1 # cat /etc/redhat-release 2 CentOS Linux release 7.6.1810 (Core)
yum search ifconfig yum install net-tools.x86_64
- 查看网线是否插入
# cat /sys/class/net/ens3f0/carrier 1 # cat /sys/class/net/ens3f1/carrier 1
- 关闭 NetworkManager 服务
//网卡文件配置正常、bond0文件配置也正常;重启网络服务之后,bond0起来了,ping自己IP通,但是到网关不通,就是因为NetworkManager服务没有关闭,关闭之后重启网络服务,网络就通了。
1 systemctl status NetworkManager.service 2 systemctl stop NetworkManager.service 3 systemctl disable NetworkManager.service
- 内核加载 bonding
1 modprobe --first-time bonding
1 # lsmod | grep bonding 2 bonding 152656 0
创建配置文件 ifcfg-bond0
1 vim /etc/sysconfig/network-scripts/ifcfg-bond0
1 DEVICE=bond0 2 TYPE=Bond 3 IPADDR=192.168.2.11 4 NETMASK=255.255.255.0 5 GATEWAY=192.168.2.1 6 DNS1=114.114.114.114 7 USERCTL=no 8 BOOTPROTO=none 9 ONBOOT=yes 10 BONDING_MASTER=yes 11 BONDING_OPTS="miimon=100 mode=4 xmit_hash_policy=layer3+4"
如果bond0接口已经配置,不再需要配置
1 vim /etc/modprobe.d/bond.conf 2 alias bond0 bonding 3 options bond0 miimon=100 mode=4 xmit_hash_policy=layer3+4
备份网卡配置文件
1 cd /etc/sysconfig/network-scripts 2 cp ifcfg-ens3f0 ifcfg-ens3f0_backup 3 cp ifcfg-ens3f1 ifcfg-ens3f1_backup
ens3f0
1 vim /etc/sysconfig/network-scripts/ifcfg-ens3f0
1 TYPE=Ethernet 2 PROXY_METHOD=none 3 BROWSER_ONLY=no 4 BOOTPROTO=none 5 DEFROUTE=yes 6 IPV4_FAILURE_FATAL=no 7 IPV6INIT=yes 8 IPV6_AUTOCONF=yes 9 IPV6_DEFROUTE=yes 10 IPV6_FAILURE_FATAL=no 11 IPV6_ADDR_GEN_MODE=stable-privacy 12 NAME=ens3f0 13 UUID=39aa32a1-acb3-4cd3-a806-be5c041a2310 14 DEVICE=ens3f0 15 ONBOOT=yes 16 MASTER=bond0 17 SLAVE=yes
ens3f1
1 vim /etc/sysconfig/network-scripts/ifcfg-ens3f1
1 TYPE=Ethernet 2 #PROXY_METHOD=none 3 #BROWSER_ONLY=no 4 BOOTPROTO=none 5 #DEFROUTE=yes 6 #IPV4_FAILURE_FATAL=no 7 #IPV6INIT=yes 8 #IPV6_AUTOCONF=yes 9 #IPV6_DEFROUTE=yes 10 #IPV6_FAILURE_FATAL=no 11 #IPV6_ADDR_GEN_MODE=stable-privacy 12 NAME=ens3f1 13 #UUID=4b5c8908-3e83-40b2-a9db-d0713135f4c2 14 DEVICE=ens3f1 15 ONBOOT=yes 16 MASTER=bond0 17 SLAVE=yes
注释掉的行可以不用写
- 重启网络服务
1 systemctl restart network
1 # ifconfig 2 bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500 3 inet 192.168.2.11 netmask 255.255.255.0 broadcast 192.168.2.255
查看bond0信息
1 cat /proc/net/bonding/bond0
1 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) 2 3 Bonding Mode: IEEE 802.3ad Dynamic link aggregation 4 Transmit Hash Policy: layer3+4 (1) 5 MII Status: up 6 MII Polling Interval (ms): 100 7 Up Delay (ms): 0 8 Down Delay (ms): 0 9 10 802.3ad info 11 LACP rate: slow 12 Min links: 0 13 Aggregator selection policy (ad_select): stable 14 System priority: 65535 15 System MAC address: bc:16:95:07:97:b0 16 Active Aggregator Info: 17 Aggregator ID: 1 18 Number of ports: 1 19 Actor Key: 15 20 Partner Key: 1 21 Partner Mac Address: 00:00:00:00:00:00 22 23 Slave Interface: ens3f0 24 MII Status: up 25 Speed: 10000 Mbps 26 Duplex: full 27 Link Failure Count: 1 28 Permanent HW addr: bc:16:95:07:97:b0 29 Slave queue ID: 0 30 Aggregator ID: 1 31 Actor Churn State: none 32 Partner Churn State: churned 33 Actor Churned Count: 0 34 Partner Churned Count: 1 35 details actor lacp pdu: 36 system priority: 65535 37 system mac address: bc:16:95:07:97:b0 38 port key: 15 39 port priority: 255 40 port number: 1 41 port state: 77 42 details partner lacp pdu: 43 system priority: 65535 44 system mac address: 00:00:00:00:00:00 45 oper key: 1 46 port priority: 255 47 port number: 1 48 port state: 1 49 50 Slave Interface: ens3f1 51 MII Status: up 52 Speed: 10000 Mbps 53 Duplex: full 54 Link Failure Count: 1 55 Permanent HW addr: bc:16:95:07:97:b1 56 Slave queue ID: 0 57 Aggregator ID: 2 58 Actor Churn State: churned 59 Partner Churn State: churned 60 Actor Churned Count: 1 61 Partner Churned Count: 1 62 details actor lacp pdu: 63 system priority: 65535 64 system mac address: bc:16:95:07:97:b0 65 port key: 15 66 port priority: 255 67 port number: 2 68 port state: 69 69 details partner lacp pdu: 70 system priority: 65535 71 system mac address: 00:00:00:00:00:00 72 oper key: 1 73 port priority: 255 74 port number: 1 75 port state: 1
查看bond0 速率
1 ethtool bond0
1 Settings for bond0: 2 Supported ports: [ ] 3 Supported link modes: Not reported 4 Supported pause frame use: No 5 Supports auto-negotiation: No 6 Supported FEC modes: Not reported 7 Advertised link modes: Not reported 8 Advertised pause frame use: No 9 Advertised auto-negotiation: No 10 Advertised FEC modes: Not reported 11 Speed: 10000Mb/s 12 Duplex: Full 13 Port: Other 14 PHYAD: 0 15 Transceiver: internal 16 Auto-negotiation: off 17 Link detected: yes
转载自:https://blog.csdn.net/u010953692/article/details/118726290
标签:mode4,bond0,CentOS,16,00,priority,7.6,yes,port From: https://www.cnblogs.com/dier-gaohe/p/16971772.html