Monday, 10 April 2023

ESXI - Automate bindings

 See these commands:






My final script: /etc/rc.local.d/local.sh

VDS_NAME="WAN"
VDS_PORT_ID=0
vusb0_status=$(esxcli network nic get -n vusb0 | grep 'Link Status' | awk '{print $NF}')
count=0
while [[ $count -lt 20 && "${vusb0_status}" != "Up" ]]
do
    sleep 10
    count=$(( $count + 1 ))
    vusb0_status=$(esxcli network nic get -n vusb0 | grep 'Link Status' | awk '{print $NF}')
done
if [ "${vusb0_status}" = "Up" ]; then
    esxcfg-vswitch -P vusb0 -V ${VDS_PORT_ID} "${VDS_NAME}"
fi




Note: to get PORT_ID -> this is your VLAN ID for the switch you want add the uplink:



No comments:

Post a Comment