GNS3 and VirtualBox Integration Under OS X - Part 1

Get it from www.bitsontheline.com, give my highest respect to the author.
=======

GNS3 and VirtualBox Integration Under OS X - Part 1

This tutorial will show you how to create a virtual network using GNS3 with virtual clients running under VirtualBox, finally I will show you how to connect the virtual network to the Internet.

The diagram below shows the network we are going to build during this tutorial, everything in the diagram is virtual, created using free, open source software. For the two clients I have chosen to use Windows XP and Ubuntu for some diversity, but both could be Linux should you choose. By the end of this tutorial you will have enough knowledge to extend the virtual network and create more complex virtual topologies.

GNS3

Resources
This tutorial will require the following resources:

TunTap Drivers for OS X
GNS3
A Cisco IOS
VirtualBox
Ubuntu

Step 1. Install the TunTap Drivers
Download and install the TunTap drivers. After installation go to an OS X terminal, enter cd /dev and type ls. You should see listed a number of tap interfaces ranging from tap0 to tap15, these interfaces will allow us to integrate resources into our virtual network. Later on we will assign 3 of these tap interfaces an IP address, but first we need to create our GNS3 project.

Step 2. Create a New GNS3 Project
For GNS3 to use the tap interfaces it must be running as root, open a terminal window and issue the following command:
sudo chown root:wheel /Applications/GNS3.app/Contents/Resources/dynamips-0.2.8-RC2-OSX-Leopard.intel.bin
To keep things organised we are going to create a new GNS3 project to store the GNS3 configuration file and our router configs. In GNS3 click File and New Project and choose a location for your new project, ideally inside its own folder, click save. Ensure the two check boxes are checked and click ok.

This tutorial will use a Cisco 2610XM for which a valid IOS will be required, Josh over at Blindhog has written an excellent tutorialwhich guides you through locating a Cisco IOS. Locate an IOS, save it to your computer and use the IOS Images and Hypervisorspanel in GNS3 to associate it with a router model. We can now start building our virtual network.

Step 3. Build the Virtual Network
Drag a 2600 Router from the list of nodes onto the blank canvas, right click the router and choose Configure. Choose the Slots tab from the Node Configurator panel and add an NM-4E module into slot 2, click ok.

Drag two Ethernet Switches and place them to the left of the router, using the Add Link tool drag a link from SW0 Port 1 to R0 e1/0, then SW1 Port 1 to R0 e1/1. We now need to add 3 cloud symbols to connect our virtual network to our tap interfaces.

Drag a cloud symbol from the nodes panel and place it to the left of SW0, right click the cloud and choose Configure. Click the NIO Tap tab and enter /dev/tap1 into the text box, then click Add. Drag another cloud from the node panel and place it to left of SW1, right click and choose Configure, click the NIO Tap tab and enter /dev/tap2 into the text box and click Add. These two cloud symbols will connect our VirtualBox machines into our virtual network. However, we still need another cloud symbol to connect our virtual network to the Internet.

Drag a third cloud symbol from the nodes panel and place it to the right of R0, configure the NIO Tap setting with /dev/tap0. Using the Link Tool connect the clouds to the network as follow:

C0 nio_tap:/dev/tap1 to SW0 Port 2
C1 nio_tap:/dev/tap2 to SW1 Port 2
C1 nio_tap:/dev/tap0 to R0 f0/0

This is how the virtual network should now look:
GNS3

Before we boot up the router, lets assign our tap interfaces an IP address. Open a Terminal window in OS X and issue the following commands:
sudo ifconfig tap0 10.100.100.100 netmask 255.255.255.0
sudo ifconfig tap1 172.16.10.2 netmask 255.255.255.0
sudo ifconfig tap2 172.16.20.2 netmask 255.255.255.0
We have now assigned our tap interfaces IP addresses that will be in the same range as our virtual network segments, verify the tap interfaces with the following:
MacBook:~ Matt$ ifconfig
tap1: flags=8843 mtu 1500
inet 172.16.10.2 netmask 0xffffff00 broadcast 172.16.10.255
ether 5e:8d:3e:41:09:b1
open (pid 2256)
tap2: flags=8843 mtu 1500
inet 172.16.20.2 netmask 0xffffff00 broadcast 172.16.20.255
ether 62:7d:93:7b:ed:34
open (pid 2256)
tap0: flags=8843 mtu 1500
inet 10.100.100.100 netmask 0xffffff00 broadcast 10.100.100.255
ether 2a:8a:ad:a6:25:95
open (pid 2256)
For good measure test each tap interface with a ping:
MacBook:~ Matt$ ping 172.16.10.2
PING 172.16.10.2 (172.16.10.2): 56 data bytes
64 bytes from 172.16.10.2: icmp_seq=0 ttl=64 time=0.050 ms
64 bytes from 172.16.10.2: icmp_seq=1 ttl=64 time=0.207 ms
64 bytes from 172.16.10.2: icmp_seq=2 ttl=64 time=0.124 ms

That’s the end of Part 1, in Part 2 we will configure the router and ensure OS X can route traffic from our virtual network to the Internet. Stay tuned.

Matt
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章