Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Deploy and Manage vJunos-switch on KVM

SUMMARY Read this topic to understand how to deploy and manage the vJunos-switch instance after you install it.

This topic describes:

  • How to bring up the vJunos-switch on the KVM servers using libvirt.

  • How to choose the amount of CPU and memory, set up the required bridges for connectivity, and configure the serial port.

  • How to use relevant XML file sections for the configurations and selections listed earlier.


    Download the sample XML file and the vJunos-switch image from the Juniper website.

Set Up the vJunos-switch Deployment on the Host Server

This topic describes how to set up the vJunos-switch deployment on the host server.


This topic highlights only a few sections of the XML file that are used to deploy vJunos-switch through libvirt.

The entire XML file vjunos.xml is available for download along with the VM image and associated documentation on the vJunos Lab Software Downloads page.

Install the packages mentioned in the Minimum Software requirements section, if the packages are not already installed. See Minimum Hardware and Software Requirements

  1. Create a Linux bridge for each Gigabit Ethernet interface of the vJunos-switch that you plan to use.

    # ip link add ge-000 type bridge

    # ip link add ge-001 type bridge

    In this case, the instance will have ge-0/0/0 and ge-0/0/1 configured.

  2. Bring up each Linux Bridge.

    ip link set ge-000 up

    ip link set ge-001 up

  3. Make a live disk copy of the provided QCOW2 vJunos image.

    # cd /root

    # cp vjunos-switch-23.1R1.8.qcow2 vjunos-sw1-live.qcow2

    Make a distinct copy for each vJunos that you plan to deploy. This ensures that you do not make any permanent changes on the original image. The live image must also be writable by the userid deploying vJunos-switch—typically the root user.

  4. Specify the number of cores provided to vJunos by modifying the following stanza.

    The following stanza specifies the number of cores provided to vJunos. The minimum needed cores are 4 and are sufficient for lab use cases.

    The default number of cores needed is 4 and is sufficient for most applications. This is the minimum CPU supported for vJunos-switch. You can leave the CPU model as IvyBridge. Later generation Intel CPUs will also work with this setting.

  5. Increase the memory if needed by modifying the following stanza.

    The following example shows the default memory required by the vJunos-switch. The default memory is sufficient for most applications. You can increase the value if needed. It also shows the name of the specific vJunos-switch being spawned, which is vjunos-sw1 in this case.

  6. Specify the name and location of your vJunos-switch image by modifying the XML file as shown in the following example.

    You must provide each vJunos VM on the host with its own uniquely named QCOW2 image. This is required for libvirt and QEMU-KVM.

  7. Create the disk image.

    # ./ <juniper.conf> <config.qcow2>

    The vJunos-switch accepts an initial configuration by connecting a second disk to the VM instance that contains the configuration. Use the provided script to create the disk image.

    The XML file references this configuration drive as shown below:


    If you do not prefer initial configuration, then remove the above stanza from the XML file.

  8. Set up the management Ethernet port.

    This example allows you to connect to the VCP “fxp0” that is the management port from outside the host server on which vJunos-switch resides.

    You need to have a routable IP address configured for fxp0, either through a DHCP server or using standard CLI configuration.

    The “eth0” in the stanza below refers to the host server interface which provides connectivity to the external world and should match the name of this interface on your host server.

    If you are not using Dynamic Host Configuration Protocol (DHCP), then, after the vJunos-switch is up and running, telnet to its console and configure the IP address for “fxp0” using CLI configuration as shown below:


    The configurations below are just examples or sample configuration snippets. You might also have to set up a static route configuration.

    # set interfaces fxp0 unit 0 family inet address

    # set routing-options static route next-hop
  9. Enable SSH to the VCP management port.

    # set system services ssh root-login allow command.

  10. Create a Linux bridge for each port that you specify in the XML file.

    The port names are specified in the following stanza. The convention for the vJunos-switch is to use ge-0xy where "xy" specifies the actual port number. In the following example, ge-000 and ge-001 are the port numbers. These port numbers will map to the Junos ge-0/0/0 and ge-0/0/1 interfaces respectively. As mentioned earlier, you need to create a Linux bridge for each port that you specify in the XML file.

  11. Provide a unique serial console port number for each vJunos-switch on your host server.

    In the following example, the unique serial console port number is "8610".

    Do not modify the following smbios stanza. It tells vJunos that it is a vJunos-switch.

  12. Create vJunos-sw1 VM using the vJunos-sw1.xml file.

    # virsh create vjunos-sw1.xml

    The term "sw1" is used to indicate that this is the first vJunos-switch VM that is being installed. Subsequent VMs can be named vjunos-sw2, and vjunos-sw3 and so on.

    As result, the VM is created and the following message is displayed:

    Domain vjunos-sw1 created from vjunos-sw1.xml

  13. Check /etc/libvirt/qemu.conf and uncomment the following XML lines if these lines were commented out.

    Some examples of valid values are given below. Uncomment the specified lines.

  14. Restart libvirtd and create the vJunos-switch VM again.
    # systemctl restart libvirtd
  15. Shut down the vJunos-switch deployed on the Host Server safely (if needed). Use the # virsh shutdown vjunos-sw1 command to shutdown vJunos-switch.

    When you execute this step, a shutdown signal sent to the vJunos-switch instance allows it to shutdown gracefully.

    The following message is displayed.

    Domain 'vjunos-sw1' is being shutdown

    Do not use the “virsh destroy” command as this command can corrupt the vJunos-switch VM disk.

    If your VM stops booting after using the “virsh destroy” command, then, create a live QCOW2 disk copy of the provided original QCOW2 image.

Verify the vJunos-switch VM

This topic describes how to verify whether the vJunos-switch is up and running.

  1. Verify if the vJunos-switch is up and running.
    # virsh list
  2. Connect to the serial console of the VCP.

    You can find the port to connect to the serial console of the VCP from the XML file. Also, you can login to the serial console of the VCP through the “telnet localhost <portnum>” where portnum is specified in the XML configuration file:


    The telnet port number needs to be unique for each vJunos-switch VM residing on the host server.

  3. Disable auto image upgrade.

    If you have not supplied any initial Junos configuration in the steps above, then the vJunos-switch will, by default, attempt to DHCP for the initial network setup.

    If you don't have a DHCP server that can supply the Junos configuration, you can get repeated messages as shown below:

    "Auto Image Upgrade"

    You can disable these messages as follows:

  4. Verify if the ge interfaces specified in your vJunos-switch xml file are up and available. Use the show interfaces terse command.

    For example, if the vJunos-switch XML definition file specifies two virtual NICs connected to "ge-000" and "ge-001", then ge-0/0/0 and ge-0/0/1 interfaces should be in the link "up" state when you verify using the show interface output command as shown below.

  5. Verify that a vnet inetrface under each corresponding "ge" bridge is configured. Use the brctl command on the host server, after you start the vJunos-switch as shown below: