intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
431 stars 239 forks source link

Dockerised stations not pinging each other through onos #432

Closed alamfaisal654 closed 2 years ago

alamfaisal654 commented 2 years ago

I made a small code where there are 4 stations - 2 stations are dockerised and 2 stations are non dockerised. Docker Stations are not able to ping each other but non-dockerised stations can ping each other. There is an AP in proximity to all the 4 stations. The controller used is ONOS on a different VM.

Code is as below:

!/usr/bin/python

import sys from mininet.log import setLogLevel, info from mininet.node import Node, Host, OVSSwitch, Controller, RemoteController from mininet.log import setLogLevel, info from containernet.cli import CLI from containernet.net import Containernet from mn_wifi.net import Mininet_wifi from containernet.node import DockerSta from containernet.node import Docker from containernet.term import makeTerm from containernet.link import TCLink from mininet.node import RemoteController from mn_wifi.node import OVSKernelAP from mn_wifi.link import wmediumd, ITSLink from mn_wifi.wmediumdConnector import interference

def topology(args): net = Containernet(controller=RemoteController, link=wmediumd, wmediumd_mode=interference, accessPoint=OVSKernelAP) c1 = net.addController('c1', controller=RemoteController, ip='192.168.56.101', port=6653 )

info("*** Creating nodes\n")
ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1',ip='10.10.10.2', protocols='OpenFlow13', datapath='user',
                         failMode="standalone", mac='00:00:00:00:00:01',
                         position='50,50,0')
attached_vm = net.addHost("Dap", mac='00:00:00:00:00:12', ip = '10.10.10.3', cls=Docker, ports=[80], dcmd='python -m http.server --bind 0.0.0.0 80', dimage="server_example:latest")

sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.10.10.4', cls=DockerSta, ports=[80], dcmd='python -m http.server --bind 0.0.0.0 80', dimage="server_example:latest", 
               position='51,50,0')

sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.10.10.6', cls=DockerSta, ports=[80], dcmd='python -m http.server --bind 0.0.0.0 80', dimage="server_example:latest", 
               position='49,50,0')

sta3 = net.addStation('sta3', mac='00:00:44:00:01:03', ip='10.10.10.9', 
               position='49,50,0')

sta4 = net.addStation('sta4', mac='00:00:00:35:00:03', ip='10.10.10.12', 
               position='49,50,0')

info("*** Configuring propagation model\n")
net.setPropagationModel(model="logDistance", exp=4.5)
info("*** Configuring wifi nodes\n")
net.configureWifiNodes()
net.addLink(ap1, attached_vm, cls=TCLink)
info("*** Creating links\n")
info("*** Starting network\n")
net.build()
c1.start()
ap1.start([c1])
net.start()
info("*** Running CLI\n")
CLI(net)

info("*** Stopping network\n")
net.stop()

if name == 'main': setLogLevel('info') topology(sys.argv)

In this topology the issue is that the dockerised containers (sta1 and sta2) are not able to ping each other . But on the other hand sta1 and sta2 can both ping Accesspoint, indicating that they both are connected to AP. Surprisingly, in the same setup, non-dockerised containers are able to ping each other and also are able to ping AP. This indicates the problem is not with the controller (Onos) Can you help me on this one ?

ramonfontes commented 2 years ago

Surprisingly, in the same setup, non-dockerised containers are able to ping each other and also are able to ping AP

Did you run the code in debug level? Are stations associated to the APs? Which troubleshooting steps did you try??

alamfaisal654 commented 2 years ago

Dockerised stations(sta1 and sta2 ) are not connected with wlan links with AP but still are able to ping the ap. On the other hand Non-dockerised stations (sta3 and sta4) are connected with wlan links with AP.
For troubleshooting I tried to see which docker network is each of the container attached. I see that dockerised stations ( sta1 and sta2) are connected with bridge network. Another docker host attached with Accesspoint directly through ethernet is also connected with bridge network. But non-dockerised containers sta3 and sta4 are not on the bridge network nor on the host network. The code was not run in debug level. I could not find how to do that ? screen BridgeNetwork

ramonfontes commented 2 years ago

Sorry, did you run the script in debug level? Can you confirm that docker image have iproute2, net-tools and ethtool?

alamfaisal654 commented 2 years ago

No, the script was not run in debug level. Initially I did not have iproute2 and ethtool. Now I added all three iproute2, net-tools and ethtool. Still dockerised stations are not able to ping each other. Can you tell me how to run it in debug level ?

ramonfontes commented 2 years ago

setLogLevel('debug')

Can stations scan for APs via iw?

alamfaisal654 commented 2 years ago

All stations (Dockerised and Non-dockerised) can scan the APs via iw. I ran with debug level. Attaching the logs. Logs.txt

Also attaching the Dockerfile for server_example image. Dockerfile_server.txt

ramonfontes commented 2 years ago

You can try stopping Network Manager

alamfaisal654 commented 2 years ago

You can try stopping Network Manager

Tried stopping using the command below but still I am not able to ping between docker stations. Non-docker stations can ping as before. sudo service network-manager stop

ramonfontes commented 2 years ago

Well, I cannot reproduce that behavior. Could you please install wireless-tools and iproute?

alamfaisal654 commented 2 years ago

Installing wireless-tools worked. Thanks a lot for the help :-)