KVM配置BOND,BRIDGE,VLAN

一.网卡绑定bond0

配置mode=0,平衡负载模式,需要配置与网卡相连的交换机采取聚合模式。

配置mode=1,主备模式,无需配置交换机

配置 mode=6,平衡负载模式,但是不必配置交换机。

# modprobe --first-time bonding

# modinfo bonding

# systemctl stop NetworkManager

# systemctl disable NetworkManager

 

# cd /etc/sysconfig/network-scripts/

# cat ifcfg-ens33

DEVICE=ens33

扫描二维码关注公众号,回复: 2581947 查看本文章

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

image.png                                   

# systemctl restart network

image.png

查看bond情况:

image.png

参考文档:

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

 

二.bond上桥接网卡:接上一节

# 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

image.png

参考文档:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-network_bridging_using_the_command_line_interface

三.配置VLAN

交换机上的端口必须设置成trunk模式

# modprobe --first-time 8021q

# modinfo 8021q

方法:

image.png

重启网卡:systemctl restart network


猜你喜欢

转载自blog.51cto.com/dianel/2155246
今日推荐