Moving along with our series of esxcfg & VCDX related series of posts, we come to esxcfg-vswitch. The example we’ll work with here has us setting up a new virtual switch, adding an uplink NIC, adding a port group with VLAN 393, and changing the MTU. Ready? Here we go:
- Add the vSwitch:
[root@ProfessionalVMware root]# esxcfg-vswitch –add NewSwitch
[root@ProfessionalVMware root]# esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 64 5 64 1500 vmnic0 - Add the uplink:
[root@ProfessionalVMware root]# esxcfg-vswitch –link vmnic1 NewSwitch
[root@ProfessionalVMware root]# esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 64 5 64 1500 vmnic0 - Now to add the port group & VLAN 393
[root@ProfessionalVMware root]# esxcfg-vswitch –add-pg=NewPg NewSwitch
[root@ProfessionalVMware root]# esxcfg-vswitch –vlan=393 -p NewPg NewSwitch
[root@ProfessionalVMware root]# esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 64 5 64 1500 vmnic0 - Now the MTU:
PortGroup Name VLAN ID Used Ports Uplinks
VM Network 0 0 vmnic0
Service Console 0 1 vmnic0
VMkernel 0 1 vmnic0
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
NewSwitch 64 1 64 1500
PortGroup Name VLAN ID Used Ports Uplinks
PortGroup Name VLAN ID Used Ports Uplinks
VM Network 0 0 vmnic0
Service Console 0 1 vmnic0
VMkernel 0 1 vmnic0
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
NewSwitch 64 3 64 1500 vmnic1
PortGroup Name VLAN ID Used Ports Uplinks
PortGroup Name VLAN ID Used Ports Uplinks
VM Network 0 0 vmnic0
Service Console 0 1 vmnic0
VMkernel 0 1 vmnic0
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
NewSwitch 64 3 64 1500 vmnic1
PortGroup Name VLAN ID Used Ports Uplinks
NewPg 393 0 vmnic1
[root@ProfessionalVMware root]# esxcfg-vswitch -m 123 NewSwitch
[root@ProfessionalVMware root]# esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 64 5 64 1500 vmnic0
PortGroup Name VLAN ID Used Ports Uplinks
VM Network 0 0 vmnic0
Service Console 0 1 vmnic0
VMkernel 0 1 vmnic0
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
NewSwitch 64 3 64 123 vmnic1
PortGroup Name VLAN ID Used Ports Uplinks
NewPg 393 0 vmnic1
In summary, the commands we used:
- esxcfg-vswitch –l
- esxcfg-vswitch –add
- esxcfg-vswitch –link
- esxcfg-vswitch –add-pg
- esxcfg-vswitch –vlan
- esxcfg-vswitch –m
Questions? Comments? Drop a line in the comments.