Utilize net-dvs to Troubleshoot vNetwork Distributed Switch Configurations

by admin

The net-dvs command can be used to display information about the dvSwitch configuration, which can be useful in troubleshooting situations. Can be run when logged onto the ESXi shell and will output a lot of information about the dvSwitch(es) that the host is connected to. The command displays data found in theĀ /etc/vmware/dvsdata.db file. This file is updated by the host at 5 minute intervals.

The output below shows the beginning of the output.

~ # net-dvs
switch 21 f1 2f 50 0b c2 7c 0b-50 d8 9b 26 12 ef e2 e2 (etherswitch)
        max ports: 256
        global properties:
                com.vmware.common.version = 0x 1. 0. 0. 0
                        propType = CONFIG
                com.vmware.common.alias = dvSwitch ,    propType = CONFIG
                com.vmware.etherswitch.ipv4addr = 192.168.0.222,        propType = CONFIG

The switch UUID at the top of the output can be used to determine the dvSwitch, with the name of the switch being displayed slightly further down, as highlighted in the output above. Further down, you can see information on the dvSwitch uplinks:

com.vmware.common.uplinkPorts:
                        dvUplink1, dvUplink2
                        propType = CONFIG

Other information includes CDP configuration:

 com.vmware.etherswitch.cdp = CDP, listen
                        propType = CONFIG

And port group information:

com.vmware.etherswitch.port.teaming:
                        load balancing = source virtual port id
                        link selection = link state up;
                        link behavior = notify switch; best effort on failure; shotgun on failure;
                        active =
                        standby =
                        propType = CONFIG
                com.vmware.etherswitch.port.vlan = Guest VLAN tagging
                        ranges = 0-4094
                        propType = CONFIG

The net-dvs command also displays a number of port statistics:

 com.vmware.common.port.statistics:
                        pktsInUnicast = 69508646
                        bytesInUnicast = 65839887865
                        pktsInMulticast = 1135752
                        bytesInMulticast = 248698590
                        pktsInBroadcast = 289880
                        bytesInBroadcast = 19887633
                        pktsOutUnicast = 0
                        bytesOutUnicast = 0
                        pktsOutMulticast = 0
                        bytesOutMulticast = 0
                        pktsOutBroadcast = 21
                        bytesOutBroadcast = 2332
                        pktsInDropped = 0
                        pktsOutDropped = 0
                        pktsInException = 2
                        pktsOutException = 0
                        propType = RUNTIME

You can use these statistics to determine whether the dvSwitch is sending and receiving data. The packets dropped counters may indicate that there is a problem that needs to be investigated further.

If you run ‘net-dvs -h’ you will see that it’s possible to do a lot more than display the configuration. However, as stated in the command output, using net-dvs to make configuration changes is not supported:

~ # net-dvs -h
Warning: This is an unsupported command. Use at your own risk.
net-dvs -a [ -P maxPorts] switch_name         add a new dvswitch
net-dvs -d switch_name                        delete a dvswitch
net-dvs [ -A | -D ] -p port switch_name       add/delete a port from a dvswitch
net-dvs [ -s name=value | -u name ] -p port switch_name
                                              set/unset key/value pair property for dvport
net-dvs -r name -p port switch_name          get value for dvport property specified
net-dvs -l [ switch_name ]                    list dvs information
net-dvs -i                                    init database
net-dvs [-S | -R | -G ]                       set vmkernel state from config file/reset
                                              vmkernel state/get dvs state from vmkernel
                                              to config file
net-dvs -T                                    test dvsdata
net-dvs -v "vlanID[;t|p[0-7][;min-max,min-max...]]

Keep up to date with new posts on Buildvirtual.net - Follow us on Twitter:
Be Sociable, Share!

Leave a Comment

*

Previous post:

Next post: