intrig-unicamp / mininet-wifi

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

AP changes MACs automatically in runtime - association not possible #306

Closed asljivo1 closed 4 years ago

asljivo1 commented 4 years ago

Hello,

I run a simple script (below) and monitor ap1-wlan1 in wireshark. When I start the experiment, AP has some MAC addres, stations are associated to it, iwconfig on station side shows AP's data correctly, stations can reach eachother. After a while (10 minutes or so), wireshark shows a pop-up that the monitoring interface is down and I cannot monitor anymore. iw dev sta1-wlan0 link still shows that sta1 is associated to the AP on the same initial MAC address, but MAC address on the AP has changed (I did not change it, it just happend, and it happens every time I run it). iw dev sta1-wlan0 scan sometimes shows the AP, but shows the old MAC and not the new one, so sta1 cannot associate to the AP after this point.

Why does this happen and how do I get a stable, testable network? I tried to specify MAC of AP in python script but it does not show in the network. I use mininet VM (simple one without ONOS) available on your github, I have pulled the latest changes from the master branch.

Thank you in advance!

This is the script I run (in the examples directory):

#!/usr/bin/python

from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mn_wifi.link import adhoc

def topology():
    "Create a network."
    net = Mininet_wifi()

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', position='10,10,0')
    sta2 = net.addStation('sta2', position='30,10,0')

    ap1 = net.addAccessPoint('ap1',position='20,10,0', ssid='myssid', mode='g', channel='5', failMode="standalone", range=60)
    c1 = net.addController('c1')

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()    

    info("*** Starting network\n")
    net.build()
    ap1.start([c1])

    info("*** Addressing...\n")
    sta1.setIP('192.168.10.1/24', intf="sta1-wlan0")
    sta2.setIP('192.168.10.2/24', intf="sta2-wlan0")

    info("*** Running CLI\n")
    CLI(net)

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

if __name__ == '__main__':
    setLogLevel('info')
    topology()
ramonfontes commented 4 years ago

Hello,

Which kernel version do you have? You may need to add wifi.scan-rand-mac-address=no in /etc/NetworkManager/NetworkManager.conf

asljivo1 commented 4 years ago

Thank you for the quick response.

My kernel version is 4.15.0-106-generic. I do not have NetworkManager.conf file in /etc/NetworkManager/, i reinstalled the network-manager package and still do not have this file. I created it manually then, and added

[device]
wifi.scan-rand-mac-address=no

and it seems like the AP does not change MAC addresses anymore, so far so good. Thank you!