intrig-unicamp / mininet-wifi

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

Increased Bandwidth for higher distances than 50m with 802.11g #466

Closed dohlenaugur closed 1 year ago

dohlenaugur commented 1 year ago

Hello,

I am using containernet-wifi with mininet 2.3.1b1 on Ubuntu 20.04

My setup is: sta1 <-wireless-> ap1 <-wire-> d1

net = Containernet(
        autoAssociation=True,
    )
    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint(
        'ap1',
        ssid='ap1-ssid',
        mode=g,
        channel=1,
        failMode="standalone",
        position='52,0,0',
        range='125'
    )
    sta1 = net.addStation(
        'sta1',
        mac='00:00:00:00:00:02',
        ip='10.0.0.21/24',
        position='0,0,0',
        cls=DockerSta,
        dimage='sim:full',
        range='125',
    )
    c1 = net.addController('c1')
    # host = net.addHost('h1', ip='10.0.0.81/24')
    d1 = net.addDocker('d1', ip='10.0.0.91/24', dimage="sim:full")  # host with docker attached

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=4)

    info("*** Configuring nodes\n")
    net.configureNodes()

    net.addLink(ap1, d1)  # make wired link between docker and ap

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

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

If I log into the containers and execute d1: $ iperf -s sta1: $ iperf -f k -t 5 -c 10.0.0.91

I get for 50m distance between ap and sta --> 7 Mbits/sec This value increases, the more I move sta1 to ap1.

But for 52m and further (I only tested in steps of 2m) I get ca. 1200 Mbits/sec from iperf output. I would not expect a jump here, or am I missing something? (Default range is 75m for a station, as far as I know, so it should be an acceptable range?) Network manager is off.

ramonfontes commented 1 year ago

Closing the issue because as the author said, containernet is being used here and not mininet-wifi.

Please use the correct repositories when opening issues and provide reproducibility details.

dohlenaugur commented 1 year ago

I am using containernet-wifi, but when I try the same setup with Mininet_wifi() I get similar results.

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

net = Mininet_wifi(autoAssociation=True)
info("*** Creating nodes\n")
ap1 = net.addAccessPoint(
  'ap1',
  ssid='ap1-ssid',
  mode='g',
  channel=1,
  failMode="standalone",
  position='52,0,0',
  range='75'
)
# 74 = default range
sta1 = net.addStation(
  'sta1',
  mac='00:00:00:00:00:02',
  ip='10.0.0.21/24',
  position='0,0,0',
  range='75',
)
c1 = net.addController('c1')
h1 = net.addHost('h1', ip='10.0.0.91/24')

info("*** Configuring Propagation Model\n")
net.setPropagationModel(model="logDistance", exp=4)

info("*** Configuring nodes\n")
net.configureNodes()

net.addLink(ap1, h1)  # make wired link between host and ap

info("*** Starting network\n")
net.build()
c1.start()
ap1.start([c1])
h1.cmd("iperf -s &")

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

In CLI I execute >> py sta1.cmd("iperf -f m -t 5 -c 10.0.0.91") and I get as a result: 1229 Mbits/sec But for ap1 with position "50,0,0" I get 8.07 Mbits/sec

ramonfontes commented 1 year ago

Please edit the code above to a runnable code

dohlenaugur commented 1 year ago

Oh, sure. I apologize for that mistake.

#!/usr/bin/env python
import sys

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

def topology(distance=0):
    print("Distance between station and ap is " + str(distance) + "m!")
    net = Mininet_wifi(autoAssociation=True)
    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint(
        'ap1',
        ssid='ap1-ssid',
        mode='g',
        channel=1,
        failMode="standalone",
        position=str(distance) + ',0,0',
        range='75'
    )
    # 74 = default range
    sta1 = net.addStation(
        'sta1',
        mac='00:00:00:00:00:02',
        ip='10.0.0.21/24',
        position='0,0,0',
        range='75',
    )
    c1 = net.addController('c1')
    h1 = net.addHost('h1', ip='10.0.0.91/24')

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=4)

    info("*** Configuring nodes\n")
    net.configureNodes()

    net.addLink(ap1, h1)  # make wired link between host and ap

    info("*** Starting network\n")
    net.build()
    c1.start()
    ap1.start([c1])
    h1.cmd("iperf -s &")

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

def main(args):
    if not len(args) > 1:
        args = [0, 50]
    topology(float(args[1]))

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

mininet_wifi_BW_test.zip

Please run the script with: $ sudo python3 mininet_wifi_BW_test.py XX Where XX is the distance (e.g. 50 for 50m)

In the CLI, one can perform iperf via >> py sta1.cmd("iperf -f m -t 5 -c 10.0.0.91") to check the connection between station and host (sta1 <-wireless-> ap1 <-wire-> h1)

I saw a normal decline for 2m - 50m but afterwards the bandwidth jumped to really high values

ramonfontes commented 1 year ago

This seems duplicated from https://github.com/intrig-unicamp/mininet-wifi/issues/327#issuecomment-692221480.

net = Mininet_wifi(... ifb=True) will probably solve the issue.

dohlenaugur commented 1 year ago

Thanks for the quick reply. Using "net = Mininet_wifi(... ifb=True)" resulted in 60.4 Mbits/sec, which is less than before, but still higher than 7.98 Mbits/sec from 50m (this value was the same when I tried it with ifb).

I would expect, TC decreasing the bandwidth more and more, why would there be a jump (if the jump is intended?) When I try it with wmedium, the jump is not present, so do I have to use it, or is there a possibility without it?

ramonfontes commented 1 year ago

Please do a git pull and sudo make install. Then, try running the code again.