最常用的linux bond + ovs 桥
配网络前安装 kvm openvswitch
sudo yum install -y yum-plugin-priorities
yum install -y libvirt-client libvirt-daemon qemu-kvm libvirt-daemon-driver-qemu libvirt-daemon-kvm virt-install bridge-utils rsync libguestfs-tools-c
sudo yum install -y openvswitch sudo systemctl enable openvswitch sudo systemctl start openvswitch
[root@host network-scripts]# cat ifcfg-em1
DEVICE=em1
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MTU=1500
MASTER=bond1
SLAVE=yes
[root@host network-scripts]# cat ifcfg-em2
DEVICE=em2
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MTU=1500
MASTER=bond1
SLAVE=yes
[root@host network-scripts]# cat ifcfg-em3
DEVICE=em3
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
PEERDNS=no
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=ovs-external
BOOTPROTO=none
[root@hostnetwork-scripts]# cat ifcfg-em4
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em4
UUID=331728c8-9ae6-44a0-8d7f-5c7378a186b1
DEVICE=em4
ONBOOT=no
[root@host network-scripts]# cat ifcfg-bond1
DEVICE=bond1
ONBOOT=yes
TYPE=OVSPort
OVS_BRIDGE=ovs-pxe
DEVICETYPE=ovs
BOOTPROTO=none
BONDING_OPTS="miimon=100 mode=802.3ad"
MTU=1500
MASTER=yes
#IPADDR=10.0.66.19
#NETMASK=255.255.255.0
[root@seed network-scripts]# cat ifcfg-
ifcfg-bond1 ifcfg-em1 ifcfg-em2 ifcfg-em3 ifcfg-em4 ifcfg-lo ifcfg-ovs-external ifcfg-ovs-pxe
[root@host network-scripts]# cat ifcfg-ovs-external
DEVICE=ovs-external
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
PEERDNS=no
DEVICETYPE=ovs
TYPE=OVSBridge
MTU=1500
BOOTPROTO=static
IPADDR=10.0.66.19
NETMASK=255.255.255.0
GATEWAY=10.0.66.1
[root@host network-scripts]# cat ifcfg-ovs-pxe
DEVICE=ovs-pxe
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
PEERDNS=no
DEVICETYPE=ovs
TYPE=OVSBridge
MTU=1500
BOOTPROTO=static
IPADDR=10.0.60.19
NETMASK=255.255.255.0
[root@host ~]# cat ovs-external.xml
<network>
<name>ovs-external</name>
<forward mode='bridge'/>
<bridge name='ovs-external'/>
<virtualport type='openvswitch'/>
</network>
[root@host ~]# cat ovs-pxe.xml
<network>
<name>ovs-pxe</name>
<forward mode='bridge'/>
<bridge name='ovs-pxe'/>
<virtualport type='openvswitch'/>
</network>