vSphere ESXI主机网络分析工具

1、net-stats

        该命令可以收集端口统计信息。可以通过net-stats -h命令显示所有标志。最常见的是使用net-stats -l来确定所有VMkernel接口、vmnic上行链路和vNIC端口的交换机端口号和MAC地址。

1.1 查看所有支持的标志

[root@localhost:~] net-stats -h

Usage:

         -l                 : List ports in system

         -a                 : Print absolute counts instead of per second counts

         -c <start>:<end>   : specify vsi-cache files instead of live kernel

         -d <level>         : verbose/debug level

         -f                 : ignore version check

         -h                 : this message

         -i <interval>      : Interval for stats collection (default=30 seconds)

         -n <iterations>    : number of iterations to run (default = 1)

         -o <outfile>       : output file

 Specify ports of interest as one of (Prioritized List of options)

         -A                 : Get stats for all ports on host

         -S <switchName>    : switch name

                 Lists stats for all non mgmt/test ports

         -N <pnicName>      : pnic name

                 List stats for all ports on switch that contains 'N'

         -V <vmname>        : VM name

                 Find switches that contains the VM's ports. Print stats for VM's ports and uplinks

         -s                 : Get storage world stats

         -I                 : Get SCSI and VSCSI storage I/O stats

         -D <name>          : Name of SCSI device/adapter/path or VM

                              To be used along with storage stat specs

                              Can be used multiple times

                              eg: net-stats -I -ta -D vmhba0 -D vmhba1

 OR specify port spec on command line

         -p <portid>        : portNum

         -t <type>          : specify a string with types of stats needed

 OR specify port spec in a config file

         -C <cfgFile>       : config file to read stats from

                 File Format: <portNum/switchName> <StatsSpec>

Stats Spec can contain one or more of these characters

                 c : Coalesce Stats: Only for vnics

                 i : Interrupt stats: Only for vmnics

                 h : Cluster and Packet size histograms

                 v : virtual nic stats

                 e : Detailed error stats

                 q : Queue Stats for port/nic

                 Q : Detailed Queue stats for the port/nic

                 f : Detailed Queue filter information for port/nic

                 W : world stats for the tx, vmnic/vmknic worlds

                 V : vcpu histograms

                 S : System time breakdown by pcpus

                 n : NIOC stats

                 p : Passthru/sriov stats

                 P : Detailed sriov/passthru stats

                 E : Enable stats collection for ENS module

                     For ENS lcore stats:

                         lcore in  : vnic tx/pnic rx

                         lcore out : vnic rx/pnic tx

                 I : IOChain InputFilters stats

                 O : IOChain OutputFilters stats

Stats Spec for Storage stats (-I)

                 d : SCSI Device Stats

                 a : SCSI Adapter Stats

                 t : SCSI Path Stats

                 s : VSCSI Stats

Note:

        net-stats reads multiple vsi nodes, one at a time, using system calls

        As data in the vsi nodes are continuously updated, there is going to

        be some inconsistency in numbers, hopefully, not a lot

         For ENS lcore stats:

                 lcore in  : vnic tx/pnic rx

                 lcore out : vnic rx/pnic tx

1.2 查看vmkernel、vNic及MAC地址等的对应关系

net-status –l

1.3 查看NetQueueReceive Side Scaling (RSS)是否被vmnic激活

net-stats -A -t vW

1.4 查看ENS module的端口状态

net-stats -A -t E

2、Pktcap-uw

        vSphere ESXi 5.5及之后版本用pktcap-uw代替了tcpdump-uw工具,tcpdump-uw工具只能捕获VMkernel接口级别的数据包。pktcap-uw工具还能捕获uplinkvSwithvnic级别的数据帧。

        从下图可以理解从虚拟机vNic到物理网卡的数据流量和抓包点:

 

        具体抓包命令请参考:ESXI主机之pktcap-uw抓包_579YOU的博客-CSDN博客_esxi 抓包

 3、NC

        NC是NetCat的缩写,是一个老式的linux命令,用来验证特定端口连接。

        例如如果要验证磁阵的iSCSI路径及端口是否可达,可以用以下命令:

nc -z <destination IP> 3260

4、Iperf

        Iperf是一个带宽工具,它用来测试源和目的地之间的最大带宽。它通常在VM内部使用,也可以在ESXI主机内部使用,它可以使用ESXi主机上的任何VMkernel接口,包括管理网路、磁阵网络、vmotion网络等。

4.1 拷贝iperf3文件

        默认情况下,ESXi不允许你在服务器模式下从shell运行iperf3,解决方式是创建一个iperf的副本:

cp /usr/lib/vmware/vsan/bin/iperf3 /usr/lib/vmware/vsan/bin/iperf3.copy

4.2 关闭防火墙

因为在默认情况下,iperf3运行在ESXi防火墙不允许的端口上。可以通过下面命令暂时关闭防火墙:一定要在之后启用ESXi防火墙!

esxcli network firewall set --enabled false

注意:测试完后要启用ESXI防火墙

esxcli network firewall set –enabled true

4.3  目的主机(server)使用iperf3绑定IP

        在目标ESXi主机上使用-s标记复制。这样做的好处是,所有的VMkernel IP都可以被使用。因此,如果需要测试管理网络,请将iperf3与管理IP绑定。vMotion网络或任何其他VMkernel接口也一样

Server (ESXi host 1):

/usr/lib/vmware/vsan/bin/iperf3.copy -s -B [IP]

4.4 源主机(client)发送连接测试请求

Client (ESXi host 2):

/usr/lib/vmware/vsan/bin/iperf3.copy -c [IP]

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

579YOU

对您有用的话给个鼓励吧!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值