Enabling LLDP on ESXi standard vSwitches

I developed this script based on a post by Shanon Olsson and thought it might be helpful for someone:

# get the list of ports on the vSwitch
ports=$(vsish -e "ls" "net/portsets/$switch/ports")
for p in $ports; do
    # search for the UPLINK flag on the port
    c=$(vsish -e "get" "net/portsets/$switch/ports/${p}status" | grep 'flags:.*UPLINK')
    [ -n "$c" ] && uplinks="$uplinks $p"
for u in $uplinks; do
    # enable LLDP on all the uplink ports
    vsish -e "set" "net/portsets/$switch/ports/${u}lldp/enable" 1


Some plain text.

tee /tmp/foo<<'EOF'
tee /tmp/foo<<'EOF'

More plain text.

Cisco TAR file format

I needed to upload the device manager HTML files to a Cisco switch separately because I was low on flash space. You can’t download the HTML separately from Cisco (at least not for the 2950 switch I was upgrading) so I had to make the TAR myself.

So I made up a TAR file with the usual tar -cf command and tried to load it, but got a checksum error:

Loading html.tar 
PaxHeader/html (unknown file type)  -- ignored!
%Tar checksum error in

Turns out that Cisco requires and old format TAR file (compatible with V7 UNIX.) Create the archive with tar -cof and it will work out.

PHP 5.3 database connection problems

My database scripts were all hanging after an upgrade from PHP 5.2.8 to 5.3.1 on Windows. Turns out it’s a problem with the new MySQLnd library that doesn’t like IPv6. You need to comment out the line in C:\Windows\system32\drivers\etc\hosts that resolves ::1 to localhost.

Thanks to Corey Gilmore for documenting it; I figure the more people get it online the quicker it will be for people to find it.