How to create a new GNS3 appliance template to work with SONiC using GNS3 Web UI?

STORDIS-gns3-template-webui-banner-3200x1200.png

[stordis-toc]

Introduction

GNS3 does not include SONiC. This guide shows how to add SONiC Virtual Switch (SONiC VS) as a QEMU template in the GNS3 web interface. There are other ways to add SONiC to GNS3. Refer to the links at the end of this guide.

Prerequisites


Step 1: Get the SONiC VS image

  1. Download sonic-vs.img.gz. Refer to Where to download the SONiC Virtual Switch (VS) community pre-built image?
  2. Extract the file. GNS3 needs the file sonic-vs.img, not the .gz file.
    • Windows: right-click the file and use 7-Zip > Extract Here.
    • Linux: gunzip sonic-vs.img.gz

Step 2: Open the preferences in the GNS3 web interface

In a web browser, open the IP address of your GNS3 server and log in. At the top of the page, click Go to preferences.

Go to preferences button in the GNS3 web interface


Step 3: Create the template

  1. Select QEMU in the list.

    QEMU in the preferences list

  2. Click Add QEMU VM template.

    Add QEMU VM template button

  3. Server type: select Run this QEMU VM locally.

    Server type: Run this QEMU VM locally

  4. QEMU VM name: type a name for the template, for example SONiC-VS.

    Name of the new QEMU template

  5. QEMU binary and memory: select the binary qemu-system-x86_64 and set RAM to 4096 MB.

    QEMU binary qemu-system-x86_64 and RAM 4096 MB

  6. Console type: select telnet.

    Console type telnet

  7. Disk image: select an existing image, or click New image > Browse and select sonic-vs.img from Step 1. Wait until the progress bar at the bottom of the screen is complete. Then click Add template.

    Upload of the SONiC VS disk image and the Add template button


Step 4: Configure the template

  1. Select the new template.

    New SONiC template in the list

  2. General settings: set Category to Routers and vCPUs to 2.

    General settings: category and vCPUs

  3. HDD: for HDA (Primary Master), set Disk interface to virtio.

    HDA disk interface virtio

  4. Network: set Adapters to 10, First port name to eth0 and Type to Intel Gigabit Ethernet (e1000).

    Network settings: 10 adapters, first port eth0, e1000

  5. Click Save.

The first adapter (eth0) is the management port of SONiC. The other adapters are the front ports. In SONiC VS, the port numbers go up in steps of 4:

Port in GNS3 Interface in SONiC
eth0 Management (eth0 in SONiC)
eth1 Ethernet0
eth2 Ethernet4
eth3 Ethernet8
eth4 Ethernet12
eth5 Ethernet16
eth6 Ethernet20
eth7 Ethernet24
eth8 Ethernet28
eth9 Ethernet32

Step 5: Start a SONiC node

  1. In a project, drag the template to the workspace and start the node.
  2. Open the console. The start of SONiC can take some minutes.
  3. Log in with the default user admin and the password YourPaSsWoRd.
  4. Make sure that the ports exist:

    show interfaces status

Troubleshooting

The node does not start
  • Make sure that you uploaded sonic-vs.img, not sonic-vs.img.gz.
  • Make sure that KVM is available on the GNS3 server (the GNS3 VM shows "KVM support: True").
The links in GNS3 do not match the SONiC ports

Use the table in Step 4: eth1 is Ethernet0, eth2 is Ethernet4, and so on.


Procedure completion

Congratulations!

You have successfully created a SONiC template in GNS3. Now you can use SONiC in your GNS3 network simulations.

Happy networking!

 

Useful links:

How to create a new GNS3 appliance template to work with SONiC using GNS3 Desktop Client?

How to create a new GNS3 appliance template to work with SONiC using Linux shell?

How to set up GNS3 server on VirtualBox?

 

For more free resources, visit: https://stordis.com/free-resources/

Comments 0

Articles in this section