intrig-unicamp / mininet-wifi

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

Higher RSSI does not translate to higher datarate with two overlapping APs coverage #327

Closed masad8 closed 4 years ago

masad8 commented 4 years ago

Hello,

I have created a topology with just one station being in the overlapping coverage area of two APs. The station has 2 wlans, so it is connected to both APs at the same time. However, the station is closer to one AP at a time.

Now I have two observations:

  1. When sta1 is closer to ap2 and is connected to ap2 through sta1-wlan1, it gets higher RSSI signal from ap2 than ap1. When I run iperf from sta1 to a host h2 connected to ap2, I get higher data rate than iperf to h1 connected to ap1. This is perfectly fine.

  2. When the sta1 is now closer to ap1, it shows better RSSI signal from ap1 than ap2. This is perfectly fine. But when I run iperf between sta1 and host h1 connected to ap1, it gets lower data rate than iperf to host h2 connected to ap2. This shouldn't be the case because I should get more data rate from ap1, as the rssi is higher from ap1.

Why would this be the case?

ramonfontes commented 4 years ago

What is the mode and rssi?

masad8 commented 4 years ago

I used the following Python script:

#!/usr/bin/python

import sys

from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mininet.link import Link,TCLink,Intf
from time import sleep

def topology(args):

    net = Mininet_wifi()

    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', position='50,50,0', range=50)
    ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel='6', position='90,50,0', range=50)
    h1 = net.addHost('h1',ip='10.0.0.200/24')
    h2 = net.addHost('h2',ip='11.0.0.200/24')
    c1 = net.addController('c1')
    sta1 = net.addStation('sta1', wlans=2, range=1)
    sta2 = net.addStation('sta2', wlans=2, range=1)

    info("*** Configuring propagation model\n")
    net.setPropagationModel(model="logDistance", exp=4.5)

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

    info("*** Creating links\n")
    optsforlink1  = {'bw':54, 'delay':'20ms', 'loss':0, 'use_htb':True}
    net.addLink(ap1, h1, **optsforlink1)
    net.addLink(ap2, h2, **optsforlink1)
    sta1.setIP('10.0.0.1/24', intf="sta1-wlan0")
    sta1.setIP('11.0.0.1/24', intf="sta1-wlan1")
    sta2.setIP('10.0.0.2/24', intf="sta2-wlan0")
    sta2.setIP('11.0.0.2/24', intf="sta2-wlan1")
    sta1.setPosition("45,65,0")
    sta2.setPosition("95,65,0")

    if '-p' not in args:
        net.plotGraph(max_x=140, max_y=100)

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

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

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

if __name__ == '__main__':
    setLogLevel('info')
    topology(sys.argv)

This code created the following topology:

Figure_1-2

From this topology, we see that h1/ap1 is closed to sta1, and h2/ap2 is closer to sta2. Now when I run iperf for downlink for 50 seconds, there is not much difference in downlink speeds, whereas the RSSI is significantly different:

h1/ap1 to sta1: 43.1 Mbits/sec h2/ap2 to sta1: 41.1 Mbits/sec h1/ap1 to sta2: 36.2 Mbits/sec h2/ap2 to sta2: 42.9 Mbits/sec

However, for the uplink the behavior is very strange:

sta1 to h1/ap1: 9.60 Mbits/sec sta1 to h2/ap2: 34.7 Mbits/sec sta2 to h1/ap1: 33.6 Mbits/sec sta2 to h2/ap2: 7.15 Mbits/sec

The values for uplink from sta1 to h1 and h2 is very strange, shown with bold. sta1 should have higher uplink datarate with h1 as it is connected with ap1, which is closer to sta1. However, it gets a better uplink datarate from h2/ap2.

I have tried this with multiple topologies, and more than 2 nodes. It is always the same case that nodes near ap1 have better uplink to ap2, than to ap1.

ramonfontes commented 4 years ago

First of all you have to correctly adjust the signal range. Can you confirm that 1 and 50m are suitable for that exponent with log distance? What is the tx power?

