Nutanix AHV: Enable VLAN Trunk Mode on Guest VM

Nutanix AHV Enable Trunk Mode on Guest VM

Sometime we need to enable the special feature(s) on virtual Machine- guest VM, most rare one is: How-to enable / disable / change the VM’s VLAN Mode to Trunk mode on guest VM ( Windows / Linux VM ) hosted on Nutanix AHV cluster. That is the very rare request i received to enable VLAN Mode Trunk mode on Nutanix AHV guest VM hosted on Nutanix AHV cluster.

I am sure the most of the techie guys don’t know about this feature Nutanix AHV VLAN Trunk Mode on guest VM that is really available in Nutanix AHV hypervisor in acli command line CLI.

To enable / disable / change the VLAN Mode to trunk mode on any guest VM ( Windows / Linux / appliance ) hosted on Nutanix AHV hypervisor is very easy through command line CLI only.

before going to enable / disable / change the VM VLAN Mode to trunk / access mode in Nutanix AHV lets know what is this.

Read also: Evacuate \ Remove Nutanix AHV ESXI Node from Cluster

What is Trunk mode

A trunk port is capable of having more than one VLAN set up on the interface whereas access port is capable of having one VLAN set up on interface. In trunk mode the port is being tagged with VLAN whereas in access mode, the port is been in untagged mode.

In short: A Trunk mode allows multiple VLANs through single physical / virtual interface. Physical interface is connected to hardware server while Virtual interfaces is connected to guest VM or virtual entity.

Enable Trunk Mode on Physical Switch

Before enable the trunk mode on VM, the trunk mode must be enabled on Physical switch interfaces which is connecting Nutanix Nodes.

I taking the example of Cisco switch to enable the trunk mode on interface gig0/1, execute following command to enable the trunk mode:

Switch1# interface gig0/1
switchport encapsulation dot1q
switchport mode trunk ( Note : Enable Trunk Mode )
switchport trunk native vlan 10 ( optional )
switchport trunk allowed vlan 10,20,30 ( Note: Specify the VLANs to allow through Trunk mode )

Switch2# interface gig0/1
switchport encapsulation dot1q
switchport mode trunk ( Note : Enable Trunk Mode )
switchport trunk native vlan 10 ( optional )
switchport trunk allowed vlan 10,20,30 ( Note: Specify the VLANs to allow through Trunk mode )

I have taken the two switch ( Switch1 and Switch2 ) example because in production environment, it recommended to use 2 switches for failover redundancy.

Read also: Cross Hypervisor Migration To-from Nutanix AHV

Enable Trunk mode on Nutanix AHV

Nutanix AHV uses the OVS ( Open Virtual switch ) Software defined network ( SDN ) software to achieve the networking functionality with high performance on network layer as well.

Nutanix AHV: the OVS Bridge’ bond is by default configured in Auto negotiation mode– it means if Physical switch interface ( which is connected to Nutanix node ) is configured on Access / Trunk mode, Nutanix bond change the its configuration in respect of that.

So there is no need on Nutanix AHV to change the bond interface Access / Trunk mode manually, Nutanix AHV does it automatically, depends on Physical switch interface configuration.

Read also: Nutanix AHV: Windows VM Kernel Memory dump

VM Trunk Mode Use Cases

There could be few use cases to enable the trunk mode on Windows / Linux VM which is hosting on Nutanix AHV, lets explore them

Nutanix AHV Guest VM trunk mode Use Cases list:

  • If you wan to use single vNIC for pass all VLAN
  • If you using Aruba OS Wireless appliances, need trunk mode
  • Packet sniffing for all VLANs
  • Don’t want to Map multiple vNIC to VM its creates complexity
  • etc.

Enable Trunk Mode On Guest VM

Now lets comes on the main topic: To enable / disable / change the VLAN Mode to Trunk / Access on guest VM hosted on Nutanix AHV hypervisor, i know you have been waiting for that. lets explore the commands:

Step 1: Login to any Nutanix CVM in the Nutanix AHV cluster

Step 2: Get the vNIC property of the Windows / Linux VM

cvm$ acli vm.nic_get < VM_Name>

Output similar like:

cvm$ acli vm.nic_get My-VM

50:6b:8d:8e:5a:20 {
mac_addr: "50:6b:8d:8e:5a:20" --> Copy mac address to notepad
network_name: "Production"
network_type: "kNativeNetwork"
network_uuid: "62180df7-77c6-4857-853b-6dab569da6e4"
type: "kNormalNic"
uuid: "69582229-264d-480a-be6a-f16529d6d7c3"
vlan_mode: "kAccess" ----> vNIC is now in Access Mode

Step 3: Run Following command to Enable / change the VLAN Mode from Access to Trunk Mode on VM

cvm$ acli vm.nic_update <VM_Name> <vNIC_Mac_Address> network=<Virtual-Network-Name> vlan_mode=kTrunk trunk_networks=<VLAN_IDs-With-comma) update_vlan_trunk_info=true
Example:
cvm$ acli vm.nic_update My-VM 50:6b:8d:df:74:72 network=Production vlan_mode=kTrunk trunked_networks=10,20,30 update_vlan_trunk_info=true

Step 4: Check the vNIC property of the Windows / Linux VM

cvm$ acli vm.nic_get <VM_Name>

Output similar as:

 cvm$ acli vm.nic_get My-VM

50:6b:8d:8e:5a:20 {
mac_addr: "50:6b:8d:8e:5a:20"
network_name: "Production"
network_type: "kNativeNetwork"
network_uuid: "62180df7-77c6-4857-853b-6dab569da6e4"
trunked_networks: 10
trunked_networks: 20
trunked_networks: 30
type: "kNormalNic"
uuid: "69582229-264d-480a-be6a-f16529d6d7c3"
vlan_mode: "kTrunked" ----> Enabled the Trunk Mode
Enable VLAN Trunk Mode

Read also: Top 10 Nutanix Acropolis AHV Commands – Part 1

Disable / Change the Trunk Mode

If you want to disable / change the VLAN Mode of VM from Trunk Mode to Access Mode on Nutanix AHV, you can do it easily to run following command on Nutanix AHV cluster similarly to above steps:

cvm$ acli vm.nic_update My-VM 50:6b:8d:df:74:72 network=Production  vlan_mode=kAccess update_vlan_trunk_info=true

Output Similar As:

cvm$ acli vm.nic_get My-VM

50:6b:8d:8e:5a:20 {
mac_addr: "50:6b:8d:8e:5a:20"
network_name: "Production"
network_type: "kNativeNetwork"
network_uuid: "62180df7-77c6-4857-853b-6dab569da6e4"
type: "kNormalNic"
uuid: "69582229-264d-480a-be6a-f16529d6d7c3"
vlan_mode: "kAccess" ---> Changed it to Access Mode

Nutanix AVH support both type of VLAN Mode= Access / Trunk as per your need you change chooce any one for you guest VM.

Read also: Nutanix Move Migration Guide ?

Conclusion

Nutanix AHV supports VLAN mode to enable / disable and/or change the VLAN mode from-to Trunk / Access Mode on guest VM ( Windows / Linux ). Nutanix AHV supports most useful networking features with simplicity through SDN – OVS network stack with high performance network throughput on 1Gig / 10Gig / 20Gig and 40Gig as of now and working on 100Gig technology.

if you have any query or question you can write in comments.!

Thanks to being with HyperHCI Tech Blog to stay tuned.