Computing Blogs

Finding which VM has a MAC in a VMware environment

All the info I was finding was a grepping of the VMX files (always locked/busy on my ESX6.5 environment) or needed a Windows vCenter to run a Powershell command, not available on the current VCSA.

I found this little gem at https://github.com/lamw/vghetto-scripts/blob/master/shell/vswitchInfo.sh and duplicated here (Sept 2017) in case the original goes missing…

 

# Author: William Lam
# Website: www.virtuallyghetto.com
# Product: VMware ESXi
# Description: Query MACs on internal vSwitch
# Reference: http://www.virtuallyghetto.com/2011/05/how-to-query-for-macs-on-internal.html

if [[ $# -ne 1 ]] && [[ $# -ne 4 ]]; then
echo -e “Usage: $0 -l -v [vSWITCH] -p [PORT]\n”
echo ” -l List all ports of vSwitch(s)”
echo ” -v vSwitch to query”
echo ” -p Port to query on vSwitch”
echo -e “\n\t$0 -l”
echo -e “\t$0 -v vSwitch0 -p 1234\n”
exit 0
fi

if [ ! -e /sbin/vsish ]; then
echo “Script is only supported running on an ESXi host as vsish is not available by default on ESX”
exit 1
fi

VSISH_VSWITCH_PATH=/net/portsets

if [ $# -eq 1 ]; then
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/’)
echo -e “${VSWITCH}\t${PORT}\t${MACADDRESS%%::*}\t${CLIENT}”
done
done
fi

if [ $# -eq 4 ]; then
QUERY_PATH=”${VSISH_VSWITCH_PATH}/${2}/ports/${4}/status”
echo “Querying port path: ${QUERY_PATH}”
PNICS=$(vsish -e ls /net/portsets/${2}/uplinks/ | sed ‘$!N;s/\n/ /;s/\///g’)
echo -e “pNICS for vSwitch: ${PNICS}\n”
vsish -e get “${QUERY_PATH}”
fi

Posted by admin in VMware

OK, I have not common configuration here. Always struggled with IPSEC tunnels with my previous and current Drayteks, that UK support were unable to resolve, blaming on Openreach modems etc.

With crApple withdrawing support for PPTP VPNs from iOS, I had to get my backside into gear to find a solution. Having got it working at one of bro’s sites, I starting investigating differences…

Turns out, with simultaneous routed IP and NAT’d vLANs, many things stop working, including IPSEC VPNs.  With the current range allowing more that the pathetically limited 8 IP WAN Aliases of 2920 and others from that era, there is little reason not to be using NAT even for those with up to a /27 public range (my 2860ac supports up to 32 WAN Aliases)

Posted by admin in Networking

Netgear GS724 Ports going dead

Having a few Netgear GS724T v3 switches across multiple sites, I’ve suffered constantly with ports going to sleep and occasionally not waking up when something is plugged in (or a PC in sleep coming back on).

Through much trial and error, I have a solution that appears to be working for me, and no more issues since I made the changes in Spring 2017….

 

…disable Auto Power Down in the green Ethernet settings!

I’m sure the tree hugging hippies will be up in arms over that, but tough.

Posted by admin in Networking

Various VMware related snips

Using Tape drive as SCSI passthru, rather than whole controller.

Often causes glitches such as tape drive going offline after backup etc.

Possible solution, from https://communities.vmware.com/thread/334987 is:

Verify if the tape drive is using VMW_SATP_AULA (which is bad)

SSH into esxi 5 console

esxcli storage nmp device list

naa.500110a0014b774a

Device Display Name: HP Serial Attached SCSI Tape (naa.500110a0014b774a)

Storage Array Type: VMW_SATP_ALUA

Storage Array Type Device Config: {implicit_support=on;explicit_support=off; explicit_allow=on;alua_followover=on;{TPG_id=0,TPG_state=AO}}

Path Selection Policy: VMW_PSP_MRU

Path Selection Policy Device Config: Current Path=vmhba2:C0:T0:L0

Path Selection Policy Device Custom Config:

Working Paths: vmhba2:C0:T0:L0

Note: View the Storage Array Type

To change this to VMW_SATP_LOCAL

esxcli storage nmp satp rule add --satp=VMW_SATP_LOCAL --vendor="HP" --model="Ultrium 5-SCSI"

Next you need to remove any claims to that device

esxcli storage core claiming unclaim -t location -A vmhba1 -C 2 -T 0 -L 0

(your vmbha must match!)

esxcfg-rescan vmhba1
esxcli storage nmp device list

 

Reboot esxi host

Then add your Tape via SCSI device in the VM settings

Posted by admin in VMware