Connect real switches to GNS3 using a Breakout Switch

GNS3 is an excellent tool for routers but it lacks support of switches. You can use the NM-16SW module but it’s features are nothing compared to using a real switch. If you are studying for CCNP or CCIE you are better off getting some 3550’s or 3560 switches.

Having said that it’s time to combine the best of both worlds and hook up our real switches to the GNS3 routers.

 

 

 

There are 3 options to achieve this:

 

  • Get a bunch of USB network adapters and connect each GNS3 router to a dedicated USB network adapter.
  • Get some quad-nic PCI network cards if you want to have plenty of interfaces.
  • Use the breakout switch and setup a 802.1Q trunk from your PC to your breakout switch.

 

This article is about the breakout switch. If you plan to configure this for your CCIE R&S you need about 12 connections from the GNS3 routers to your real switches. What we are going to do is setup our PC which is running Linux (Ubuntu) and take a network card that is not in use.  This network card will be configured as a 802.1Q trunk.

 

Since we have a trunk we can carry multiple vlans from our GNS3 PC to the breakout switch, every vlan is connected to a GNS3 router. First we’ll start by configuring the trunk on the GNS3 PC and add some vlans.

 

What you need:

  1. Network card which is not in use.
  2. Vconfig utility for Linux.
  3. Breakout switch, you need one that supports QinQ. 3550, 3560 or 3750 will do the trick.

 

If you are running Ubuntu or Debian you can install the vconfig utility like this:


apt-get install vlan

 

Our next task is to enable 802.1Q support:


modprobe 8021q

 

Now we will create some vlans which we will use to connect the GNS3 routers to our real switches:


vconfig add eth1 101
vconfig add eth1 102
vconfig add eth1 103
vconfig add eth1 104
vconfig add eth1 105
vconfig add eth1 106
vconfig add eth1 107
vconfig add eth1 108

 

Just to be sure disable and enable your interface again:


ifconfig eth1 down
ifconfig eth1 up

 

That’s all you have to do on your GNS3 PC, our next mission is to configure the breakout switch. We will configure an interface towards the GNS3 PC as trunk, the interfaces connected to the switches will be in different vlans where each vlan represents a different GNS3 router.

 

Configure the trunk connection on our breakout switch:


interface fastethernet0/24
switchport trunk encapsulation dot1q
switchport mode trunk

 

That’s all for the trunk connection, our next task is to connect a cable from the breakout switch to one of our real switches. We are going to configure fastethernet 0/1 on the breakout switch and connect it to fastethernet 0/1 to our “real” switch called “realswitch”.

 

These are the commands needed on the interface:

 

Using the 802.1Q tunnel will make sure our real switch will see the GNS3 router as being directly connected. All there is left for us to do is configure a router in GNS3 and connect it to the correct vlan.

In the picture above I configured the GNS3 router and connected it to the cloud interface. The cloud interface has been connected to vlan 101 on our eth1 network card.

And that’s it! We now succesfully connected our real switch to our GNS3 router. Try to configure an IP address on the GNS3 router and your real switch and they’ll be able to ping each other.

If you want to see how I did it check out this video:

Opt In Image
Do you want your CCNA or CCNP Certificate?

The How to Master series helps you to understand complex topics like spanning-tree, VLANs, trunks, OSPF, EIGRP, BGP and more.

Written by René Molenaar - CCIE #41726

You May Also Like

About the Author: Rene Molenaar

René - CCIE #41726 is the creator of GNS3Vault.com where he shares CCNA, CCNP and CCIE R&S labs. He also blogs about networking on http://networklessons.com

3 Comments

  1. I am interested in configuring a more robust lab. I was looking at the breakout switch capability, combined with with running gns3 on VMWare ESXi, and multiple nics. It has been a while since you wrote this particular setup, so what do you think?

    I am hoping to be able to run the various routers, ASAs, and possibly some “other” vendors routers.
    I don’t have tons of $$, so buying 3750s, and even 3560s is OUT. I do have some money to buy a better PC, and I already have two 3550s.

  2. It would also be good if you could update the images here. Some are missing, and you could probably (for my benefit, at least) add a few more.

    Thank you

  3. Hi Rene, is it possible that you insert a bit more comments and fix the howto above. I bought your CCNA book and try to set up a breakout switch (although it is not needed at this stage). Posted on a few different forums asking for help.

Comments are closed.