我刚开始使用Mininet,想知道如何配置交换机(最好是在python中使用本机交换机类),以便复制连接到主机的某个端口上的所有流量,并启动Wireshark以便查看所有流量。有什么建议吗?在
这是我的配置脚本:
class MyTopo( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
leftHost = self.addHost( 'h1' )
rightHost = self.addHost( 'h2' )
idsHost = self.addHost( 'h3' )
Switch = self.addSwitch( 's1' )
# Add links
self.addLink( leftHost,Switch )
self.addLink( rightHost, Switch )
self.addLink( Switch, idsHost )
topos = { 'mytopo': ( lambda: MyTopo() ) }
以查看交换机的流量在主机(例如h1)上有Wireshark。主机需要让每个包进入交换机。您可以为该交换机编写一个RYU控制器,它在将数据包传递给适当的主机(例如h2)的同时,也将数据包传递给h1。你可以看看https://osrg.github.io/ryu-book/en/html/switching_hub.html 这是交换集线器,即传入交换机的数据包将转发到除传入接口以外的所有接口。您需要对其进行更改,以便切换到h1的接口,而不管目标主机是什么。在
相关问题 更多 >
编程相关推荐