KPI measurement script using python and iperf3 library using RaspberryPi4 B with either a 4G/5G HAT or a 5G dongle
running on Ubuntu
sudo apt update
installed code
downloaded the .deb and used sudo dpkg -i whatever.deb
install python 3
sudo apt install python3
and install pip (python package managment)
sudo apt install python3-pip
made a virtual environemnt myenv
sudo apt install python3.8-venv
python3 -m venv myenv
activate the virtual environment
source venv/bin/activate
python environment manager is also nice to have in the visual code
make sure the correct python interpreter is selected for the virtual environment
installed iperf3
pip install iperf3
sudo apt install iperf3
look for your network ips by
ip a
there is a subsection in the response starting with "en" for "Ethernet Network", the ip information underneath that is the ip we are interested in
for me it is named "enp0s3" ethernet network pci bus 0 slot 3
underneath there is something with the tag inet that shows your ip address for that ethernet network connection
inet 192.168.178.62/24 brd 192.168.178.255 scope global dynamic noprefixroute enp0s3
for the Plot.py
I have not yet decided 100% but I think there is no reason to run it on RP4 and we can just simply transfer all the logs to the laptop (wifihotspot provider) and tun Plot.py on Ubuntu or even Windows.
pip install pandas matplotlib
-----------------------------
I used "iperf3 -s" on my laptop and "iperf3 -c 192.168.178.51" on my Desktop and got the trans/rec indications
now I have to write it as code:
I wrote the code for both the client and the server side.
a python script runs on both sides, the client needs the IP address for connecting to the server
I got the results for a transmission between them. there is ofcourse a difference between sent and received Mbps between the client and the server which is caused by network overhead, packet loss,transmission delay, jitter, measurement method differences, network congestion
running on Raspberry pi 4 B
install VS code
sudo apt update
sudo apt install code
python stuff
sudo apt install python3
sudo apt install python3-pip
sudo apt install python3-venv
environment
python3 -m venv Client/Server
source bin/activate
iperf3
pip install iperf3
sudo apt install iperf3
it apears rp4 is using 5201 for something even though i could not see what. just use port 5202
I had so much trouble and apparently its because we are running out of IPs in our part of the building. basically when I was connecting the RP4 to the ethernet, I was losing my VM network connection on the pc. lovely stuff. wasted 4 hours on that :)
NAT does not need an extra IP but then it can only server as the client, but for the server you need Bridged connection which will consume an extra ip address
VNC connection
turn on the VNC in the interfaces, the GUI way is better i think
turn off the firewall
sudo ufw disable
also for some reason the wifi is now working even though it did not work in the morning after 20 tries. it works now without changing anything.
experience: the raspberry pi wont connect to eduroam unless you first connect it to the internet using ethernet successfuly first
the wifi and ethernet use network-manager and the dongle uses dhcp
it wont be required to uninstall the network-manager but sometimes the dongle takes priority in that case
ip route
look at the wlan0 metric, then go change the metric for eth1(dongle) to a higher number meaning lower priority
sudo nano /etc/dhcpcd.conf
interface <dongle-interface-name>
metric higher number than wlan0
sudo systemctl restart dhcpcd.service
--------------
added the Server_MP (Server with Multiple Ports)
it uses multiprocesses to interact with clients on multiple configured ports