How to measure the throughput of a network with ipmt Unix command

ipmt, for IP measurement tools, is a set of tools able to carry out performance measurements on IP networks at the transport layer. tcpmt and udpmt are network performance measurement tools at the transport layer (respectively TCP and UDP). Every second, they generate a throughput report.
By default, they transmit on the discard port of the destination station. This means that, for UDP, the measured throughput at the sender cannot be the effective transmitted throughput since UDP is not reliable.

How to use them :
# tcpmt [-p port] [-s pktsz] [-n pktnb] host
# udpmt [-p port] [-s pktsz] [-n pktnb] host

Where :
port is the destination port number (discard, by default).
pktsz is the size of sent packets (1024 bytes by default) This parameter is only significant in the UDP context.
pktnb is the packet number to send (by default, press Control-C to stop the transmission).
host is the destination address.
A report is generated every second

  • transmission time (in ms since 0h),
  • the number of sent packets during the time interval,
  • the total number of sent packets,
  • the measured throughput during the time interval in kbit/s,
  • the average throughput on the last ten seconds,
  • the average throughput since the beginning.

tcptarget and udptarget are two programs which measure the trhoughput at the destination. Thay can be launched with no argument and they display the port number on which they are listening. We must use the -p option of tcpmt/udpmt in order to specify a port. As soon as tcptarget/udptarget start to receive packets, they display a report every second. This report is easier to understand than the sender report but it is less detailed. It displays the reception time in seconds with a precision around the millisecond and the throughput in kbit/s.

If you want to measure the behavior of concurrent flows sent on the same target station, Tcp/udptarget are the perfect tools since the arrival times are computed on the same station. Thus you can easily compare the packet arrival times of the different flows without having to synchronize the sending stations.

How to manipulate the routing table in Unix

The routing table of a station can be modified or seen thanks to the route command. It may be used to add or remove entries in the table. The routing table can be displayed by “netstat -r” command (For more information on netstat command please follow: http://computerandu.wordpress.com/2011/03/03/how-to-use-netstat-a-unix-networking-command/).

1. Route command presentation:

route add|delete [-net|-host] []

command keywords signification :
add|delete : add will add an entry in the routing table , delete will remove one ;
-net|-host : -net allows to specify an entry towards a network, -host allows to specify an entry towards a host ;
destination : The destination can be a host station address or a network address followed by the subnet mask length, /20 ; The destination may also be the keyword default. In this case, the packet will be sent to the matching router if the destination network address is not specified in the routing table ;
gateway : the router address which relays the packets from one network to another;
netmask : the subnet mask of the destination network.

2. Add a path in a routing table: Use the add option, and specify in the following order : the -net option if you need to enter a network route or -host if it is a host route, the destination IP address (network or station) and the destination internet address (network or station) and the IP address of the router that will relay the traffic. For instance :
# route add -net 192.168.0 192.168.1.2
add net 192.168.0: gateway 192.168.1.2
will add a path in the routing table : to reach the network 192.168.0/24, you must go through the 192.168.1.2 router.

3. Remove an entry in the routing table: Use the delete option and specify host or network options like in the addition process. For instance :
# route delete -net 192.168.0/24
will remove the previous entry added in the routing table.

4. Delete all the routing table entries: The flush command will remove all the entries added with the add command. If you use this command remotely, it may suspend all your current communications with this router and make this station unreachable.

Remark : do not remove the loopback entry, 127.0.0.1 or localhost, which enables the application to communicate localy.

How to use netstat : A Unix networking command

This command displays the different data structure contents linked to the station network configuration. Here we will only talk about two ways to use netstat, but there are many other information that we can get (sockets status, routing table, multicast ).

Network interface statistics: Use the option -I (interface), and specifythe interface name to observe (em0 for instance), and the option -w 1 to display a report every second. If you do not specify this last option, netstat will only give one report in a different style. We can also specify the option -d.

Theses reports include the following information :
(fxp0) : network interface name.
packets : the received/transmitted packets with no errors ;
errs : the received/transmitted packets with errors ;
bytes : The number of received/transmitted bytes ;
colls : the collisions number ;
drops : the dropped packet numbers (with -d).

For instance :
# netstat -w 1 -I fxp0 -d will display a report of the fxp0 interface every second. We get :

Routing table display: Specify the -r option (routing table). It can be also interesting to specify the -n option and -f inet, to disable the name resolution and only list IPv4 information (use inet6 to display the IPv6 table).

Various fields signification (for a thorough explanation, use man) :
Destination : the destination network of host address ;
Gateway : the router address, the local link or the remote interface address on thelink ;
Flags :
U : Indicates route is ”up” ;
G : Route is to a gateway ;
S : Static route (manual addition) ;
H : Route is to a host and not a network ;
D : Route was created dynamically by a redirect ;
Refs : The ref field gives the current number of active uses of the route ;
Use : The use field provides a count of the number of packets sent using that route. ;
Netif : The interface entry indicates the network interface utilized for the route ;
Expire : The Expire entry is the result of FreeBSD’s unfortunate co-mingling network layer routing information with layer 2 ARP information. The only entries with ”Expire” values are actually ARP entries.

 

Sources: INPG Prof. Olivier