gpt4 book ai didi

python - Mininet 交换机端口镜像配置

转载 作者:太空宇宙 更新时间:2023-11-04 12:36:23 31 4
gpt4 key购买 nike

我是使用 Mininet 的新手,想知道如何配置 Switch(最好在 python 中使用 native Switch 类)以便复制连接到主机的特定端口上的所有流量,并启动 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() ) }

最佳答案

查看交换机在具有 Wireshark 的主机(比如 h1)上的流量。主机需要让每个数据包进入该交换机。您可以为该交换机编写一个 RYU Controller ,它在将数据包传递给适当的主机(比如 h2)的同时,还将数据包传递给 h1。你可以看看https://osrg.github.io/ryu-book/en/html/switching_hub.html这是交换式集线器,即传入交换机的数据包将被转发到传入接口(interface)以外的所有接口(interface)。您需要更改它,以便切换到 h1 的界面,而不管预期的主机。

关于python - Mininet 交换机端口镜像配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41618534/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com