How to list current network connection

2013/11/19

It’s often needed while installing a server to check the current network connection. Their is a tools in both Windows and Linux OS but the option are quite different.

Here after a sample that list current TCP listening (server side) connection with it’s associated process ID for Linux and Windows OS.

Linux:

[lolo@dellxps ~]$ netstat -lp --tcp

Windows:

C:\>netstat -abf -p tcp

To test if a particular port is open (here LDAP 389)

Linux:

[lolo@dellxps ~]$ netstat -ltnp | grep :389

Windows:

C:\>netstat -aon | findstr 389

Feel free to use “netstat /?” on windows or the man pages on Linux for more option details.


Iperf, THE network throughput performance tuning tools

2010/02/11

For my first post, i will share with you my today entertainment; Iperf, a network throughput tuning tool.
For a long time, i was using QCheck v3 but i found Iperf much more flexible, with much more functions that QCheck.

Iperf is a command line multi-platform, client-server type program that will let you measuring your LAN-WLAN-WAN bandwidth.

Just copy it on both client, (source, from where it start and where the result is showed), and server side (target, just listen and send back the statistic, except in full duplex mode).

As sample, star first by the server side, you can run it with the following command:
#iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
Where:
-s will make iperf running in server mode.
Then on the client side:
#iperf -c SERVER_Host_or_IP -t 10 -i 1
------------------------------------------------------------
Client connecting to bckserver, TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
[1908] localhost port 41182 connected with SERVER_Host_or_IP port 5001
[ ID] Interval Transfer Bandwidth
[1908] 0.0- 1.0 sec 35.0 MBytes 294 Mbits/sec
[1908] 1.0- 2.0 sec 32.2 MBytes 270 Mbits/sec
[1908] 2.0- 3.0 sec 33.5 MBytes 281 Mbits/sec
[1908] 3.0- 4.0 sec 19.4 MBytes 163 Mbits/sec
[1908] 4.0- 5.0 sec 21.8 MBytes 183 Mbits/sec
[1908] 5.0- 6.0 sec 22.9 MBytes 192 Mbits/sec
[1908] 6.0- 7.0 sec 36.2 MBytes 304 Mbits/sec
[1908] 7.0- 8.0 sec 32.5 MBytes 273 Mbits/sec
[1908] 8.0- 9.0 sec 36.7 MBytes 308 Mbits/sec
[1908] 9.0-10.0 sec 37.2 MBytes 312 Mbits/sec
[1908] 0.0-10.0 sec 307 MBytes 258 Mbits/sec
Where:
-c :will make iperf running in client mode.
SERVER_Host_or_IP   :is your server IP Address or Hostname.
-t 10 :is the duration of the test, here 10 seconds.
-i 1 :is interval in second that the client display statistic.

The last row display the result:
test duration, Total size data used for test, Average throughput

By default it use port TCP/UDP 5001 (depending on the test you launch), but of course you can change it.

Some more option are avalaible on  the tar file at /doc/index.html.

Here the CLI help:

#iperf -h
Usage: iperf [-s|-c host] [options]
iperf [-h|--help] [-v|--version]

Client/Server:
-f, --format [kmKM] format to report: Kbits, Mbits, KBytes, MBytes
-i, --interval # seconds between periodic bandwidth reports
-l, --len #[KM] length of buffer to read or write (default 8 KB)
-m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)
-o, --output 'filename' output the report or error message to this specified file
-p, --port # server port to listen on/connect to
-u, --udp use UDP rather than TCP
-w, --window #[KM] TCP window size (socket buffer size)
-B, --bind 'host' bind to 'host', an interface or multicast address
-C, --compatibility for use with older versions does not sent extra msgs
-M, --mss # set TCP maximum segment size (MTU - 40 bytes)
-N, --nodelay set TCP no delay, disabling Nagle's Algorithm
-V, --IPv6Version Set the domain to IPv6

Server specific:
-s, --server run in server mode
-D, --daemon run the server as a daemon
-R, --remove remove service in win32

Client specific:
-b, --bandwidth #[KM] for UDP, bandwidth to send at in bits/sec (default 1 Mbit/sec, implies -u)
-c, --client 'host' run in client mode, connecting to 'host'
-d, --dualtest Do a bidirectional test simultaneously
-n, --num #[KM] number of bytes to transmit (instead of -t)
-r, --tradeoff Do a bidirectional test individually
-t, --time # time in seconds to transmit for (default 10 secs)
-F, --fileinput 'name' input the data to be transmitted from a file
-I, --stdin input the data to be transmitted from stdin
-L, --listenport # port to recieve bidirectional tests back on
-P, --parallel # number of parallel client threads to run
-T, --ttl # time-to-live, for multicast (default 1)

Miscellaneous:
-h, --help print this message and quit
-v, --version print version information and quit

[KM] Indicates options that support a K or M suffix for kilo- or mega-

The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_'long option name', such as IPERF_BANDWIDTH.

Report bugs to 'dast@nlanr.net'

There is JAVA GUI, which is nicely built with user friendly interface:

I have not yet test it on any linux distro but JPerf  work perfectly on Windows 2000 and Windows XP.
In a future post i will publish a VMware ESXi network interface test using this tools.