Browsed by
Tag: vswitch

Part 2 – How to list vSwitch “MAC Address table” on ESXi host?

Part 2 – How to list vSwitch “MAC Address table” on ESXi host?

The other way to list MAC addresses of open ports on vSwitches on the ESXi host is based on net-stats tool. Use this one-liner. for VSWITCH in $(vsish -e ls /net/portsets/ | cut -c 1-8); do net-stats -S $VSWITCH | grep \{\”name | sed ‘s/[{,”]//g’ | awk ‘{$9=$10=$11=$12=””; print $0}’; done This is not a final word. 🙂

0 Shares
Part 1 – How to list vSwitch “MAC Address table” on ESXi host?

Part 1 – How to list vSwitch “MAC Address table” on ESXi host?

Sometimes You need to list MAC addresses loged on host’s vSwitches to eliminate VM’s MAC address duplicates. Create a shell script: vi mac_address_list.sh Copy and past the code listed below: #!/bin/sh #vmrale for VSWITCH in `vsish -e ls /net/portsets/ | cut -c 1-8` do echo $VSWITCH for PORT in `vsish -e ls /net/portsets/$VSWITCH/ports | cut -c 1-8` do CLIENT_NAME=`vsish -e get /net/portsets/$VSWITCH/ports/$PORT/status | grep clientName | uniq` ADDRESS=`vsish -e get /net/portsets/$VSWITCH/ports/$PORT/status | grep unicastAdd | uniq` echo -e “\t$PORT\t$CLIENT_NAME\t$ADDRESS” done…

Read More Read More

0 Shares