[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
- A GNS3 server that operates. Refer to How to set up GNS3 server on VirtualBox?
- The SONiC VS image (refer to Step 1).
- Basic knowledge of networks and of GNS3.
Step 1: Get the SONiC VS image
- Download
sonic-vs.img.gz. Refer to Where to download the SONiC Virtual Switch (VS) community pre-built image? - Extract the file. GNS3 needs the file
sonic-vs.img, not the.gzfile.- 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.
Step 3: Create the template
-
Select QEMU in the list.
-
Click Add QEMU VM template.
-
Server type: select Run this QEMU VM locally.
-
QEMU VM name: type a name for the template, for example
SONiC-VS. -
QEMU binary and memory: select the binary
qemu-system-x86_64and set RAM to 4096 MB. -
Console type: select telnet.
-
Disk image: select an existing image, or click New image > Browse and select
sonic-vs.imgfrom Step 1. Wait until the progress bar at the bottom of the screen is complete. Then click Add template.
Step 4: Configure the template
-
Select the new template.
-
General settings: set Category to Routers and vCPUs to 2.
-
HDD: for HDA (Primary Master), set Disk interface to virtio.
-
Network: set Adapters to 10, First port name to
eth0and Type to Intel Gigabit Ethernet (e1000). - 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
- In a project, drag the template to the workspace and start the node.
- Open the console. The start of SONiC can take some minutes.
- Log in with the default user
adminand the passwordYourPaSsWoRd. -
Make sure that the ports exist:
show interfaces status
Troubleshooting
- Make sure that you uploaded
sonic-vs.img, notsonic-vs.img.gz. - Make sure that KVM is available on the GNS3 server (the GNS3 VM shows "KVM support: True").
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
Comments
Please sign in to leave a comment.