[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
- The GNS3 desktop client, connected to a GNS3 server. Refer to How to install and configure GNS3 Desktop Client (Windows / Linux / Mac)?
- 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 New template wizard
Step 3: Create the template
-
Select Manually create a new template and click Next.
-
In the list on the left, select Qemu VMs. Then click New at the bottom of the window.
-
Type a name for the template, for example
SONiC-VS. Click Next. -
Select the QEMU binary
qemu-system-x86_64and set RAM to 4096 MB. Click Next.The version number of the binary (for example v4.2.1) depends on your GNS3 server. Any version of
qemu-system-x86_64is correct. -
For Console type, select telnet. Click Next.
-
Select an existing disk image, or click New Image > Browse and select
sonic-vs.imgfrom Step 1. Wait until the upload is complete. Then click Finish.
Step 4: Configure the template
-
In the device toolbar on the left, click the icon shown below. Right-click the new template and select Configure template.
-
General settings tab: set Category to Routers and vCPUs to 2.
-
HDD tab: set Disk interface to virtio.
-
Network tab: set Adapters to 10, First port name to
eth0and Type to Intel Gigabit Ethernet (e1000).
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
- 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 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
Comments
Please sign in to leave a comment.