Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DevoKun/bfb5898da72050c95c5515755a4b5780 to your computer and use it in GitHub Desktop.

Select an option

Save DevoKun/bfb5898da72050c95c5515755a4b5780 to your computer and use it in GitHub Desktop.
Remove Management Interface (vmk0) from pre-existing Distributed Virtual Switch (VDS) and attached to Port Group on new Virtual Switch

Remove Management Interface (vmk0) from pre-existing Distributed Virtual Switch (VDS) and attached to Port Group on new Virtual Switch

List existing ports

esxcfg-vswitch -l
esxcli network vswitch dvs vmware list 
esxcfg-vswitch -Q vmnic0 -V ${DVS_ID_FROM_ABOVE} ${DVS_NAME}

Remove vmk0

esxcli network ip interface remove --interface-name=vmk0

Create a new vSwitch

esxcfg-vswitch -l
esxcfg-vswitch -a vSwitch1

esxcfg-vswitch -l
esxcfg-vswitch -L vmnic0 vSwitch1
esxcli network nic list
esxcfg-vswitch -l

Create the Management port group

esxcfg-vswitch -A mgmt vSwitch1
esxcfg-vswitch -l

Create vmk0 and assign to the Management port group

esxcli network ip interface list
esxcli network ip interface add --interface-name=vmk0 --portgroup-name=mgmt
esxcli network ip interface list

Configure TCP/IP on vmk0

esxcli network ip interface ipv4 set \
  --interface-name=vmk0 \
  --ipv4=10.10.10.222 \
  --netmask=255.255.255.0 \
  --type=static

esxcfg-route -a default 10.10.10.1

Tag vmk0 for use as the Management interface

esxcli network ip interface tag add -i vmk0 -t Management
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment