1
votes

I just started a course on Computer Networks and my first assignment provides me with mininet script of a simple star topology, and asks me run an iperf measurement between h1 and h2. While the iperf is running I should test the ping between h3 and h4.

My question is that how do I make iperf measuring the data to run in background so I can test the ping, as I can not input when the iperf is running also cant open new terminal for mininet.

2

2 Answers

0
votes

You have two options:

1 - use the python API

2 - run parallel processes from the CLI

I am going to explain the second option, since you are using the CLI for your experiments.

First step: run Mininet with the single(star) topology.

giuseppe@raspberrypi:~ $ sudo mn --topo single,4
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1) (h3, s1) (h4, s1)
*** Configuring hosts
h1 h2 h3 h4
*** Starting controller
c0
*** Starting 1 switches
s1 ...
*** Starting CLI:
mininet>

if you want to do an iperf from h1->h2, you need the IP of h2, you can find it with ifconfig

mininet> h2 ifconfig
h2-eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.2  netmask 255.0.0.0  broadcast 10.255.255.255
        inet6 fe80::b87a:eaff:fec1:64a0  prefixlen 64  scopeid 0x20<link>
        ether ba:7a:ea:c1:64:a0  txqueuelen 1000  (Ethernet)
        RX packets 98  bytes 14845 (14.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 866 (866.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Start the server in h2 and log the stdout end stderr in the h2.log file

mininet> h2 iperf -s &> h2.log &

run the iperf client from h1 to h2(ip=10.0.0.2) and save the output in the h1.log file(in this case, I run it for 120 seconds, but you can adjust it)

mininet> h1 iperf -t 120 -c 10.0.0.2 &> h1.log &

Now you can run the ping, while the iperf is executing in background

mininet> h3 ping h4

You can check the logs opening another shell or after completing the experiment

mininet> h3 ping h4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=30.7 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=1.84 ms
64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=0.393 ms
64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=0.387 ms
^C
--- 10.0.0.4 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 73ms
rtt min/avg/max/mdev = 0.387/8.327/30.692/12.925 ms
mininet> exit
*** Stopping 1 controllers
c0
*** Stopping 4 links
....
*** Stopping 1 switches
s1
*** Stopping 4 hosts
h1 h2 h3 h4
*** Done
completed in 473.135 seconds
giuseppe@raspberrypi:~ $
giuseppe@raspberrypi:~ $ ls
h1.log  h2.log
0
votes

You can use xterm:

xterm h1 h2 h3 h4

You will get four xterm terminals for each node. You can then run iperf between h1 and h2 and ping between h3 and h4.

On h1, run: iperf -s &

On h2, run: iperf -s 10.0.0.1 -i 10 -t 60 to connect to h1.

On h3, run: ping 10.0.0.4 -c 10 to ping h4, or on h4, run ping 10.0.0.3 -c 10 to ping h3.

Here is an example