Skip to content

SONiC VS on GNS3

Prepare SONiC Image and sonic GNS3 appliance file

Build SONiC VS

bash
git clone https://github.com/Azure/sonic-buildimage.git
cd sonic-buildimage.git
make init
make configure PLATFORM=vs
make target/sonic-vs.img.gz

After build, the zipped vs image will under target directory.

Prepare VS disk image and gns3 appliance file.

extract the zipped vs image "sonic-vs.img.gz" to "sonic-vs.img" and keep original file.

bash
gzip -dc sonic-vs.img.gz > sonic-vs.img

The gns3 appliance generate script is under platform/vs, copy it to target and change mode to excutable

bash
cp ../platform/vs/sonic-gns3a.sh .
chmod +x sonic-gns3a.sh

Run script to create gns3 appliance file

Usage:

bash
sonic-gns3a.sh [ -r <ReleaseNumber> ] -b <SONiC VS image: sonic-vs.image>

Example:

bash
sonic-gns3a.sh -r 1.1 -b <store_path>/sonic-vs.image
bash
./sonic-gns3a.sh -r 1.1 -b sonic-vs.img

When done, a appliance file will be generated. ex: "SONiC-1.1.gns3a"

GNS3

Install GNS3

GNS3 GitHub Release page

Here we run a GNS3 server on remote.

Connect to Remote Server

  1. Run the GNS3

  2. When first run the GNS3, it will ask how the gns3 server be running. Since we are run gns3 on a remote VM, here we pick "Run on a remote server"

  1. Fill with the server information.

  1. After setting, reopen GNS3

Import sonic appliance

  1. Prepare the gns3 appliance file and vs image on same directory.

  2. Run the GNS3 and click New template to create a new appliance

  1. Here we will use generated gns3a file, so select "Import an appliance file"

  1. Select the vs gns3a file from file dialog.

  1. Just click Next to start install the appliance

  1. Select the qemu binary to run this appliance.

  1. GNS3 will find the related fils, if all found, click Next to install.

  1. Chack the usage message.

  1. After installed, the SONiC 1.1 will appear on GNS3 list.

Create simple topology with sonic vs

Put appliance

Use mouse drag to put appliance to topology.

  1. Click the "Add link" on toolbar

  1. Click on node, and pick the interface

Start all nodes

Login in to sonic

Show Interface Status

Show LLDP Neighbor

Connect to real word

The "Cloud" will bridge to a real interface The "NAT" will bridge to a private network which provide by gns3

Add link to cloud, and select the interface wich you want to bridge on.

Now the sonic can mgmt port can get IP from real world and can be access.

Add Ubuntu Applience

The gns3 can support difference type applience like docker or qemu.

Here I will run ubuntu on docker.

Download the Ubuntu docker applience link.

Install the appliance same as sonic vs.

Now we have a virtual lab for testing.

Right-click on a link, and select "Start capture"

Check the file name which packet trace will save to.

The packet will shows on wireshark.

Let the project can keep running after exit.

File->"Edit project"

Select "Start the capture visualization program"

Change Image

  • Need extend the VM memory. (default is 2G)

    sonic-installer install [image file or URL]

After done, need reboot the system.

The new installed image will shows on GRUB menu

Reference

  1. SONiC vs Platform
  2. GNS3 GitHub Release page
  3. GNS3 Appliances Marketplace

GNS3 Tutorial