配置mode=0,平衡負載模式,須要配置與網卡相連的交換機採起聚合模式。html
配置mode=1,主備模式,無需配置交換機linux
配置 mode=6,平衡負載模式,可是沒必要配置交換機。ide
# modprobe --first-time bondingui
# modinfo bondingspa
# systemctl stop NetworkManagerrest
# systemctl disable NetworkManagerhtm
# cd /etc/sysconfig/network-scripts/blog
# cat ifcfg-ens33ip
DEVICE=ens33文檔
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
# cat ifcfg-ens37
DEVICE=ens37
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
# cat ifcfg-bond0
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
IPADDR=192.168.7.17
PREFIX=24
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS="mode=balance-rr miimon=100"
GATEWAY=192.168.7.1
DNS1=192.168.17.1
DNS2=192.168.17.3
# systemctl restart network
查看bond狀況:
參考文檔:
https://www.kernel.org/doc/Documentation/networking/bonding.txt.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-using_channel_bonding
# modprobe --first-time bridge
# modinfo bridge
# yum -y install bridge-utils
# cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BONDING_OPTS="mode=balance-rr miimon=100"
BRIDGE=brbond0
# cat ifcfg-brbond0
DEVICE=brbond0
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.7.17
PREFIX=24
GATEWAY=192.168.7.1
DNS1=192.168.17.1
DNS2=192.168.17.3
參考文檔:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-network_bridging_using_the_command_line_interface
交換機上的端口必須設置成trunk模式
# modprobe --first-time 8021q
# modinfo 8021q
方法:
重啓網卡:systemctl restart network