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:
- Network card which is not in use.
- Vconfig utility for Linux.
- 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:
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: