-
Notifications
You must be signed in to change notification settings - Fork 8
About Lab 1: ping, traceroute, iperf
Use ping, traceroute and iperf.
You will need to write code for using these tools in the Notebook template. After each experiment check that the traffic is captured correctly in L50Lab1/
so that you can process it later if necessary.
Before starting the experiments, use ping to check that your interfaces are actually connected. ifconfig <interface name>
shows information about your interface. It needs to be UP (enabled) and RUNNING (plugged in).
ping is used to test the reachability of a host on an IP network. The source sends an ICMP Echo Request and the destination sends an ICMP Echo Reply. The round-trip time is measured.
ping <address> [Optional: -c <count>] [Optional: -i <interval>] [Optional: -f]
interval = gap between pings in seconds, default=1
-f = pings as fast as possible
count = number of pings. If unspecified, ping runs until killed.
ping only measures the round-trip time between the source and destination. If the destination is unreachable, it could be due to a failure of any node or link on the route taken.
traceroute reports the route that a packet takes across an IP network, and measures round-trip times of every hop. If the connection is lost along a certain hop, then we can isolate the failure between two nodes.
traceroute <address> [Optional: -I]
-I = use ICMP Echo Request packets. If unspecified, use UDP packets. This may be needed if traceroute is blocked by an address.
By default, traceroute sends 3 packets.
iperf is used to test the maximum network throughput that a computer can handle. The DuT acts as an iperf server and listens for connections. A second computer connects to the server and sends datagrams.
In bidirectional testing, both computers act as both servers (receiving) and clients (sending).
Server:
TCP: iperf -s -B <server address>
UDP: iperf -s -B <server address>
-u
Client:
TCP: iperf -c <server address> [Opt: -i <interval>] [Opt: -t <time>] [Opt: -f <format>] [Opt: -d] [Opt: -w <TCP window size>]
interval = how often to report bandwidth in seconds
time = length of test in seconds
format = 'k' for Kbits/sec, 'm' for Mbits/sec, 'g' for Gbits/sec
-d = bidirectional
TCP window size -> eg. -w 20KB
UDP: iperf -c <server address> [Opt: -i <interval>] [Opt: -t <time>] [Opt: -f <format>] [Opt: -d] [Opt: -b <bandwidth>]
NB By default, iperf restricts bandwidth for UDP clients to a maximum of 1 Mbit/sec. There is no restriction for TCP clients.
Server:
TCP/UDP: iperf3 -s -B <server address>
Client:
TCP: iperf3 -c <server address> [Opt: -i <interval>] [Opt: -t <time>] [Opt: -f <format>] [Opt: -w <window size>]
UDP: iperf3 -c <server address> [Opt: -i <interval>] [Opt: -t <time>] [Opt: -f <format>] [Opt: -b <bandwidth>]
getrtt(ffile,num)
Input: ffile = '[folder]/[file]', eg. '1/exp1a_0'. num = number of pings.
Output: list of RTTs in microseconds
graph1(exp,div,num)
Input: exp = experiment name, eg. 'exp1a'. div = gaps between error bars. num = number of pings.
Plots the graph.
graph5_000001(exp,usecs,num)
Input: exp = experiment name. usecs = list of rx-usecs. num = number of pings.
Plots the graph for interval 0.000001 s.
graph5_001(exp,usecs,num)
Input: exp = experiment name. usecs = list of rx-usecs. num = number of pings.
Plots the graph for interval 0.001 s.
data_iperf(fexp)
Input: '[folder]/[exp]', eg. '1/exp1a'
Output: list of 5 bandwidths in Gbits/sec for each interval
[ [5x bw for 0-1sec] , ... , [5x bw for 9-10sec] ]
data10()
Output: tuple containing iperf bandwidths in Gbits/sec of 1. server 2. client
( [ [5x bw for 0-1sec (ser)] , ... , [5x bw for 9-10sec (ser)] ] ,
[ [5x bw for 0-1sec (cli)] , ... , [5x bw for 9-10sec (cli)] ] )
data11(windows)
Input: list of specified window sizes in KB
Output: tuple containing 1. list of actual window sizes in KB 2. list of 5 bandwidths in Gbits/sec for each window size
( [sz1, ... , szn] ,
[ [5x bw for sz1] , ... , [5x bw for szn] ] )
data_band(fexp,band)
Input: fexp = '/'. band = list of specified bandwidths in Mbits/sec.
Output: tuple containing 1. list of actual bandwidths in Mbits/sec 2. list of 5 percentages for each bandwidth
( [bw1, ... , bwn] ,
[ [5x % for bw1] , ... , [5x % for szn] ] )
data13b(windows)
Input: list of specified window sizes in KB
Output: list of 5 bandwidths in Gbits/sec for each window size
[ [5x bw for sz1] , ... , [5x bw for szn] ]
graph_error(data)
Input: list containing n repeats for each data point
[ [n x point 1], [n x point 2], ... , [n x point m] ]
Output: tuple containing 1. list of median y-values 2. correctly formatted yerr for plotting error bars
( [y1, y2, ... , yn] ,
[ [below1, below2, ... , belown], [above1, above2, ... , aboven] ])