带宽

nload

实时监控网络带宽

安装
  • 有网
yum -y install epel-release
yum -y install nload
  • 无网

提前依据系统下载nload安装包

Binary Package nload-0.7.4-4.el7.x86_64.rpm

rpm -ivh nload-0.7.4-4.el7.x86_64.rpm
使用查看
  • nload 查看网卡流量,默认为当前使用的网卡。方向键切换网卡
  • nload单位换算:1byte=8bit
Device ens33 [192.168.214.102] (1/2):
==========================================================================================================================================
Incoming:
... ...


                                                                                              Curr: 1.39 kBit/s
                                                                                              Avg: 1.85 kBit/s
                                                                                              Min: 1.39 kBit/s
                                                                                              Max: 2.78 kBit/s
                                                                                              Ttl: 10.42 MByte
Outgoing:
... ...


                                                                                              Curr: 8.80 kBit/s
                                                                                              Avg: 7.30 kBit/s
                                                                                              Min: 4.27 kBit/s
                                                                                              Max: 8.80 kBit/s
                                                                                              Ttl: 320.70 kByte

  • #nload -m 显示所有网卡流量
Device ens33 [192.168.214.102] (1/2):
==========================================================================================================================================
Incoming:                                                            Outgoing:
Curr: 1.86 kBit/s                                                    Curr: 15.52 kBit/s
Avg: 1.46 kBit/s                                                     Avg: 14.45 kBit/s
Min: 944.00 Bit/s                                                    Min: 4.28 kBit/s
Max: 1.86 kBit/s                                                     Max: 16.01 kBit/s
Ttl: 10.41 MByte                                                     Ttl: 275.21 kByte

Device lo [127.0.0.1] (2/2):
==========================================================================================================================================
Incoming:                                                            Outgoing:
Curr: 0.00 Bit/s                                                     Curr: 0.00 Bit/s
Avg: 0.00 Bit/s                                                      Avg: 0.00 Bit/s
Min: 0.00 Bit/s                                                      Min: 0.00 Bit/s
Max: 0.00 Bit/s                                                      Max: 0.00 Bit/s
Ttl: 15.51 kByte                                                     Ttl: 15.51 kByte

  • nload <网卡name> 查看指定网卡
上半部分是:Incoming也就是进入网卡的流量,

下半部分是:Outgoing,也就是从这块网卡出去的流量,

每部分都有当前流量(Curr),

平均流量(Avg),

最小流量(Min),

最大流量(Max),

总和流量(Ttl)

iperf

带宽测试

  • 有网
yum -y install iperf3
  • 无网

提前依据系统下载iperf安装包

rpm -ivh iperf3-3.1.3-1.fc24.x86_64.rpm
  • 服务端

服务端需关闭防火墙,或者开放iperf端口

#默认端口为5201,-p 指定端口
iperf3 -s -i 1 -f M
  • 客户端
# -c  连接服务端,-i  每隔多少秒打印一次,-t  打印10s,-f 指定以MB的形式打印带宽速率
# iperf默认执行一个线程。如果带宽足够大,一个线程不足以达到最大带宽上限,可以添加 -P  参数指定多个线程
# -d表示双向同时测试
[root@localhost ~]# iperf3 -c 192.168.214.101 -i 1 -t 10 -f M
Connecting to host 192.168.214.101, port 5201
[  4] local 192.168.214.102 port 59378 connected to 192.168.214.101 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   690 MBytes   690 MBytes/sec   27   1.44 MBytes       
[  4]   1.00-2.00   sec   823 MBytes   823 MBytes/sec    0   1.81 MBytes       
[  4]   2.00-3.00   sec   834 MBytes   834 MBytes/sec    1   1.54 MBytes       
[  4]   3.00-4.00   sec   825 MBytes   824 MBytes/sec    0   1.70 MBytes       
[  4]   4.00-5.00   sec   844 MBytes   845 MBytes/sec    2   1.41 MBytes       
[  4]   5.00-6.00   sec   828 MBytes   827 MBytes/sec    0   1.77 MBytes       
[  4]   6.00-7.00   sec   852 MBytes   853 MBytes/sec   34   1.44 MBytes       
[  4]   7.00-8.00   sec   815 MBytes   815 MBytes/sec    0   1.75 MBytes       
[  4]   8.00-9.00   sec   836 MBytes   836 MBytes/sec    0   1.85 MBytes       
[  4]   9.00-10.00  sec   916 MBytes   917 MBytes/sec    9   1.42 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  8.07 GBytes   826 MBytes/sec   73             sender
[  4]   0.00-10.00  sec  8.07 GBytes   826 MBytes/sec                  receiver

iperf Done.

Interval:时间间隔

Transfer:数据包大小

Bandwidth:宽带速率

  • 以json格式输出详细信息
[root@localhost ~]# iperf3 -c 192.168.214.101 -t 1 -J
{
	"start":	{
		"connected":	[{
				"socket":	4,
				"local_host":	"192.168.214.102",
				"local_port":	54782,
				"remote_host":	"192.168.214.101",
				"remote_port":	5201
			}],
		"version":	"iperf 3.1.3",
		"system_info":	"Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64",
		"timestamp":	{
			"time":	"Fri, 22 Mar 2019 07:12:59 GMT",
			"timesecs":	1553238779
		},
		"connecting_to":	{
			"host":	"192.168.214.101",
			"port":	5201
		},
		"cookie":	"localhost.localdomain.1553238779.818",
		"tcp_mss_default":	1448,
		"test_start":	{
			"protocol":	"TCP",
			"num_streams":	1,
			"blksize":	131072,
			"omit":	0,
			"duration":	1,
			"bytes":	0,
			"blocks":	0,
			"reverse":	0
... ...

你可能感兴趣的:(Linux个人学习笔记)