Home / Solaris 10 / How to Measure the Network Bandwidth Between Solaris Nodes?

How to Measure the Network Bandwidth Between Solaris Nodes?

There is no command available in any Unix like operating systems to measure the actual bandwidth of network by sending the real packets over the network. OS developers intentionally left out this option since such type of commands will hammer the system network. But we need such kind of tool in project phase of the system where you need to perform some real tests on network bench-marking. I had found a tool which will help you to find real bandwidth of Solaris system. 

 

If you have Solaris 11 local repository , you can install iperf using pkg install command on both the hosts in which you would like to measure the bandwidth.

root@Soalris 11.1:~# pkg install iperf
           Packages to install:  1
       Create boot environment: No
Create backup boot environment: No

Planning linked: 0/2 done; 1 working: zone:solzon11
Planning linked: 1/2 done; 1 working: zone:Soalris
Planning linked: 2/2 done
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                1/1           6/6      0.1/0.1  166k/s

Downloading linked: 0/2 done; 1 working: zone:solzon11
Downloading linked: 1/2 done; 1 working: zone:Soalris 11.1_T
Downloading linked: 2/2 done
PHASE                                          ITEMS
Installing new actions                         20/20
Updating package state database                 Done
Updating image state                            Done
Creating fast lookup database                   Done
Executing linked: 0/2 done; 1 working: zone:solzon11
Executing linked: 1/2 done; 1 working: zone:Soalris
Executing linked: 2/2 done
root@Soalris 11.1:~#

 

Initiate the iperf server daemon first host,

root@Solaris11.host1:~# iperf -s -i 1
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 1.00 MByte (default)
------------------------------------------------------------
[  4] local 192.25.205.230 port 5001 connected with 192.255.205.230 port 37390
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  0.00 Bytes  0.00 bits/sec

 

On the iperf client process on second host,

root@Solaris11.host2:~# iperf -n 1024M -i 1 -c 192.255.205.230
------------------------------------------------------------
Client connecting to 192.255.205.230, TCP port 5001
TCP window size: 1.00 MByte (default)
------------------------------------------------------------
[  4] local 192.23.205.220 port 37390 connected with 192.255.205.230 port 5001
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  3.39 MBytes  28.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  4]  1.0- 2.0 sec  9.70 MBytes  81.4 Mbits/sec

 

You can also use the netpref tool to measure the bandwidth.  (Not sure the following FTP site is still active )

The tool name called “netpref” and you can download it from this ftp site.

Environment:
Operating system :Solaris 11
NetPref Version: 2.6.0

Prerequisite:
Install the below mentioned packages.

root@UAAIS:~# pkg install gcc-3
           Packages to install:  3
       Create boot environment: No
Create backup boot environment: No
            Services to change:  1

Planning linked: 0/2 done; 1 working: zone:uaz2
Planning linked: 1/2 done; 1 working: zone:uaz1
Planning linked: 2/2 done
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                3/3     2041/2041    40.9/40.9  367k/s

Downloading linked: 0/2 done; 1 working: zone:uaz2
Downloading linked: 1/2 done; 1 working: zone:uaz1
Downloading linked: 2/2 done
PHASE                                          ITEMS
Installing new actions                     2333/2333
Updating package state database                 Done
Updating image state                            Done
Creating fast lookup database                   Done
Executing linked: 0/2 done; 1 working: zone:uaz2
Executing linked: 1/2 done; 1 working: zone:uaz1
Executing linked: 2/2 done
root@UAAIS:~# pkg install header-math
No updates necessary for this image.
Planning linked: 2/2 done
root@UAAIS:~#

Installation of NetPref
1.Copy the “netperf-2.6.0.tar.bz2” to /tmp directory and un-tar it .

root@UAAIS:/tmp# tar -xvf netperf-2.6.0.tar.bz2
x netperf-2.6.0, 0 bytes, 0 tape blocks
x netperf-2.6.0/README.windows, 4348 bytes, 9 tape blocks
x netperf-2.6.0/config.guess, 43499 bytes, 85 tape blocks
x netperf-2.6.0/netperf.spec.in, 1807 bytes, 4 tape blocks
x netperf-2.6.0/Makefile.in, 22579 bytes, 45 tape blocks

2.Comment out the below lines from /tmp/netperf-2.6.0/src/dscp.c file.

  48 /*
     49  * Definitions for IP type of service (ip_tos)
     50  */
     51
     52 /* #if HAVE_NETINET_IN_SYSTM_H
     53 *  #include netinet/in_systm.h
     54 #endif */

3.Navigate it to /tmp/netperf-2.6.0/ and run configure.

root@UAAIS:/tmp/netperf-2.6.0# ./configure
checking build system type... i386-pc-solaris2.11
checking host system type... i386-pc-solaris2.11
checking target system type... i386-pc-solaris2.11
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/gmkdir -p
checking for gawk... gawk

4.Run make command to build the package of Netpref.

root@UAAIS:/tmp/netperf-2.6.0# make
make  all-recursive
Making all in src
Making all in missing
Making all in m4
gcc -DHAVE_CONFIG_H -I. -I..      -lsocket -lnsl -lkstat -MT netperf.o -MD -MP -MF .deps/netperf.Tpo -c -o netperf.o netperf.c
gcc: -lsocket: linker input file unused because linking not done
gcc: -lnsl: linker input file unused because linking not done
gcc: -lkstat: linker input file unused because linking not done
mv -f .deps/netperf.Tpo .deps/netperf.Po

