ESXI6.7重启后丢失usb网卡 vswitch lose physical adapters after reboot

Chinese version

ESXI6.7重启后丢失usb网卡,导致虚拟机无法上网。

解决方法:

参考https://kzpu.com/archives/4400.html

使当前的usb网卡映射持久化,就是说,重启后usb网卡照样可以使用。可能对esxi7.0可以解决,但是6.7映射后仍然无法识别。

esxcli system module parameters set -p "$(esxcli network nic list |grep vusb |awk '{print $1 "_mac=" $8}' | awk 1 ORS=' ')" -m vmkusb_nic_fling

编辑 /etc/rc.local.d/local.sh 

思路就是,先强制添加vusb0到上行链路(名字根据实际设备修改),此时虽然后台显示正常,但是仍然无法上网,然后删除虚拟交换机的上行链路,再次添加,此时应该上网恢复正常。推测和设备初始化的顺序相关。

参考https://communities.vmware.com/t5/ESXi-Discussions/vswitch-lose-physical-adapters-after-reboot/td-p/465644

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

esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink remove --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1

fi

English version

vswitch lose physical adapters after reboot, cannot add uplink through the Esxi console

Solution:

reference https://kzpu.com/archives/4400.html

make the usb network module parameter permenent, this may help in esxi 7.0, however I failed in esxi 6.7.

esxcli system module parameters set -p "$(esxcli network nic list |grep vusb |awk '{print $1 "_mac=" $8}' | awk 1 ORS=' ')" -m vmkusb_nic_fling

I tried another solution ,it solved my problem. loging in the ssh shell, edit this file /etc/rc.local.d/local.sh . using command line to add vusb0(you can change this name according to your situation) to the vswitch, although the vswitch showed the uplink, it failed to function normally, so I deleted the uplink and added it back to the vswitch ,it worked as magic. any problem feel free to contact me by admin@datascientist.top

reference https://communities.vmware.com/t5/ESXi-Discussions/vswitch-lose-physical-adapters-after-reboot/td-p/465644

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

esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink remove --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1

fi

Leave a Reply

Your email address will not be published. Required fields are marked *