VyOS on GNS3

From VyOS Wiki
Jump to: navigation, search

VyOS can be used in a GNS3 environment, this guide will provide the steps necessary for installing and setting up VyOS on GNS3.

Prerequisites

The following items are required:

VM setup

First, a virtual machine (VM) for the VyOS installation must be created in GNS3: Start the QEMU VM wizard to create a new VM with the following details:

  • Select the server type. Normally 'Run this Qemu VM on the GNS3 VM' is the right choice.
  • Enter a name for the VM, for example 'VyOS'
  • Select 'qemu-system-x86_64 as QEMU binary and 512MB of RAM.
  • Select VNC as console type.
  • Create a new disk image, use the 'Create' button to start the image creator wizard:
- Use the defaults in the next two dialogs ('binary and format' and 'qcow2 options')
- Set 'VyOS.qcow2' as file location and the disk size to 2000MB.
- Finish the QEMU image creator wizard.
  • Finish the QEMU VM creation wizard.

Now the VM settings have to be edited:

  • General settings tab - Set the boot priority to 'HDD or CD/DVD-ROM'

Vyos-initial-general settings.png


  • CD/DVD tab - Browse for the VyOS installation image: (Note: the image will be uploaded automatically to the GNS3 VM)

Vyos-initial-cd dvd.png


  • Network tab - Set the number of adapters to '0':

Vyos-initial-network.png


  • Advanced settings tab - Unmark the checkbox 'Use as a linked base VM':

Vyos-initial-advanced settings.png


Save the changes and exit the VM's preferences.

VyOS installation

Create a new project and drag the newly created VyOS VM into it then start the VM and open a console, the VNC console should open and show the boot screen. Follow the VyOS installation guide to install VyOS on the VM. After a successful installation shutdown the VM:

$ poweroff

In GNS3 right-click on the VyOS VM, select 'Configure' and set the console type to 'telnet'. Now start the VM and open a console, a telnet console should open, showing the GRUB menu:

Vyos-telnet-boot.png

Select the entry 'Serial console', boot VyOS and login.

Edit GRUB settings

To automatically boot with the Serial console enabled, the GRUB settings must be edited:

$ sudo vi /boot/grub/grub.cfg

Set the default to '1' and optionally disable 'Press ESC to enter the Grub menu' message and the 5 second timeout by commenting the relevant lines:

# Generated by /opt/vyatta/sbin/vyatta-grub-setup at Sun Sep 17 08:42:56 UTC 2017
set default=1
set timeout=5
serial --unit=0 --speed=9600
terminal_output --append serial

#echo -n Press ESC to enter the Grub menu...
#if sleep --verbose --interruptible 5 ; then
        terminal_input console serial
#fi

Now shutdown the VM with

$ poweroff

and delete the VM from the GNS3 project. The 'VyOS.qcow2' file now contains a working VyOS image and can be used and backed up as a template or further modified for regular usage as outlined in the following part.

VyOS VM configuration

To turn the template into a working VyOS machine, further steps are necessary as outlined below:

  • General settings tab - Set the boot priority to 'HDD' and the console type to 'telnet', optionally set a router symbol and category:

Vyos-final-general settings.png


  • HDD tab - Set the disk interface to SCSI to speed up the boot process:

Vyos-final-hdd.png


  • CD/DVD tab - Optionally unmount the installation image file by clearing the 'image' entry field:

Vyos-final-cd dvd.png


  • Network tab - Set the number of required network adapters, for example '4' and the name format to 'eth{0}':

Vyos-final-network.png


  • Advanced settings tab - Mark the checkbox 'Use as a linked base VM':

Vyos-final-advanced settings.png

Save the changes and exit the VM's preferences. The VyOS VM is now ready to be deployed, further information on how to configure VyOS can be found in the Quick Start Guide and the User documentation.

Source / Acknowledgement

This guide is based on Bernhard Ehlers' 'GNS3 - Create a VyOS VM' blog entry which is located at: https://www.bernhard-ehlers.de/blog/2017/09/17/gns3-create-vyos-vm.html