[root@hostname:~] esxcfg-vswitch -b vSwitch0
listen
[root@hostname:~]esxcfg-vswitch -B both vSwitch0
[root@hostname:~] vsish
/> cd /net/portsets/vSwitch0
/net/portsets/vSwitch0/>
/net/portsets/vSwitch0/> ls
ports/
overlays/
uplinks/
vlans/
isResvSupported
netEventChain
type
enableDetailedStats
mtu
unlink
link
destroy
properties
stats
niocPendingVms/
niocNoResvPorts/
niocPendingVnics/
niocPendingPorts/
/net/portsets/vSwitch0/> cd /net/portsets/vSwitch0/ports/
/net/portsets/vSwitch0/ports/> ls
33554433/
33554434/
33554435/
33554436/
33554437/
33554438/
/net/portsets/vSwitch0/ports/>
/net/portsets/vSwitch0/ports/> get 33554433/status
/net/portsets/vSwitch0/ports/> get 33554434/status
/net/portsets/vSwitch0/ports/> cd 33554434/lldp/
/net/portsets/vSwitch0/ports/33554434/lldp/> typels enable
VSI_BOOL
/net/portsets/vSwitch0/ports/33554434/lldp/> get enable
0
/net/portsets/vSwitch0/ports/33554434/lldp/> set enable 1
/net/portsets/vSwitch0/ports/33554434/lldp/> get enable
1
/net/portsets/vSwitch0/ports/33554434/lldp/>
VSISH_VSWITCH_PATH=/net/portsets
for vSwitch in $(vsish -e ls ${VSISH_VSWITCH_PATH});
do
VSWITCH=$(echo ${vSwitch} | sed 's/\///g')
for port in $(vsish -e ls ${VSISH_VSWITCH_PATH}/${vSwitch}ports);
do
PORT=$(echo ${port} | sed 's/\///g')
PORTINFO=$(vsish -e get ${VSISH_VSWITCH_PATH}/${vSwitch}ports/${port}status | sed 's/^[ \t]*//;s/[ \t]*$//');
CLIENT=$(echo ${PORTINFO} | sed 's/ /\n/g' | grep "clientName:" | awk -F ":" '{print $2}')
MACADDRESS=$(echo ${PORTINFO} | sed 's/ /\n/g' | grep "unicastAddr:" | uniq | sed 's/unicastAddr://;s/\(.*\)./\1/')
vmnics=$(echo -e "${PORT}\t${CLIENT}" | grep vmnic | awk '{ print $1 }')
for i in $vmnics;
do
vsish -e typels /net/portsets/vSwitch0/ports/$i/lldp/enable
vsish -e set /net/portsets/vSwitch0/ports/$i/lldp/enable 1
done
done
done
After your vSwitches have all vmnics configured with LLDP, you can now check with Network Teams(or you own teams) the ports/interfaces connections.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (1)
Author
Commented:I have more articles waiting to be approved.
I will change the images, but this "new" tool to write articles is not very good.