masad8 commented 4 years ago

The values and the exponent are not much important for me. What would be the default value if I don't specify any range? I just need a varying behavior in data rate with respect to the RSSI.

On Fri, Sep 11, 2020, 17:58 Ramon Fontes notifications@github.com wrote:

First of all you have to correctly adjust the signal range. Can you confirm that 1 and 50m are suitable for that exponent with log distance? What is the tx power?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/intrig-unicamp/mininet-wifi/issues/327#issuecomment-691178327, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALI53AQYZQRSB5YUTGLVC5LSFJCJZANCNFSM4RDSHR3Q .

ramonfontes commented 4 years ago

The exponent is very important for you. The signal range depends of the exponent you set. Different exponents may have different tx power. Different tx power implies different signal range. I strongly suggest you to go through the literature.

masad8 commented 4 years ago

To evaluate this, I have a few questions:

  1. For the path loss using free-space, I need to measure the path loss at d0, let's say 1 meter. Is it possible to view the received power at a node which is placed 1m apart from transmitter? If yes, then how can I see it.

  2. Secondly, why does the range of node is important? If it's important, should the range of ap and sta be the same?

ramonfontes commented 4 years ago
  1. You can basically use any wireless tools.
  2. Would you expect changes in the tx power if you change the signal range?
masad8 commented 4 years ago

For 2, my question was more tool specific. If I specify same transmit power for ap and sta (which might not be the case), then they should have the same range in the tool?

Also just an additional query, like in this code where I didnt specify any transmit power, what would be the default value?

ramonfontes commented 4 years ago

They should have the same range if they have the same frequency.

You didn't specify tx power but you have specified the range. What would you do in a physical router if you want to change the range?

masad8 commented 4 years ago

I would probably increase the transmit power.

  1. But if I take away the range as well, is there any default transmit power and range that the tool would then assume?

  2. If I then just specify transmit power without any range, would the tool consider and plot the range automatically after calculating based on the path loss model that I specified with the exponent of 4.5?

ramonfontes commented 4 years ago
  1. 14 or 20dBm. This may vary depending on the kernel version.
  2. Yes!
masad8 commented 4 years ago

I now used a code without any range and TX power on AP and the stations. When I sent iperf for 20 seconds from h1/ap1 to sta1 and sta2, and from h2/ap2 to sta1 and sta2, I get almost similar downlink rate of 45 Mbps independent of sta1 and sta2 from both hosts/access points. This is strange because the RSSI values for both interfaces is very different on both stations:

mininet-wifi> py sta1.wintfs[0].rssi
-47.0
mininet-wifi> py sta1.wintfs[1].rssi
-85.0
mininet-wifi> py sta2.wintfs[0].rssi
-85.0
mininet-wifi> py sta2.wintfs[1].rssi
-47.0

Despite different RSSI, the datarate is the same!

#!/usr/bin/python

import sys

from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mininet.link import Link,TCLink,Intf
from time import sleep

def topology(args):

    net = Mininet_wifi()

    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', position='50,50,0')
    ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel='6', position='90,50,0')
    h1 = net.addHost('h1',ip='10.0.0.200/24')
    h2 = net.addHost('h2',ip='11.0.0.200/24')
    c1 = net.addController('c1')
    sta1 = net.addStation('sta1', wlans=2)
    sta2 = net.addStation('sta2', wlans=2)

    info("*** Configuring propagation model\n")
    net.setPropagationModel(model="logDistance", exp=4.5)

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

    info("*** Creating links\n")
    optsforlink1  = {'bw':54, 'delay':'20ms', 'loss':0, 'use_htb':True}
    net.addLink(ap1, h1, **optsforlink1)
    net.addLink(ap2, h2, **optsforlink1)
    sta1.setIP('10.0.0.1/24', intf="sta1-wlan0")
    sta1.setIP('11.0.0.1/24', intf="sta1-wlan1")
    sta2.setIP('10.0.0.2/24', intf="sta2-wlan0")
    sta2.setIP('11.0.0.2/24', intf="sta2-wlan1")
    sta1.setPosition("55,50,0")
    sta2.setPosition("85,50,0")

    if '-p' not in args:
        net.plotGraph(max_x=140, max_y=100)

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

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

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

