Provision the NetScaler VPX instance by using the virsh program

The virsh program is a command line tool for managing VM Guests. Its functionality is similar to that of Virtual Machine Manager. It enables you to change a VM Guest’s status (start, stop, pause, and so on), to set up new Guests and devices, and to edit existing configurations. The virsh program is also useful for scripting VM Guest management operations.

To provision NetScaler VPX by using the virsh program, follow these steps:

  1. Use the tar command to untar the the NetScaler VPX package. The NSVPX-KVM-*_nc.tgz package contains following components:

    • The Domain XML file specifying VPX attributes [NSVPX-KVM-*_nc.xml]
    • Check sum of NS-VM Disk Image [Checksum.txt]
    • NS-VM Disk Image [NSVPX-KVM-*_nc.raw]

    Example:

    tar -xvzf NSVPX-KVM-10.1-117_nc.tgz
    NSVPX-KVM-10.1-117_nc.xml
    NSVPX-KVM-10.1-117_nc.raw
    checksum.txt
    
  2. Copy the NSVPX-KVM-*_nc.xml XML file to a file named <DomainName>-NSVPX-KVM-*_nc.xml. The <DomainName> is also the name of the virtual machine. Example:

    cp NSVPX-KVM-10.1-117_nc.xml NetScaler-VPX-NSVPX-KVM-10.1-117_nc.xml
    
  3. Edit the <DomainName>-NSVPX-KVM-*_nc.xml file to specify the following parameters:

    • name— Specify the name.
    • mac— Specify the MAC address. Note: The domain name and the MAC address have to be unique.
    • sourcefile— Specify the absolute disk-image source path. The file path has to be absolute. You can specify the path of the RAW image file or a QCOW2 image file.
      If you want to specify a RAW image file, specify the disk image source path as shown in the following example:

              Example:           <name>NetScaler-VPX</name>                 <mac address=’52:54:00:29:74:b3’/>                 <source file=’/root/NSVPX-KVM-10.1-117_nc.raw’/>

              Specify the absolute QCOW2 disk-image source path and define the driver type as qcow2, as           shown in the following example:

              Example:           <name>NetScaler-VPX</name>                 <mac address=’52:54:00:29:74:b3’/>                 <driver name =’qemu’ type=’qcow2’/>                 <source file=’/root/NSVPX-KVM-10.1-117_nc.qcow’/>

  4. Edit the <DomainName>-NSVPX-KVM-*_nc.xml file to configure the networking details:

    • source dev— specify the interface.
    • mode— specify the mode. The default interface is Macvtap Bridge.

    Example: Mode: MacVTap Bridge Set target interface as ethx and mode as bridge Model type as virtio

      <interface type='direct'>
          <mac address='52:54:00:29:74:b3'/>
          <source dev='eth0' mode='bridge'/>
          <target dev='macvtap0'/>
          <model type='virtio'/>
          <alias name='net0'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </interface>
    

    Here, eth0 is the physical interface attached to the VM.

  5. Define the VM attributes in the <DomainName>-NSVPX-KVM-*_nc.xml file by using the following command: virsh define <DomainName>-NSVPX-KVM-*_nc.xml Example:

    virsh define NS-VPX-NSVPX-KVM-10.1-117_nc.xml
    
  6. Start the VM by entering following command: virsh start [<DomainName> <DomainUUID>] Example:
    virsh start NetScaler-VPX
    
  7. Connect the Guest VM through the console virsh console [<DomainName> <DomainUUID> <DomainID> ] Example:
    virsh console NetScaler-VPX
    

Add additional interfaces to NetScaler VPX instance using virsh program

After you have provisioned the NetScaler VPX on KVM, you can add additional interfaces.

To add additional interfaces, follow these steps:

  1. Shut down the NetScaler VPX instance running on the KVM.
  2. Edit the <DomainName>-NSVPX-KVM-*_nc.xml file using the command: virsh edit [<DomainName> <DomainUUID>]
  3. In the <DomainName>-NSVPX-KVM-*_nc.xml file, append the following parameters:
    1. For MacVTap

      • Interface type— Specify the interface type as ‘direct’.
      • Mac address— Specify the Mac address and make sure the MAC address is unique across the interfaces.
      • source dev— Specify the interface name.
      • mode— Specify the mode; the modes supported are - Bridge, VEPA, Private, and Pass-through
      • model type— Specify the model type as virtio

      Example:

      Mode: MacVTap Pass-through

      Set target interface as ethx, Mode as bridge, and model type as virtio

      <interface type='direct'>
            <mac address='52:54:00:29:74:b3'/>
            <source dev='eth1' mode='passthrough'/>
            <model type='virtio'/>
       </interface>
      

      Here eth1 is the physical interface attached to the VM.

    2. For Bridge Mode

      Note: Make sure that you have configured a Linux bridge in the KVM host, bound the physical interface to the bridge, and put the bridge in the UP state.

      • Interface type— Specify the interface type as ‘bridge’.
      • Mac address— Specify the Mac address and make sure the MAC address is unique across the interfaces.
      • source bridge— Specify the bridge name.
      • model type— Specify the model type as virtio

      Example: Bridge Mode

      <interface type='bridge'>
            <mac address='52:54:00:2d:43:a4'/>
            <source bridge='br0'/>
            <model type='virtio'/>
       </interface>
      

Provision the NetScaler VPX instance by using the virsh program