Today I’m going to show you how to break GNS3 out of your virtual world into the real world of the internet.
- Build, Design and Test your network in a risk-free virtual environment and access the largest networking community to help. Whether you are studying for your first networking exam or building out a state-wide telecommunications network, GNS3 offers an easy way to design and build networks of any size without the need for hardware.
- How to install GNS3 with VirtualBox and use Cisco IOS images - this video shows you. Use nested virtualization with VirtualBox and run Cisco VIRL IOS images.
Looks like you're using an older browser. To get the best experience, please upgrade. UPGRADE MY BROWSER.
GNS3 is a great resource for anyone who needs access to live Cisco gear but doesn’t have the money to purchase the hardware. You can create complete network topologies in the isolated safety of the lab. You can configure Network Address Translation (NAT), setup a DMZ with a Cisco ASA and even configure DHCP servers to offer IP addresses to VirtualBox clients.
All of this takes place in an sandbox environment. In other words, there’s no way you can injure your real network because all the activity is confined to the lab. Most of the time this is exactly what you want but sometimes you may need to connect your virtual computer to the real world.
Wouldn’t it be nice if you could setup a PC such as Windows XP in VirtualBox? Then connect it to virtual switch which is connected to a virtual Cisco route? And finally configure IP routing in such a way that your Windows XP machine can actually surf the web through all that virtualized gear?
That’s what I’m going to show you how to do today.
There are a few elements we need to setup but if you follow me closely I’ll show you how to open the door to getting online. The best part is that none of the servers online will have any idea that your client machine is communicating with it from an entirely virtual environment.
The secret to getting online
I’m about to let you in on a little secret. The magic that allows your virtual machines to get online through your virtual equipment is based on a virtual adapter called TunTap.
Every client machine has one or more network adapters. For example, my Macbook Air has a Wireless LAN adapter (en0) that lets me associate with a wireless access point. But I also have a physical USB-to-Ethernet adapter. When I plug this little dongle into my USB port I can attach an Ethernet plug and then get on the wired network.
TunTap is a little peice of software that allows you have to have multiple logical adapters. You can assign IP addresses to these adapters and generally use them for testing. By default, the TunTap adapter can’t really do anything useful by itself. But I’m about t show you how we can bridge the TunTap adapter with our real wireless adapter so that we can have a virtual bridge to get online.
If all this sounds a little confusing now don’t worry – I’ll clarify as you read.
For now, let’s just start from the beginning and get TunTap.
Go to http://tuntaposx.sourceforge.net/ and download and install TunTap. After installing the package, open a Terminal Window (Command + Space type “terminal“)
You should see a bunch of interfaces. If so, bingo you’re good to go.
By the way, you might wonder why you can’t just type:
and search for the interface there. The reason is because the tap interfaces won’t show up until you assign the interface in GNS3. Sounds weird I know which is why it can cause a lot of confusion.
We’re going to assign the GNS3 interface next.
Assigning the tap interface in GNS3
After installing GNS3, we need to run it as the root user so it can create the first tap interface, tap0. This requires root access therefore GNS3 must be running as root for it work.
To run tap0 as root type:
Great, now drag out a new cloud from the devices list in the left pane, right click it and choose Configure.
Expand the cloud group in the left pane then choose the NIO TAP tab in the right pane.
Under TAP interfaces (require root access) type:
Click Add and then choose OK. By the way, if you don’t click Add it won’t work – I’ve made this mistake many times.
Alright, now drag out a network device like an Ethernet Switch and then click the Add a link button in the bottom left corner of the GNS3 window to connect any port on your Switch to the nio_tap:/dev/tap0 interface of your cloud.
The act of connecting this link causes GNS3 to create logical tap0 interface on your Mac.
For example, if you type ifconfig now you’ll see a new tap0 interface hanging out at the bottom of your interface list.
This is huge progress because it now means we can connect our Mac to GNS3.
Let me show you what I mean…
Assign an IP address to the tap0 interface:
Now drag out a GNS3 router and connect it to the Ethernet switch you created earlier.
Right click and Start the router and choose Idle-PC. We’re going to want a value with a checkmark next to it. This little step guarantees that the router won’t eat up all your CPU resources while it’s running.
Once you set the Idle-PC value, double click the router and press enter until you get to the R1# prompt.
We need to put the interface connected to the switch in the same subnet as the tap0 interface. You can check which interface to configure by expanding your R1 device in the topology summary pane. It’s located alone the right side of GNS3.
Here we go:
The top window in the graphic the result of assigning 10.0.0.2/24 to the tap0 interface on my Mac. And the bottom window shows the successful ping to 10.0.0.2 from my virtual router’s fa0/0 interface assigned to 10.0.0.1/24.
Great.
Now that we know tap0 works, we can bridge it to our real interface, which is en0 on my Mac.
Now we need to assign an IP address on your real network to the bridge interface. I find the easiest way to do this is to simply use DHCP. That way you’ll automatically get an unassigned IP address and there’s no need to worry about conflicting IPs on your real network.
Of course if that doesn’t work you can always manually assign a free IP address too.
Where each x represents each decimal value of your IP address and the y is the number of bits in your subnet mask.
You should now be able to ping your bridge0 ip address from R1.
The next step is setting up your default route on R1.
If you do a show ip route you’ll see there’s no default route. This means if R1 sees a packet destined for a network that it doesn’t have in its routing table it’ll simply discard it. But we don’t want that. By default, R1 should route any less specific routes to the internet out your default gateway through your bridge0 interface. So let’s change that.
Back on R1, type:
This says: “For any packet not in my routing table route it through my default gateway on my real live network at 192.168.0.1′
Now configure R1’s fa0/1 interface to have the IP address of the bridge id.
In the final step, you can configure NAT/PAT on R1 so that the internal network (10.0.0.0/24 in my example) get’s translated to your “global” address on the 192.168.0.0/24 subnet.
First you can create an access list for all the hosts insides your network. Let’s say all your hosts inside the GNS3 network are on the 10.0.0.0/24 subnet you would type the following on R1:
This just sets up the rule to match all the hosts on your internal network.
Then go to your inside interface and type:
Then go to your external interface and type
Now setup the translation rule:
That should do the trick.
Alternatively, another way to get your router out to the internet is to:
- Disable your Wi-Fi adapter
- Plug in the Mac to the network using your Ethernet adapter
- Type ifconfig to get your adapter name: en0, en1 etc…
- Launch GNS3 as root, create a cloud and under the settings for that cloud in the NIO Ethernet tab, choose your Ethernet adapter from the drop down list
- Connect R1 to the cloud using the Add a link tool
- Make the interface connecting R1 to the cloud get an IP from DHCP.
- config t
- int fa0/0
- ip address dhcp
- do ip domain-lookup
- end
This will force the router to get an IP address from the cloud and should let you get out.
I hope this helps. I know this tutorial was a little sloppy and might seem confusing. If so, just leave a comment or shoot me and email and I can help you with the finer details.
This tutorial explains how install and import Cisco IOS in GNS3 step by step with practical examples. In order to use any Cisco device such as router and switch in GNS3, we must have to install that device’s IOS first. Learn how to install, configure and use Cisco IOS in GNS3 in detail.
Since Cisco IOSs are protected by copyright laws, GNS3 does not include any Cisco IOS in default installation. It only provides a platform to use Cisco IOS but it does not provide any Cisco IOS itself. It means, in order to use any Cisco device in GNS3, we must have to install that device’s IOS first. This tutorial explains how to install necessary Cisco device’s IOS in GNS3.
Downloading Cisco IOS
In order to install Cisco device in GNS3, we must have to obtain its IOS file. There are several sources from where we can obtain this file. We can get it from real Cisco device, or can download it from Cisco’s official site (it requires a valid Cisco account and license agreement) or can download it from educational sites. If none of these work for you, simply search following term in Google.
You may check this site http://tfr.org/cisco/. It contains the largest collection of Cisco IOSs. I found this site through Google search. It may be may not be working at this moment.
Regardless how you obtained the IOS file, installation process is same for all.
Installing and importing Cisco IOS in GNS3
For this tutorial I assume that GNS3 is installed and configured.
To learn how to install and configure GNS3, check this tutorial
It explains how to install and configure GNS3 step by step with practical example.
Download the IOS file
Open GNS3 and click Edit file menu and from sub-menu click Preferences
Navigate to Dynamips -> IOS routers option in left pane and click New button in right pane
Select New Image option and click Browse button. Now select the downloaded IOS image file
By default IOS files are compressed. GNS3 supports both compressed and decompressed format.
Keep the compressed format
Verify that correct file is selected and click Next button
If selected IOS belongs to an outdated device, wizard may display a warning message.
In real life, using an outdated device is not recommended. Since GNS3 uses a real Cisco IOS, it also follows the same recommendation and warns us about the outdated IOS. If we are going to use this device only for CCNA exam preparation or to get some hands on experience on Cisco IOS, we can ignore this message.
Now wizard extracts the hardware information (platform and chassis number) form selected IOS file and lists it in next screen along with an automatically populated device name.
If extracted information does not match with device, select the correct platform and chassis number from drop down. If require, you may also adjust the device name.
Verify / adjust the information and Click Next button to continue
Next screen allows us set the RAM size for this device. By default wizard automatically allocates the minimum recommended memory (RAM) for device. But if require, we can adjust it to match with our specific requirement.
If selected IOS belongs to a modular device, next screen allows us to install the interfaces in available slots.
Select appropriate interfaces and click Next button.
Just like interfaces slots, if selected IOS belongs to a device which has WIC modules, next screen allows to install the WIC interface in WIC slots.
Select the desire WIC interface and click Next button
Next screen allows us to put a limit on CPU usage by this IOS. We should always specify this value. This value prevents a faulty or buggy IOS from consuming entire CPU cycles. Once this value is configured, GNS3 does not allow IOS from consuming CPU beyond this limit.
Click Idle-PC finder button and use the suggested value in this field.
Click Finish button to close the wizard
Managing IOS files
All installed IOS files can be managed from the same option.
All installed files are listed in the right pane of Dynamips -> IOS routers option. Select the file which you want to manage. Once IOS file is selected, control options will be highlighted in the bottom section. There are four control options
Gns3 For Mac P30download
New: -
this option is used to install the new IOS file. If no installed IOS file is selected, only this option will be highlighted.
Decompress: -
This option allows us to decompress the selected IOS file.
Cisco Images For Gns3 For Mac
Edit: -
This option allows us to update the configuration values which we used while installing it. All configuration values are listed in right section of the pane.
Delete: -
This option allows us to delete the selected IOS file.
How to use installed device from IOS
Once IOS file is successfully installed in GNS3, belonging device will be available in Installed appliances box. For example, in this tutorial we installed an IOS file which belongs to 2600 series router. To use it, click Routers icon from left pane and select Installed appliances from drop down box. It will list all installed devices. To use the device, drag it in workspace.
That’s all for this tutorial. For any feedback, suggestion or comment about this tutorial, simply mail me. If you like this tutorial, share it with your friends.