5.Install the Netpref using below command.

root@UAAIS:/tmp/netperf-2.6.0# make install
Making install in src
Making install in missing
Making install in m4
test -z "/usr/local/bin" || /usr/bin/gmkdir -p "/usr/local/bin"
  /usr/bin/ginstall -c netperf netserver '/usr/local/bin'
Making install in doc
Making install in examples
test -z "/usr/local/share/info" || /usr/bin/gmkdir -p "/usr/local/share/info"
 /usr/bin/ginstall -c -m 644 ./netperf.info '/usr/local/share/info'
 install-info --info-dir='/usr/local/share/info' '/usr/local/share/info/netperf.info'
install-info: warning: no info dir entry in `/usr/local/share/info/netperf.info'
test -z "/usr/local/share/man/man1" || /usr/bin/gmkdir -p "/usr/local/share/man/man1"
 /usr/bin/ginstall -c -m 644 'netperf.man' '/usr/local/share/man/man1/netperf.1'
 /usr/bin/ginstall -c -m 644 'netserver.man' '/usr/local/share/man/man1/netserver.1'
root@UAAIS:/tmp/netperf-2.6.0#

6.Verify the binaries.

root@UAAIS:~# file /usr/local/bin/netperf
/usr/local/bin/netperf: ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped
root@UAAIS:~# file /usr/local/bin/netserver
/usr/local/bin/netserver:       ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped
root@UAAIS:~#

We have successfully installed the Netpref from source code. 

7.For local zones,you can simply copy the binaries.

root@UAAIS:# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              solaris  shared
   6 uaz1             running    /export/zones/uaz1             solaris  excl
   8 uaz2             running    /export/zones/uaz2             solaris  excl
root@UAAIS:# cp /usr/local/bin/netperf /export/zones/uaz1/root/
root@UAAIS:# cp /usr/local/bin/netserver /export/zones/uaz1/root/
root@UAAIS:# cp /usr/local/bin/netperf /export/zones/uaz2/root/
root@UAAIS:# cp /usr/local/bin/netserver /export/zones/uaz2/root/
root@UAAIS:#


How to use Netpref?
1.Log in to the first server and start the netserver. (UAASIS 192.168.2.31 )

root@UAAIS:# /usr/local/bin/netserver
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
root@UAAIS:#


2.Let me login to another Solaris host and run NetPerf to remote host IP.

Oracle Corporation      SunOS 5.11      11.1    September 2012
root@uaz1:/# ./netperf -H 192.168.2.31
MIGRATED TCP STREAM TEST from ::ffff:0.0.0.0 () port 0 AF_INET to 192.168.2.31 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

128000  49152  49152    10.04     304.45
root@uaz1:/# ./netperf -H 192.168.2.31
MIGRATED TCP STREAM TEST from ::ffff:0.0.0.0 () port 0 AF_INET to 192.168.2.31 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

128000  49152  49152    10.08     304.71
root@uaz1:/#

As per the above about system bandwidth is 300Mb/s~.Let me check the actual system’s bandwidth,

root@uaz1:/# dladm show-vnic
LINK                OVER         SPEED  MACADDRESS        MACADDRTYPE       VID
net0                ?            300    2:8:20:38:8d:7c   random            0

So this system is limited to 300Mb/s and netperf also showing the same.

3.Let me login to another host and test the tool again.

root@uaz2:/# ./netperf -H 192.168.2.31
MIGRATED TCP STREAM TEST from ::ffff:0.0.0.0 () port 0 AF_INET to 192.168.2.31 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

128000  49152  49152    10.04     514.72
root@uaz2:/# 
root@uaz2:/#dladm show-vnic
LINK                OVER         SPEED  MACADDRESS        MACADDRTYPE       VID
net0                ?            500    2:8:20:87:d2:88   random            0
root@UAAIS:~#

Perfect.

4. we have already set the bandwidth limit between host as 100Mb/s between database server and backup server.Let me run the test on those hosts.

root@uaz2:/# ./netserver
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
root@uaz2:/# ssh uaz1 
root@uaz1:/# ./netperf -H 192.168.2.52
MIGRATED TCP STREAM TEST from ::ffff:0.0.0.0 () port 0 AF_INET to 192.168.2.52 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

128000  49152  49152    10.02     104.49
root@uaz1:/#


5.Verify the network settings between these hosts.

root@uaz1:~# flowadm
FLOW        LINK                IPADDR                   PROTO  LPORT   RPORT   DSFLD
uaz2-flow-control net0          RMT:192.168.2.52/32      --     --      --      --
root@uaz1:~# flowadm show-flowprop
FLOW         PROPERTY        VALUE          DEFAULT        POSSIBLE
uaz2-flow-control maxbw        100          --             --
root@uaz1:~#

Just 100Mb/s speed has been set between these two hosts.So our Netpref tool has produced some awesome results.  
Note:Do not try this tool on production environment.It will hammer complete network bandwidth. This tool will be mostly used for network bench-marking 

Hope you will like this tool.Thank you visiting UnixArena.

VMTURBO-CLOUD-CAPACITY

Leave a Reply

Your email address will not be published. Required fields are marked *