zoukankan      html  css  js  c++  java
  • MySQL Hardware--网络测试

    使用Ping测试丢包

    ## ping测试
    ## -c 100表示100次
    ping -c 100 192.168.1.2

    输出结果:

    ping -c 100 192.168.1.2

    PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
    64 bytes from 192.168.1.2: icmp_seq=1 ttl=61 time=0.061 ms
    ....
    64 bytes from 192.168.1.2: icmp_seq=100 ttl=61 time=0.053 ms

    --- 192.168.1.2 ping statistics ---
    100 packets transmitted, 100 received, 0% packet loss, time 99014ms  ## 0% packet loss表示丢包率
    rtt min/avg/max/mdev = 0.052/0.059/0.120/0.013 ms  ## 表示最小延迟/平均延迟/最大延迟/标准差延迟

    使用iperf测试带宽

    安装包地址:https://pkgs.org/download/iperf

    命令帮助问答:http://man.linuxde.net/iperf

    服务端开启服务:

    ## 服务端开启服务
    iperf -s

    客户端开始测试:

    ## 客户端测试命令
    iperf -c 192.168.1.102 -t 10 -i 2 -d -m 

    服务端输出结果:

    iperf -s
    ------------------------------------------------------------
    Server listening on TCP port 5001
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    [  4] local 192.168.1.102 port 5001 connected with 192.168.1.101 port 6079
    ------------------------------------------------------------
    Client connecting to 192.168.1.101, TCP port 5001
    TCP window size: 19.3 KByte (default)
    ------------------------------------------------------------
    [  6] local 192.168.1.102 port 4110 connected with 192.168.1.101 port 5001
    Waiting for server threads to complete. Interrupt again to force quit.
    [ ID] Interval       Transfer     Bandwidth
    [  6]  0.0-10.0 sec  4.10 GBytes  3.52 Gbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  4]  0.0-10.0 sec  10.6 GBytes  9.11 Gbits/sec

    客户端输出结果:

    iperf -c 192.168.1.102 -t 10 -i 2 -d -m 
    ------------------------------------------------------------
    Server listening on TCP port 5001
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    ------------------------------------------------------------
    Client connecting to 192.168.1.102, TCP port 5001
    TCP window size: 19.3 KByte (default)
    ------------------------------------------------------------
    [  5] local 192.168.1.101 port 6079 connected with 192.168.1.102 port 5001
    [  4] local 192.168.1.101 port 5001 connected with 192.168.1.102 port 4110
    [ ID] Interval       Transfer     Bandwidth
    [  5]  0.0- 2.0 sec  2.14 GBytes  9.21 Gbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  2.0- 4.0 sec  2.13 GBytes  9.15 Gbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  4.0- 6.0 sec  2.14 GBytes  9.20 Gbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  6.0- 8.0 sec  2.09 GBytes  8.99 Gbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  8.0-10.0 sec  2.10 GBytes  9.01 Gbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  0.0-10.0 sec  10.6 GBytes  9.11 Gbits/sec
    [  5] MSS size 1460 bytes (MTU 1500 bytes, ethernet)
    [ ID] Interval       Transfer     Bandwidth
    [  4]  0.0- 2.0 sec  0.00 Bytes  0.00 bits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  4]  2.0- 4.0 sec  0.00 Bytes  0.00 bits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  4]  4.0- 6.0 sec  0.00 Bytes  0.00 bits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  4]  6.0- 8.0 sec  0.00 Bytes  0.00 bits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  4]  8.0-10.0 sec  0.00 Bytes  0.00 bits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  4]  0.0-10.0 sec  4.10 GBytes  3.52 Gbits/sec
    [  4] MSS size 1460 bytes (MTU 1500 bytes, ethernet)

    测试结果:Bandwidth约为9.10 Gbits/sec,实际网卡也是万兆网卡。

    命令参数说明:

    -s 以server模式启动。#iperf -s
    -c host以client模式启动。host是server端地址。#iperf -c serverip
    
    通用参数:
    -f [kmKM] 分别表示以Kbits, Mbits, KBytes, MBytes显示报告,默认以Mbits为单位,#iperf -c 192.168.100.6 -f K
    -i sec 以秒为单位显示报告间隔,#iperf -c 192.168.100.6 -i 2
    -l 缓冲区大小,默认是8KB,#iperf -c 192.168.100.6 -l 64
    -m 显示tcp最大mtu值
    -o 将报告和错误信息输出到文件#iperf -c 192.168.100.6 -o ciperflog.txt
    -p 指定服务器端使用的端口或客户端所连接的端口#iperf -s -p 5001;iperf -c 192.168.100.55 -p 5001
    -u 使用udp协议
    -w 指定TCP窗口大小,默认是8KB
    -B 绑定一个主机地址或接口(当主机有多个地址或接口时使用该参数)
    -C 兼容旧版本(当server端和client端版本不一样时使用)
    -M 设定TCP数据包的最大mtu值
    -N 设定TCP不延时
    -V 传输ipv6数据包
    
    server专用参数:
    -D 以服务方式运行。#iperf -s -D
    -R 停止iperf服务。针对-D,#iperf -s -R
    client端专用参数:
    -d 同时进行双向传输测试
    -n 指定传输的字节数,#iperf -c 192.168.100.6 -n 1024000
    -r 单独进行双向传输测试
    -t 测试时间,默认20秒,#iperf -c 192.168.100.6 -t 5
    -F 指定需要传输的文件
    -T 指定ttl值
    
    原文:https://blog.csdn.net/shenzhen206/article/details/72820341 

    使用ethtool查看网卡信息

    查看基本信息

    ethtool eth0
    Settings for eth0:
        Supported ports: [ FIBRE ]
        Supported link modes:   10000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: No
        Advertised link modes:  10000baseT/Full 
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Speed: 10000Mb/s
        Duplex: Full
        Port: Other
        PHYAD: 0
        Transceiver: external
        Auto-negotiation: off
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000007 (7)
                       drv probe link
        Link detected: yes

    查看网络丢包:

    ## –S ethX    //查询ethX网口收发包统计
    ethtool -S eth0 |grep crc

    使用iftop查看网络流量

    下载包地址:https://pkgs.org/download/iftop

    执行命令:

    ## 查看网卡eth0的流量
    iftop -i eth0 -P
    

     输出结果信息:

    中间的<= =>这两个左右箭头,表示的是流量的方向。
    TX:发送流量
    RX:接收流量
    TOTAL:总流量
    Cumm:运行iftop到目前时间的总流量
    peak:流量峰值
    rates:分别表示过去 2s 10s 40s 的平均流量

    使用iptraf查看网络流量(推荐)

    iptraf能图像化显示每个链接的详细信息和网卡汇总信息。

    yum安装: yum -y install iptraf

    使用netstat查看网络状态信息

    ## 常用参数
    ## -a或--all:显示所有连线中的Socket;
    ## -n或--numeric:直接使用ip地址,而不通过域名服务器;
    ## -o或--timers:显示计时器;
    ## -p或--programs:显示正在使用Socket的程序识别码和程序名称;
    
    netstat -anop
  • 相关阅读:
    10.19JDBC之DBCP连接池的使用
    计时器Timer介绍
    Silverlight3.0 起步(一)——环境
    javascript 类
    RhinoMock入门(6)——安装结果和约束
    RhinoMock入门(4)——次序和委托
    javascript 表达式、括号、常用函数和jquery库怎么样实现的分析
    CSP加密服务(一)
    RhinoMock入门(5)——属性,方法和方法选项
    RhinoMock入门(7)——Do,With和Recordplayback
  • 原文地址:https://www.cnblogs.com/gaogao67/p/10747598.html
Copyright © 2011-2022 走看看