We have many tools available online which can help us monitor network bandwidth usage within a network between differnt Linux machines.
In this article I will show how netperf can be used to monitor network performance between two Linux machines
Brief information on my setup:
The ethernet speed assigned to both interfaces eth0 and eth1 under bond0 is 1 GB
so if we use bond0 for our network operations then ethernet bandwidth must not exceed 1 GB
The ethernet speed assigned to both interfaces eth2 and eth3 under bond1 is 3 GB
so if we use bond1 for our network operations then ethernet bandwidth must not exceed 3 GB
The ethernet speed assigned to bond0 and bond1 is same as server i.e. 1 GB and 3 GB respectively
Let us start our test
Installed netperf on both the machines
NOTE: I would recommend to disable the firewall on both server and client for the monitoring purpose as at times your firewall might stop netperf from sending traffic to client machine
On Server
Start netperf on any free port number
So our port has been opened by netperf
On Client
In the below example we are sending traffic for 100 seconds to host server IP 192.169.32.15
So bond0 network traffic is within our limit as provided to the interface i.e. 1 GB/s
Lets validate bond1
Here my server IP of bond1 is 192.169.32.37
bond1 network traffic is also within our provided limit i.e. 3 GB/s
I hope the article was helpful
Basic iptables tutorial in Linux I
Basic iptables tutorial in Linux II
Creating an internal network using VMware Workstation
Setting up custom TCP/IP Keep Alive Parameter in Linux
What is virtual memory, paging and swap space?
How to take remote desktop of Windows from Linux
How to detect new hard disk attached without rebooting in Linux
How to detect new NIC/Ethernet card without rebooting in Linux
15 practical examples of rpm command usage in Linux
Why is sudo command asking for root password in Linux
How to configure bridged network in Oracle Virtual Box (Linux)
How to configure passwordless sudo for a user in Linux
Understanding Load Average in Linux and when to be worried about it?
How to run a process in background or bring to foreground in Linux
How to configure logrotate for a new log file in Red Hat Linux
In this article I will show how netperf can be used to monitor network performance between two Linux machines
Brief information on my setup:
Server
My server IP is 192.169.32.15 where I have 2 bond interfaces as below# ifconfig bond0
bond0 Link encap:Ethernet HWaddr 00:17:A4:77:00:38
inet addr:192.169.32.15 Bcast:192.169.32.31 Mask:255.255.255.224
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:9042150 errors:0 dropped:4553 overruns:0 frame:0
TX packets:2277574 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13654658052 (13022.0 Mb) TX bytes:153728769 (146.6 Mb)
# ifconfig bond1
bond1 Link encap:Ethernet HWaddr 38:63:BB:2F:E5:A9
inet addr:192.169.32.37 Bcast:192.169.32.63 Mask:255.255.255.224
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:28334533 errors:0 dropped:2 overruns:0 frame:0
TX packets:2066047 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:42898423316 (40911.1 Mb) TX bytes:136362958 (130.0 Mb)
The ethernet speed assigned to both interfaces eth0 and eth1 under bond0 is 1 GB
# ethtool eth0 | grep -i Speed
Speed: 1000Mb/s
# ethtool eth1 | grep -i Speed
Speed: 1000Mb/s
so if we use bond0 for our network operations then ethernet bandwidth must not exceed 1 GB
The ethernet speed assigned to both interfaces eth2 and eth3 under bond1 is 3 GB
# ethtool eth2 | grep -i Speed
Speed: 3000Mb/s
# ethtool eth3 | grep -i Speed
Speed: 3000Mb/s
so if we use bond1 for our network operations then ethernet bandwidth must not exceed 3 GB
Client
My clinet node is 192.169.32.17 where as well I have 2 bond interfaces in the same subnet as my server# ifconfig bond0
bond0 Link encap:Ethernet HWaddr 00:17:A4:77:00:44
inet addr:192.169.32.17 Bcast:192.169.32.31 Mask:255.255.255.224
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2263768 errors:0 dropped:5390 overruns:0 frame:0
TX packets:8626819 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:150407672 (143.4 Mb) TX bytes:12455852277 (11878.8 Mb)
# ifconfig bond1
bond1 Link encap:Ethernet HWaddr 38:63:BB:2F:56:C1
inet addr:192.169.32.38 Bcast:192.169.32.63 Mask:255.255.255.224
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2067482 errors:0 dropped:16 overruns:0 frame:0
TX packets:28335782 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:136453804 (130.1 Mb) TX bytes:41070143636 (39167.5 Mb)
The ethernet speed assigned to bond0 and bond1 is same as server i.e. 1 GB and 3 GB respectively
Let us start our test
Installed netperf on both the machines
NOTE: I would recommend to disable the firewall on both server and client for the monitoring purpose as at times your firewall might stop netperf from sending traffic to client machine
On Server
server # rpm -Uvh /tmp/netperf-2.6.0-3.3.x86_64.rpm
warning: /tmp/netperf-2.6.0-3.3.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID f388ca22
Preparing... ########################################### [100%]
1:netperf ########################################### [100%]
Start netperf on any free port number
# netserver -p 16604
Starting netserver with host 'IN(6)ADDR_ANY' port '16604' and family AF_UNSPEC
# netstat -ntlp | grep 16604
tcp 0 0 :::16604 :::* LISTEN 3624/netserver
So our port has been opened by netperf
On Client
client # rpm -Uvh /tmp/netperf-2.6.0-3.3.x86_64.rpm
warning: /tmp/netperf-2.6.0-3.3.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID f388ca22
Preparing... ########################################### [100%]
1:netperf ########################################### [100%]
In the below example we are sending traffic for 100 seconds to host server IP 192.169.32.15
# netperf -H 192.169.32.15 -p 16604 -l 100
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.169.32.15 () port 0 AF_INET : demo
enable_enobufs failed: setsockopt
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
11796480 11796480 11796480 100.07 994.23
So bond0 network traffic is within our limit as provided to the interface i.e. 1 GB/s
Lets validate bond1
Here my server IP of bond1 is 192.169.32.37
# netperf -H 192.169.32.37 -p 16604 -l 100
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.169.32.37 () port 0 AF_INET : demo
enable_enobufs failed: setsockopt
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
11796480 11796480 11796480 100.02 2982.72
bond1 network traffic is also within our provided limit i.e. 3 GB/s
I hope the article was helpful
Follow the below links for more helpful tutorials
Tutorial for Monitoring Tools SAR and KSAR with examples in LinuxBasic iptables tutorial in Linux I
Basic iptables tutorial in Linux II
Creating an internal network using VMware Workstation
Setting up custom TCP/IP Keep Alive Parameter in Linux
What is virtual memory, paging and swap space?
How to take remote desktop of Windows from Linux
How to detect new hard disk attached without rebooting in Linux
How to detect new NIC/Ethernet card without rebooting in Linux
15 practical examples of rpm command usage in Linux
Why is sudo command asking for root password in Linux
How to configure bridged network in Oracle Virtual Box (Linux)
How to configure passwordless sudo for a user in Linux
Understanding Load Average in Linux and when to be worried about it?
How to run a process in background or bring to foreground in Linux
How to configure logrotate for a new log file in Red Hat Linux