Welcome
First of all, may I welcome you to my site. My name is Chris and I'm from the UK and work as a Systems Engineer for Cisco. This blog was initially created to post up my subnetting technique but has now got more stuff to do with attaining Cisco certifications. Either way I really hope that the content is sufficent for your needs and I look forward to hearing your feedback. If you find that the content really helps you please feel free to donate using the PayPal link on the right.
To view the index of all my articles please click here.
GNS3 Configuration Guide - Linux (Fedora 9)
Thursday, 4 December 2008
I've been hearing how much better Linux is to Windows from guys across the world so I thought I would install FC9 on my home computer and promptly destroyed Windows XP. What a blessing in disguise! Now I've made the leap of faith I am one happy man although still a little green to the world of Linux.
Let's get to installing GNS3, VPCS, loopback adapter equivalent bridge interfaces etc. I'm going to do this without pictures as for the majority of the case it is exactly the same as the Windows installation. It is just the initial installation and dependencies that are required.
Note to purists: I am a Linux noob so if my terminology is out then I apologise.
Note the use of sudo here. If you haven't set it up then you can log in as root and repeat the command (without the "sudo" prefix).
1. Install PyQt4
Fedora = sudo yum -y install PyQt4
Ubuntu = sudo apt-get install PyQt4
This should install all dependencies needed for GNS3 including SIP.
2. Install tunctl and bridge-utils e.g. sudo yum -y install tunctl bridge-utils
This will now allow you to create bridged interfaces equivalent to Microsoft Loopback Adapters.
3. Download GNS3 from here. I tend to go for the tgz file.
4. Download Dynamips from the same location under the heading Associated Software. I run 32-bit only so I download the Dynamips 0.2.8-RC2 binary for Linux x86 platforms
5. Right-click the downloaded GNS3 file and choose Extract Here. Drag the Dynamips file downloaded in Step 4 to the extracted folder. Now right-click the Dynamips file and select the Permissions tab and ensure the "Allow executing file as program" box is ticked, then click Close.
6. Now double-click the gns3 file and choose Run. Assuming that all dependencies have been installed you should see GNS3 start with the screenshot in Step 3 of my GNS3 Windows guide. Follow the majority of that to set up the images and working directories plus the idlepc value.
So hopefully now you should be able to muck around with GNS3 and do most of what you need to do. However, I had one main issue and that was how do I connect my router to my local machine so that I could run syslog servers, iperf, and other apps like we do using the Loopback Adapter in Windows? Well I have to pay my respects to tuner_x at the Sadikhov IT forums for the guide on how to do this. You must run GNS3 as root in order to achieve this so for example I run:
sudo ./Chris/Desktop/GNS3-0.5-src/gns3
NOTE: If Dynamips doesn't start (you'll probably notice that you cannot connect to a hypervisor on 7200 when dragging a router onto the stage) as root then you need to either clean the working directory as it points to your user account or point the working directory to a new location.
1. If you didn't do this before you need to install tunctl and bridge-utils as outlined in Step 2 of the initial configuration guide above.
2. Now add the following to the script below so each time you switch on your PC the bridge interfaces are created.
sudo vi /etc/rc5.d/S99local
Now insert the following (note that there is no particular naming convention, just what I chose to do) and save:
# Script to create bridge interfaces. Requires tunctl and bridge-utils to be
# installed.
#
# This creates the interfaces. -t names the interface and -u sets the owner of
# of the interface.
/usr/sbin/tunctl -t fed_0 -u Chris
/usr/sbin/tunctl -t fed_1 -u Chris
/usr/sbin/tunctl -t gns3_0 -u Chris
/usr/sbin/tunctl -t gns3_1 -u Chris
# Then bring the interfaces up
/sbin/ifconfig fed_0 up
/sbin/ifconfig fed_1 up
/sbin/ifconfig gns3_0 up
/sbin/ifconfig gns3_1 up
# Now create the bridge interface
/usr/sbin/brctl addbr gns3_br0
/usr/sbin/brctl addbr gns3_br1
# Bring the bridge interfaces up
/sbin/ifconfig gns3_br0 up
/sbin/ifconfig gns3_br1 up
# Add the tap interfaces to the bridge interfaces
/usr/sbin/brctl addif gns3_br0 fed_0
/usr/sbin/brctl addif gns3_br0 gns3_0
/usr/sbin/brctl addif gns3_br1 fed_1
/usr/sbin/brctl addif gns3_br1 gns3_1
# Here is an example of how to assign an IP address to the gns3_br0 interface so one
# can ping from a GNS3 router to the local machine in order to run syslog etc
#
# ifconfig gns3_br0 inet 192.168.2.254 netmask 255.255.255.0 up
#
# I do this manually and not via the script but keep it here for reference only.
# And that's it
Now you could choose to reboot or restart the appropriate services. I tend to restart the services as it is quicker than rebooting.
sudo /etc/rc5.d/S99local restart
sudo /etc/init.d/network restart
Now add an IP address to one of your gns3 bridge interfaces. Here I am using the first:
sudo ifconfig gns3_br0 inet 192.168.2.254 netmask 255.255.255.0 up
NOTE: Do not use the same IP address as your main ISP router otherwise you'll knock out your Internet connection. D'oh! Always learn the hard way don't you Chris? LOL.
Go into GNS3 and drag a cloud, or a customised symbol, onto the stage and right-click and choose Configure. Select the "NIO TAP" tab and type the name of your bridge interface (e.g. gns3_br0) then click Add, Apply, then OK.
Hook your router up to the cloud, start the IOS, console into your router, and put the interface into the same subnet as your bridge interface. Bring the interface up and lo-and-behold you should have connectivity between your PC and your router.
What about multiple hosts? You can still use VPCS as explained in my VPCS Configuration Guide for Windows although there is a slightly different way to run it.
1. Once you have downloaded the file, extract it to your GNS3 folder.
2. Now open the extracted folder and locate the "vpcs" file (NOT vpcs.exe).
3. Right-click the vpcs file and choose the Permissions tab and tick the box next to "Execute".
4. Go to the desktop and right-click and choose Create Launcher.
5. Type = Application in Terminal
6. Name = VPCS
7. Command = the path to the vpcs file located in Step 2.
8. Comment = Virtual PCs
9. Click OK to create the launcher
10. Drag the launcher into the VPCS folder.
When you want to run VPCS just double-click on the created launcher. The configuration works just as it does in Windows.
That's it. FC9 running GNS3 exactly as I had it on Windows.
I hope it helps you Linux noobs to run GNS3.
Chris
Posted byChris Bloomfield at 13:36 3 comments
Labels: brctl, bridge-utils, dynamips, FC9, Fedora, Fedora 9, gns3, linux, tunctl, vpcs
Adding Hosts/PCs to GNS3 - VPCS Configuration Guide
Tuesday, 3 June 2008
For some time now I have been asked how I simulate hosts in GNS3 and my stock answer was to configure a router as a host by issuing the "no ip routing" command and setting a default gateway with the "ip default-gateway" command. You would also need to assign an IP address to the interface connected to the router performing routing, or a switch which in turn is connected to a router doing the routing. It worked a treat but had one major flaw, namely, CPU overhead.
I know that a lot of people tried putting loopback adapters at either end of a topology but when pinging between multiple loopback adapters the traffic stayed on the PC and would not pass through the routers configured in GNS3.
By jove though, a clever man, mirnshi I believe his name is, has devised a great little program that can simluate up to 9 hosts within GNS3. It is called VPCS and can be downloaded from here.
In my traditional style I shall run you through a step-by-step guide of configuring VPCS and show you an example of how I set up a basic topology to test the functionality.
1. Download the zip file from here and extract it to wherever desired.
2. Go to the GNS3/Dynamips directory and rename the cygwin1.dll file to cygwin1.dll.old and copy the cygwin1.dll file in the VPCS directory to this directory.
3. Open up a command prompt and change the directory to where you have the VPCS folder. If you are unsure of how to do this, go to Start-->Run and type in "cmd" (without the quotes) and hit Enter. Now using Windows Explorer go to the folder where VPCS is located and copy the location from the address bar. If you cannot see the address bar go to View-->Toolbars and click Address Bar. Now go back to the command prompt you opened and type "cd" (again, without the quotes) followed by the path to your VPCS folder. For example, I may have cd C:\Program Files\GNS3\vpcs-0.14g
An even easier way to do this in Windows XP is to download the "Open Command Prompt Here" Power Toy from here.
Once installed right-click the VPCS folder and select Open Command Prompt Here and a command prompt window will open in that directory. Windows Vista includes this ability right out of the box, it's just not immediately obvious, because it's hidden behind a shortcut key. To activate this, just hold down the Shift key when you right-click on a folder, and you should see the Open Command Window Here menu item.
4. To run VPCS type vpcs.exe from the command line and you ought to see a screenshot similar to below:
5. Type in the show command to view a printout of your virtual PCs.
6. To view the help type ?
I don't know who Mike Muuss is by the way, lol.
7. To change the IP address and default gateway to better suit your needs the following syntax prevails:
ip [ip address of PC] [ip address of default gateway] [mask in number of bits]
For example:
8. To change the virtual PC you are configuring simply enter the number of the virtual PC you wish to configure.
9. Keep adding as many PCs as you need and configure the IP addresses as desired (limited to 9).
10. Make a note of the LPORT and RPORT settings (from the show command) for each PC you have configured as you will need them for later.
Now the proof of the pudding is in the eating so what I'm going to do is connect a very simple network in GNS3 (I know this seems obvious but KEEP VPCS RUNNING):
NOTE: Each PC is a separate cloud.
11. Right-click on each cloud, choose Configure and then select the NIO UDP tab. You should now see a screen similar to the following:
12. Referring to step 10 where you noted the LPORT and RPORT values for each PC you need to add the RPORT value to the Local Port field in GNS3, the IP address 127.0.0.1 in the Remote Host field in GNS3, and finally the LPORT value in the Remote Port field in GNS3. Once you have finished this ensure that you click on the Add button and select Apply, then OK. For example if my LPORT value was 20000 and my RPORT value 30000 then I would fill it out thus:
13. Now connect your network in GNS3 end-to-end and assign IP addresses as apt to the routers. Remember to either run a routing protcol between the two routers or use static or default routes. For my purpose I used default routes on each router pointing to the other router.
For example in my IP addressing scheme I have:
PC1 to R1 Fa0/0 = 192.168.1.1/24 and 192.168.1.254/24 respectively
R1 Fa0/1 to R2 Fa0/1 = 192.168.0.1/24 and 192.168.0.2/24 respectively
R2 Fa0/0 to PC2 = 192.168.2.254/24 and 192.168.2.1/24 respectively
My default routes are:
R1: ip route 0.0.0.0 0.0.0.0 192.168.0.2
R2: ip route 0.0.0.0 0.0.0.0 192.168.0.1
My network looks like this now:
14. Go back to VPCS. Here I have tested for end-to-end connectivity by pinging from PC1 to PC2:
"So what?" I hear you cry. I know this doesn't prove whether the traffic passes over the GNS3 routers. That is where we use the tracert command in VPCS. Check it out:
Would you look at that! Hop 2 is the Fa0/1 interface of R2. Proof that the packets traverse the routers.
I must say that this is a major breakthrough for me and hopefully for others and will save a lot of time and CPU resources.
Enjoy!
Chris
Posted byChris Bloomfield at 11:09 34 comments
Labels: cygwin, gns3 dynamips, host, loopback, mirnshi, pc, vpcs