网络拓扑
h1 -- eth1- s3 -eth2 -- eth1- s4 -eth2 -- h2
h1-eth0<->s3-eth1 (OK OK) dot1q-tunnel tag=100
s3-eth2<->s4-eth1 (OK OK) trunk=100 trunk=100
s4-eth2<->h2-eth0 (OK OK) dot1q-tunnel tag=100
dpctl add-flow action=normal
ovs-vsctl set port s3-eth2 VLAN_mode=trunk
ovs-vsctl set port s3-eth2 trunk=100
ovs-vsctl set port s4-eth1 VLAN_mode=trunk
ovs-vsctl set port s4-eth1 trunk=100
ovs-vsctl set port s3-eth1 vlan_mode=dot1q-tunnel tag=100
ovs-vsctl set port s4-eth2 vlan_mode=dot1q-tunnel tag=100
ovs-vsctl add-port <bridge name> <port name>
ovs-vsctl set interface <port name> type=patch
ovs-vsctl set interface <port name> options:peer=<peer name>
vlan创建:
ip link add link h1-eth0 name eth0.5 type vlan id 5
ip -d link show eth0.5
ip addr add 10.0.0.5/24 dev eth0.5
ip link set dev eth0.5 up
ip link add link h2-eth0 name eth0.5 type vlan id 5
ip -d link show eth0.5
ip addr add 10.0.0.6/24 dev eth0.5
ip link set dev eth0.5 up
vconfig add eth0 5
ip addr add 10.0.0.5/24 dev eth0.5
ifconfig eth0.5 down
vconfig rem eth0.5
wireshark抓包:
Frame 39: 106 bytes on wire (848 bits), 106 bytes captured (848 bits) on interface s3-eth2, id 0
Ethernet II, Src: 6e:09:21:b9:aa:dd (6e:09:21:b9:aa:dd), Dst: 3a:8f:88:ae:4a:10 (3a:8f:88:ae:4a:10)
IEEE 802.1ad, ID: 100
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 5
Internet Protocol Version 4, Src: 10.0.0.2, Dst: 10.0.0.5
Internet Control Message Protocol