Moving a virtual machine from a Linux bridge to a NSX logical switch
search cancel

Moving a virtual machine from a Linux bridge to a NSX logical switch

book

Article ID: 320924

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

This article provides information on how to move a virtual machine from a Linux bridge to a NSX logical switch.

Note: This article was written based on work done with Ubuntu 14.04 / 16.04.

Environment

VMware NSX-T

Resolution

Prerequisites:

  • NSX is installed and KVM hypervisor hosts are prepared for NSX. At least one logical switch is created.
  • VM is created on a KVM hypervisor and connected to an existing Linux bridge.

Steps:

  1. Install the Ubuntu UUID package to generate UUIDs for logical ports. This can be done on any Ubuntu machine but in this example was done on the KVM hypervisor host with the command "apt-get -y install uuid".
  2. List virtual machines running on the system with the "virsh list" command to determine the VM what will be connected to the logical switch.
  3. Shutdown the VM that will be moved to the logical switch with the command.
  4. Run the "uuid" command to generate a random UUID. Save this in a text file or in your copy/paste buffer for later use.
  5. Edit the VM by running "virsh edit <vm-name>" where <vm-name is the name of the VM.
  6. Find the section for the ethernet interface of the VM. Edit it to look similar to as follows. Note that the MAC will be the MAC of the VM and will be different. Also, the UUID after "interfaceid=" should be the UUID you saved in your copy/paste buffer. The <target dev=''/> also needs to be updated with your VM name.

    <interface type='bridge'>
    <mac address='##:##:##:##:##:2e'/>
    <source bridge="nsx-managed">
    <virtualport type='openvswitch'>
    <parameters interfaceid='########-####-####-####-########2c4f'/>
    </virtualport>
    <target dev='lws-03'/>
    <model type='virtio'/>

    </interface>
     
  7. Add the logical port in NSX. If using the GUI do the following:

    Navigate to Switching --> <logical-switch-name> --> Related --> Ports --> Add
    • Name: <-- Name your port
    • Description: <-- Describe your port
    • Logical Switch: <-- Should be automatically set to the switch you edited.
    • Attachment Type: <-- VIF
    • Attachment ID: <-- Use the same UUID you used in the VM settings
  8. Use "virsh start <vm-name>" to boot your VM and attach it to the NSX logical switch. You should now be able to send L2 traffic from this VM to other VMs on the same logical switch.