---
# System prepended metadata

title: 'Act 1 - Mininet-WiFi: Guided exercises/demo'
tags: [mininet-wifi-tutorials]

---

---
tags: mininet-wifi-tutorials
---

# Act 1 - Mininet-WiFi: Guided exercises/demo

In this note, you will learn the basics on how the Mininet-WiFi wireless network emulator works. Guided exercises will be explored and pointers to source code for those interested in delving deeper into the system architecture will be also provided. The pointers include stretches of the code where the link (including latency properties) can be customized.


## Activity 1: Warming up

**Create a simple topology:**
```
sudo mn --wifi
```

The command above will start Mininet-WiFi and configure a small network with two stations, and one access point. Use the option --topo of the mn command to discover further topology options.

_Troubleshooting_: If you have problems when a topology is created:
- Stop the network-manager service: ```sudo service network-manager stop```
- Kill the specific port (e.g. 6653) where the controller is running: ```sudo fuser -k 6653/tcp```

In Mininet-WiFi terminal (**mininet-wifi>**) execute the command nodes to observe the created network. Then, execute iwconfig to verify the association between the stations and ap1:

```
mininet-wifi>sta1 iwconfig
mininet-wifi>sta2 iwconfig
mininet-wifi>sta1 ping sta2
```

Then, disconnect sta1 and confirm the disconnection:
```
mininet-wifi>sta1 iw dev sta1-wlan0 disconnect
mininet-wifi>sta1 iwconfig
mininet-wifi>sta1 ping sta2
```

Now, connect sta1 again:
```
mininet-wifi>sta1 iw dev sta1-wlan0 connect my-ssid
mininet-wifi>sta1 iwconfig
mininet-wifi>sta1 ping sta2
```

:::info
Both **iw** and **iwconfig** are widely used to manage wireless interfaces on Linux systems
:::

## Activity 2: Loading your first Wireless 3D Topology

Run the position.py wireless-enabled topology (featuring 3D coordinates) example:
```
~$ cd mininet-wifi/
~/mininet-wifi$ sudo python examples/position.py
```
Now, observe the position of sta1, sta2 and ap1:

```
mininet-wifi>py sta1.position
mininet-wifi>py sta2.position
mininet-wifi>py ap1.position
```

Observe the signal strength as well:
```
mininet-wifi>py sta1.wintfs[0].rssi
mininet-wifi>py sta2.wintfs[0].rssi
```

:::info
You can replace **rssi** by **txpower**, **mode**, **channel**, **antennaGain** and others. You can find a complete list at https://mininet-wifi.github.io/.
:::

You can also verify the distance between two nodes:
```
mininet-wifi>distance sta1 ap1
mininet-wifi>distance sta1 sta2
```

**Question 2.1**: What is the observed bandwidth between sta1 and sta2?
Tip: try ```iperf sta1 sta2```

Now, move sta1 to a new position:
```
mininet-wifi>py sta1.setPosition('96,40,0')
```
**Question 2.2**: What happened with the association between sta1 and ap1?
Tip: try ```sta1 iwconfig```

Finally, increase the signal range of ap1:
```
mininet-wifi>py ap1.setRange(85, intf='ap1-wlan1')
```
**Question 2.3**: What happened with the association between sta1 and ap1?

**Question 2.4**: Now, observe the throughput between sta1 and sta2 again. What can we conclude?