intrig-unicamp / mininet-wifi

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

Why is my station is not associated with its respective accesspoint? #427

Closed Varadarajreddy closed 2 years ago

Varadarajreddy commented 2 years ago

Hi Ramonfontes,

I have added four stations and four access points but one of my stations (sta2) is not pinging. When I tested with "sta2 iwconfig" it shows the following information.

sta2-wlan0 IEEE 802.11 ESSID:"ssid-AP1"
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:on I am just wondering what is just stopping this station to connect with its access point? Could please let me know what the cause for this issue is? Please help me. Thanks.

here is my code for your reference..

#!/usr/bin/python
import sys
from mn_wifi.net import wmediumd, mesh,adhoc
from mn_wifi.net import TCLink
from mininet.node import Controller
from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI_wifi
from mn_wifi.net import Mininet_wifi
from mn_wifi.node import OVSKernelAP
def topology(plot):
    "Create a network."
    net=Mininet_wifi(controller=Controller)

    info("*** Creating nodes\n")
        #TODO add stations and  access points

    sta1 = net.addStation('sta1', mac='00:00:00:10:11:08', ip='10.10.10.1/24', position='100,40,0', range=30, min_v=5, max_v=5)
    sta2 = net.addStation('sta2', mac='00:00:00:10:11:09', ip='10.10.10.2/24', position='100,40,0', range=30, min_v=5, max_v=10)
    sta3 = net.addStation('sta3', mac='00:00:00:10:11:10', ip='10.10.10.3/24', position='100,40,0', range=30, min_v=2, max_v=7)
    TCPS = net.addStation('TCPS', mac='00:00:00:10:01:01', ip='10.10.10.10/24',position='50,160,0', range=30)

    AP1 = net.addAccessPoint('AP1', mac='00:00:20:11:10:02', model='DI524', ssid='ssid-AP1', failMode="standalone", mode='a', channel='5', position='50,50,0', range=25,datapath= 'user')
    AP2 = net.addAccessPoint('AP2', mac='00:00:20:11:10:03', model='DI524', ssid='ssid-AP2', failMode="standalone", mode='g', channel='6', position='50,100,0', range=25, datapath= 'user')
    AP3 = net.addAccessPoint('AP3', mac='00:00:20:11:10:04', model='DI524', ssid='ssid-AP3', failMode="standalone", mode='b', channel='4', position='50,150,0', range=25, datapath= 'user')
    AP4 = net.addAccessPoint('AP4', mac='00:00:20:11:10:05', model='DI524', ssid='ssid-AP4', failMode="standalone", mode='g', channel='1', position='100,150,0', range=25, datapath= 'user')

    c1=net.addController('c1')

    net.setPropagationModel(model="logDistance", exp=5)

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

    net.addLink(AP1,AP2, bw=100, cls=TCLink, delay='1ms', loss=0)
    net.addLink(AP2,AP3, bw=100, cls=TCLink, delay='5ms', loss=0)
        net.addLink(AP3,AP4, bw=100, cls=TCLink, delay='4ms', loss=5)

    net.plotGraph(max_x=600, max_y=600)

    net.startMobility(time=0)
        net.mobility(sta1,'start', time=10,  position='100,40,0')
        net.mobility(sta2,'start', time=15,  position='100,40,0')
        net.mobility(sta1,'stop',  time=20,  position='60,100,0')
        net.mobility(sta2,'stop',  time=21,  position='60,60,0')
        net.mobility(sta3,'start', time=16,  position='100,40,0')
        net.mobility(sta3,'stop',  time=22,  position='110,160,0')
        net.stopMobility(time=30)

    info("*** Starting network\n")
    net.build()
        #TODO start ap1
    c1.start()
        AP1.start([c1])
        AP2.start([c1])
        AP3.start([c1])
        AP4.start([c1])

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

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

if __name__ == '__main__':
    setLogLevel('info')
    plot = False if '-p' in sys.argv else True 
    topology(plot)
ramonfontes commented 2 years ago

Please fix your code so I can run it.

Varadarajreddy commented 2 years ago

Sorry, I did not understand what you are trying to say.

"Please fix your code so I can run it", Do you mean do you want me to make any other changes in the code or you are asking me to send you the python file? My English is not good so please bear with me.

ramonfontes commented 2 years ago

There are indentation errors in your code and please format it correctly using markdown.

ramonfontes commented 2 years ago

Why don't you simply edit your first post??? :(

Varadarajreddy commented 2 years ago

Yeah sure sir.. sorry for this mess!

Varadarajreddy commented 2 years ago

Hi Sir Could you please check it now.. I just updated my post.

ramonfontes commented 2 years ago

Please format your code in markdown!! Otherwise I will have to close this issue.

Varadarajreddy commented 2 years ago

Hi, sir Actually I am a student I am just started learning about GitHub I am not much familiar with it, However, I tried all possible ways and I did not understand how to use markdown. I apologise for not posting my query properly. Many thanks for your immediate response and time spent with my concern. I am extremely sorry for any inconvenience caused. Thanks.

ramonfontes commented 2 years ago

Have you ever tried googling "How to Format Code in Markdown"??

Varadarajreddy commented 2 years ago

Yeah sir i have tried googling then i got it know that, we have to use the back ticks(```) i tried using back ticks though, but i dont know what went wrong, i will try and correct it until then please don't close this issue sir. and now i have referred your responses to similar case in the past, from that i understood we need to turn off the network manager. I will try doing and check if that works for me..

Varadarajreddy commented 2 years ago

I think i made it correctly sir, can you please check my updated comment now!.

ramonfontes commented 2 years ago

There are indentation errors in your code!!! :(