1.创建拓扑
拓扑代码
from mininet.topo import Topo
class MyTopo( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
host1 = self.addHost( 'h1' )
host2 = self.addHost( 'h2' )
host3 = self.addHost( 'h3' )
host4 = self.addHost( 'h4' )
host5 = self.addHost( 'h5' )
host6 = self.addHost( 'h6' )
switch1 = self.addSwitch( 's1' )
switch2 = self.addSwitch( 's2' )
# Add links
self.addLink( host1, switch1 )
self.addLink( host2, switch1 )
self.addLink( host3, switch1 )
self.addLink( host4, switch2 )
self.addLink( host5, switch2 )
self.addLink( host6, switch2 )
self.addLink( switch1,switch2 )
topos = { 'mytopo': ( lambda: MyTopo() ) }
2.利用OVS命令下发流表,实现VLAN功能
对于S1
对于S2
3.利用OVS命令查看流表
查看S1
查看S2
4.验证性测试
5.Wireshark抓包验证
抓包验证