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

STORDIS-gns3-template-desktop-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 desktop client. 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 New template wizard

  1. Start the GNS3 desktop client.
  2. Click File > New template.

    File menu with the New template item in the GNS3 desktop client


Step 3: Create the template

  1. Select Manually create a new template and click Next.

    Manually create a new template option

  2. In the list on the left, select Qemu VMs. Then click New at the bottom of the window.

    Qemu VMs list and the New button

  3. Type a name for the template, for example SONiC-VS. Click Next.

    Name of the new QEMU template

  4. Select the QEMU binary qemu-system-x86_64 and set RAM to 4096 MB. Click Next.

    QEMU binary qemu-system-x86_64 and RAM 4096 MB

    The version number of the binary (for example v4.2.1) depends on your GNS3 server. Any version of qemu-system-x86_64 is correct.

  5. For Console type, select telnet. Click Next.

    Console type telnet

  6. Select an existing disk image, or click New Image > Browse and select sonic-vs.img from Step 1. Wait until the upload is complete. Then click Finish.

    Selection of the SONiC VS disk image


Step 4: Configure the template

  1. In the device toolbar on the left, click the icon shown below. Right-click the new template and select Configure template.

    Configure template in the context menu of the new template

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

    General settings tab: category Routers and 2 vCPUs

  3. HDD tab: set Disk interface to virtio.

    HDD tab: disk interface virtio

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

    Network tab: 10 adapters and first port name eth0

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: Apply the changes

Click OK at the bottom of the window.


Step 6: 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 Web UI?

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