示例:
物理节点IP:10.161.240.0/24 (vlan4440)
虚机 IP:10.161.241.0/24 (vlan4439)
1、 物理网桥
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
MASTER="bond0"
SLAVE="yes"
USERCTL="no"
# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
MASTER="bond0"
SLAVE="yes"
USERCTL="no"
# vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE="bond0"
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
USERCTL="no"
BRIDGE="iccsbr0"
BONDING_OPTS="miimon=100 mode=4"
# vim /etc/sysconfig/network-scripts/ifcfg-iccsbr0
DEVICE="iccsbr0"
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Bridge"
USERCTL="no"
IPADDR="10.161.240.41"
NETMASK="255.255.255.0"
GATEWAY="10.161.240.254"
2、 虚机vlan网桥
# vim /etc/sysconfig/network-scripts/ifcfg-bond0.4439
DEVICE=bond0.4439
PHYSDEV=bond0
ONBOOT=yes
BOOTPROTO=none
VLAN=yes
BRIDGE=iccsbr4439
# vim /etc/sysconfig/network-scripts/ifcfg-iccsbr4439
DEVICE=iccsbr4439
TYPE=Bridge
#STP=on
ONBOOT=yes
BOOTPROTO=none
上联cisco2960配置
...............
interface Port-channel1 ! 端口7和8分别连接服务器的两个网卡,其中 “switchport trunk native vlan 4440” 代表服务端过来的数据包,如果没打vlan id,则标示为vlan 4440;针对KVM服务器管理IP(10.161.240.0/24 vlan4440) “switchport mode trunk” 代表服务端过来的打了标签的vlan,全部放行;针对KVM打了标签的虚机数据包(10.161.241.0/24 vlan4439) |
3、 当虚机需走vlan4439时,在网络接入选择iccsbr4439即可
4、 当有其他vlan需求时,同上类似配置