if __name__ == '__main__':
    setLogLevel('info')
    topology(sys.argv)
masad8 commented 4 years ago
  1. You can basically use any wireless tools.

Also, I can't measure the received power using

sta1 iw dev sta1-wlan0 link

It always show -36 dBm, no matter how far you are from the AP.

ramonfontes commented 4 years ago

This is the expected behavior when you are not using wmediumd, right? Still regarding the issue you may want to use ifb as well because tc doesn't handle ingress data traffic. This explains the difference on the iperf results.

masad8 commented 4 years ago

I was not familiar with wmediumd. Is it to be used with mininet wifi or separately?

masad8 commented 4 years ago

Or if you could point me to a similar example, I could have a look at it. Thanks for the great help.

ramonfontes commented 4 years ago

https://mininet-wifi.github.io/#wirelessemuation

Pls refer to /examples for wmediumd sample files.

masad8 commented 4 years ago

The following code has solved the problem by using wmediumd. I just now have one query. I want to use a normal ethernet link between ap1 and h1, and ap2 and h2, rather than a wireless link. Would using wmediumd link in Mininet_wifi model it as an ethernet link with optsforlink1? I have always used TCLink for this in normal mininet.

#!/usr/bin/python

import sys

from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mininet.link import Link,TCLink,Intf
from mn_wifi.link import wmediumd
from time import sleep
from mn_wifi.wmediumdConnector import interference

def topology(args):

    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference,
                       noise_th=-91, fading_cof=3)

    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', position='50,50,0')
    ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel='6', position='90,50,0')
    h1 = net.addHost('h1',ip='10.0.0.200/24')
    h2 = net.addHost('h2',ip='11.0.0.200/24')
    h3 = net.addHost('h3',ip='10.0.0.201/24')
    c1 = net.addController('c1')
    sta1 = net.addStation('sta1', wlans=2)
    sta2 = net.addStation('sta2', wlans=2)

    info("*** Configuring propagation model\n")
    net.setPropagationModel(model="logDistance", exp=4.5)

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

    info("*** Creating links\n")
    optsforlink1  = {'bw':54, 'delay':'20ms', 'loss':0, 'use_htb':True}
    net.addLink(ap1, h1, **optsforlink1)
    net.addLink(ap1, h3, **optsforlink1)
    net.addLink(ap2, h2, **optsforlink1)
    sta1.setIP('10.0.0.1/24', intf="sta1-wlan0")
    sta1.setIP('11.0.0.1/24', intf="sta1-wlan1")
    sta2.setIP('10.0.0.2/24', intf="sta2-wlan0")
    sta2.setIP('11.0.0.2/24', intf="sta2-wlan1")
    sta1.setPosition("55,50,0")
    sta2.setPosition("85,50,0")

    if '-p' not in args:
        net.plotGraph(max_x=140, max_y=100)

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

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

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

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

Hosts (h1, h2 and h3) do not have wireless interface. The only way to connect them to APs is through wired cable.

masad8 commented 4 years ago

And wmediumd link also emulates the ethernet connection as well, we don't need TCLink for that right?

Also, the signal level that we can see through iwconfig at wireless stations is received power, right?

On Wed, Sep 16, 2020, 01:46 Ramon Fontes notifications@github.com wrote:

Hosts (h1, h2 and h3) do not have wireless interface. The only way to connect them to APs is through wired cable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/intrig-unicamp/mininet-wifi/issues/327#issuecomment-693074964, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALI53AQVZ6WIZ7FSIGOMD33SF74EVANCNFSM4RDSHR3Q .

ramonfontes commented 4 years ago

Wired connection uses TCLink by default. Wmediumd is only used for wireless communication.

Regarding iwconfig I suggest you to go through its doc.

masad8 commented 4 years ago

Thank you, this issue is resolved.