使用Mininet WiFi在车站创建桥梁

时间:2018-06-05 13:57:52

标签: linux networking mininet

我正在研究以下情况:

enter image description here

场景的python代码如下:

#!/usr/bin/python



from mininet.node import RemoteController, OVSKernelSwitch
from mininet.log import setLogLevel, info
from mininet.wifi.node import OVSKernelAP
from mininet.wifi.cli import CLI_wifi
from mininet.wifi.net import Mininet_wifi
from mininet.link import TCLink


def topology():
"Create a network."
net = Mininet_wifi( controller=RemoteController, accessPoint=OVSKernelAP, link=TCLink)

info("*** Creating nodes\n")
h1 = net.addHost('h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8')
h2 = net.addHost('h2', mac='00:00:00:00:00:02', ip='10.0.0.2/8')

sta1 = net.addStation('sta1', mac='00:00:00:00:00:03', ip='10.0.0.3/8', position='5,25,0', range =30)
sta2 = net.addStation('sta2', mac='00:00:00:00:00:04', ip='10.0.0.4/8',position='75,25,0', range=30)

s1 = net.addSwitch( 's1', dpid= "0000000000000001" )
ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', position='85,19,0', dpid= "0000000000000002", range=30) 

c1 = net.addController( 'c1', controller=RemoteController) 


print "*** Configuring Propagation Model"
net.propagationModel(model="logDistance", exp=5)



print "*** Configuring WiFi Nodes"
net.configureWifiNodes()

h1.plot(position='65,63,0')
h2.plot(position='95,10,0')
s1.plot(position='50,45,0')
c1.plot(position='50,80,0') 

print "*** Creating links"
net.addLink(ap1, h2)
net.addLink(ap1, sta2)
net.addLink(h1,s1)
net.addLink(sta1,s1)
net.addLink(sta2, s1)


""" plotting graph """
net.plotGraph(max_x=100, max_y=100)


print "*** Starting network"
net.build()
c1.start()
s1.start( [c1] )


sta1.setIP('10.0.0.5/8', intf="sta1-eth1")
sta1.setMAC('00:00:00:00:00:05', intf="sta1-eth1")
sta2.setIP('10.0.0.6/8', intf="sta2-eth1")
sta2.setMAC('00:00:00:00:00:06', intf="sta2-eth1")

ap1.start( [c1] )

print "*** Running CLI"
CLI_wifi( net )

print "*** Stopping network"
net.stop()

if __name__ == '__main__':
setLogLevel( 'info' )
topology()

问题是,例如,如果我尝试从h2 ping h1,则ARP请求由h2发送,然后转到ap1,然后在sta2的wlan接口上接收,但这里sta2无法转发这些ARP请求在其eth接口上。 我试图以不同的方式解决问题:

  • 我在sta2的wlan和eth接口之间构建了一个桥接器,但是sta2在其wlan接口上没有收到任何东西;

  • 我创建了一个veth接口,我已经与eth和wa sta2桥接了。它也不起作用;

  • 我已经用tc应用了qdisc规则,并且这些sta2能够通过eth转发ARP请求,但是ap1没有收到它发送的回复

这似乎是个烂摊子。我无法摆脱这个问题。

任何人都可以提出解决方案吗? 谢谢

0 个答案:

没有答案