Home lab – USB network adapters for ESXi

When building (or rebuilding) a home lab, sometimes, you need to limit the size and noise and having a 42U rack is not always possible! In my case, my home lab consist of a 3 Intel NUC “cluster”.

The installation consist of a VMware vSAN cluster and one of limitation is the NUC comes only with one 1 GB network adapter. Even if it can be enough for most of the scenarios, a 2nd (or a 3rd ;)) one can be interesting.

The only option you have is to use the USB ports and some USB network adapters and that’s what I did to gave each of my NUC 2 more NICs.

I bought 6 x this package on Amazon at less than 10€ each…

When you plug one of them on your ESX (I’m running 7.0), it is recognized automatically:

100 Mbit/s??? WTF??? 🙂 Let’s check it using in the CLI!

From an SSH session, launch the command esxcli network nic list. It allows you to see the actual speed and the chipset in like in this screenshot:

Realtek USB 101001000 LAN! Let’s see if we can do something for this limited bandwidth!

The VMware office of CTO is running a cool website VMware Flings where you can find “apps and tools built by their engineers and community that are intended to be explored”. You can find a pretty interesting one for our case: https://flings.vmware.com/usb-network-native-driver-for-esxi

After downloading the “Fling” and upload it to the ESXi, you can deploy the package using the following command:

esxcli software vib install -d /ESXi700-VMKUSB-NIC-FLING-34491022-component-15873236.zip

Note: I put my package at the root of the disk (/)

After between 3 to 5 minutes, the package is install and returns this:

A reboot and voila! (Almost!!!)

1 Gbit/s, youhou! But hey! I lost my Switch config!

This is by design and because the USB network adapter are not up yet when the ESX configure the Virtual Switches. You need to reconfigure them after every reboot. Again, VMware Flings has something for us!

You need to use esxcli again to configure the virtual switch after each reboot.

To do so, you can modify the /etc/rc.local.d/local.sh script. By default this script is not doing anything, you can copy this shell script inside:

VDS_NAME="DSwitch 2-VLAN10"
VDS_PORT_ID=12

vusb1_status=$(esxcli network nic get -n vusb1 | grep 'Link Status' | awk '{print $NF}')
count=0
while [[ $count -lt 20 && "${vusb1_status}" != "Up" ]]
do
    sleep 10
    count=$(( $count + 1 ))
    vusb0_status=$(esxcli network nic get -n vusb1 | grep 'Link Status' | awk '{print $NF}')
done

if [ "${vusb1_status}" = "Up" ]; then
    esxcfg-vswitch -P vusb1 -V ${VDS_PORT_ID} "${VDS_NAME}"
fi

You need to configure:

  • VDS_NAME ===> This is the name of your Distributed Switch
  • VDS_PORT_ID ===> This is the uplink port number
  • vusb# ===> This is the network card you want to configure (I have 2, so the script configure 2 “vusb: vusb0 and vusb1)

A last reboot to verify it’s working and your set!

Enjoy!

 

2 thoughts on “Home lab – USB network adapters for ESXi

  1. Luk says:

    Hey there,

    I’m completely noob with scripting – can you port how’d you do the script for both vusb0 and vusb1?

    Thanks

    Reply
  2. Sam says:

    Hi Luk,

    You can just duplicate the script like this:

    VDS_NAME=”DSwitch 2-VLAN10″
    VDS_PORT_ID=12
    vusb1_status=$(esxcli network nic get -n vusb1 | grep ‘Link Status’ | awk ‘{print $NF}’)
    count=0
    while [[ $count -lt 20 && “${vusb1_status}” != “Up” ]]
    do
    sleep 10
    count=$(( $count + 1 ))
    vusb0_status=$(esxcli network nic get -n vusb1 | grep ‘Link Status’ | awk ‘{print $NF}’)
    done
    if [ “${vusb1_status}” = “Up” ]; then
    esxcfg-vswitch -P vusb1 -V ${VDS_PORT_ID} “${VDS_NAME}”
    fi

    VDS_NAME=”DSwitch 3-VLAN20″
    VDS_PORT_ID=14
    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

    Cheers!

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.