查看kernel是否支持网卡绑定
#查看是否支持网卡绑定 [root@localhost network-scripts]# lsmod | grep bonding #激活内核网卡绑定模块 [root@localhost network-scripts]# modprobe --first-time bonding [root@localhost network-scripts]# lsmod | grep bonding bonding 141566 0 #备份网卡配置文件 [root@localhost network-scripts]# cp ifcfg-ens* bak/ #修改ens32和ens36网卡配置文件让band0绑定接口为主,他们为从 [root@localhost network-scripts]# vim ifcfg-ens32 [root@localhost network-scripts]# cat ifcfg-ens32 TYPE=Ethernet BOOTPROTO=none NAME=ens32 DEVICE=ens32 ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED=no USERCTL=NO [root@localhost network-scripts]# vim ifcfg-ens36 [root@localhost network-scripts]# cp ifcfg-ens32 ifcfg-ens36 cp:是否覆盖"ifcfg-ens36"? y [root@localhost network-scripts]# vim ifcfg-ens36 [root@localhost network-scripts]# cat ifcfg-ens36 TYPE=Ethernet BOOTPROTO=none NAME=ens36 DEVICE=ens36 ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED=no USERCTL=NO #创建bond0绑定接口配置文件 [root@localhost network-scripts]# vim ifcfg-bond0 [root@localhost network-scripts]# cat ifcfg-bond0 DEVICE=bond0 ONBOOT=yes NM_CONTROLLED=no USERCTL=no BONDING_OPTS="mode=1 miimon=100" #mode=1是主备模式,两块从卡不同时生效 BOOTPROTO=static IPADDR=192.168.200.132 NETMASK=255.255.255.0 #重新启动网络服务 [root@localhost ~]# service network restart #查看bond0绑定接口 [root@localhost ~]# ifconfig bond0 bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500 inet 192.168.200.132 netmask 255.255.255.0 broadcast 192.168.200.255 inet6 fe80::20c:29ff:fe96:3ac5 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:96:3a:c5 txqueuelen 1000 (Ethernet) RX packets 186 bytes 16691 (16.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 122 bytes 22238 (21.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 #查看bond0详细信息 [root@localhost ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) #mode=1的模式==>主被动模式 Primary Slave: None Currently Active Slave: ens32 #当前活动中的网卡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:96:3a:c5 Slave queue ID: 0 Slave Interface: ens36 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:96:3a:cf Slave queue ID: 0测试绑定中的网卡:
我们断开ens32的网卡
我们用windows ping KVM宿主机,仍然能通
实操(2):搭建bond的KVM网桥