“GNS3 is a graphical network simulator that allows simulation of complex networks.”
I was recently pointed in the direction of this app as a pretty nice graphical interface to the Dynamips / Dynagen router simulation. It still uses Dynamips / Dynagen underneath, along with Pemu (a Cisco PIX firewall emulator based on Qemu), but allows you to do graphically what you normally have to do using textual config files.
The interface is really nice and you can drag and drop in routers, create links between them, and start and stop them through the GUI. Theres no real difference from what I can see in performance etc, so many people would just turn a blind eye and figure, “Why bother, the config files are handy enough”, but it does mean you don’t have to bother with the configuration for the most part, and can just concentrate on the actual task at hand.
And the best news is it’s packaged for Ubuntu! I’m sure this is the case for other distro’s too but I haven’t checked. So all you need to do is:
sudo apt-get install gns3
You can check the documentation etc out at: http://www.gns3.net/
This is a slimmed down version of a combination of the Dynamips / Dynagen Tutorial and a few other Ubuntu specific sources. In fact, you could call it a quick and dirty guide to get you up and running. I reccommend using the Dynamips / Dynagen Tutorial once you have finished here picking up at the Running Sample Lab #1 section. I couldn’t write this better than it is there.
Dynamips and Dynagen are both in the Ubuntu repository so installation is as simple as an apt-get install. To this end run the following:
sudo apt-get install dynamips dynagen
Congratulations. That’s it for installation.
You’ll need to get yourself a Cisco IOS image for use with the emulator. Once you have one it’s generally a good idea to uncompress the image before using it as it will speed up the boot process. Use this command to do so:
unzip -p c7200-jk9s-mz.124-13b.bin > c7200-jk9s-mz.124-13b.image
Note that this will throw an error but you can safely ignore it.
Your telnet client should be correctly configured upon install. You can find the config file for this in /etc/dynagen.ini if your curious. You’ll find a line like the below uncommented which is your telnet configuration.
telnet = xterm -T %d -e telnet %h %p > /dev/null 2>&1 &
You will need a configuration file for your router(s). You can find an example one (we’ll use this example config for the rest of this guide) in /usr/share/doc/dynagen/examples/sample_labs/simple1/. We’ll use the sample1.net file from here for this guide so copy this file to wherever you have your “working directory”.
The .net file will look like this:
[localhost]
[[7200]]
image = /opt/7200-images/c7200-jk9o3s-mz.124-7a.image
npe = npe-400
ram = 160
[[ROUTER R1]]
s1/0 = R2 s1/0
[[router R2]]
# No need to specify an adapter here, it is taken care of
# by the interface specification under Router R1
So, according to the config we are running this router instance on localhost, and defines all the defaults that will be applied to any 7200 router instance we create. This makes things easy, by allowing us to specify common things like RAM size and IOS image only once.
Each of our router instances is going use an NPE-400, and be allocated 160 MB of RAM .
We are defining a virtual router instance with the ROUTER keyword. The string following this keyword is the name we are assigning to this router, in this case “R1”. This name is just the name that is used by Dynamips / Dynagen. It has nothing to do with the hostname that you assign in IOS to the router.
The s1/0 = R2 s1/0 line states that we are going to take R1’s Serial 1/0 interface, and connect it to R2’s Serial 1/0 interface (via virtual back-to-back serial cable). Dynagen automatically “installs” a PA-8T adapter in Port 1 to accommodate this connection on both R1 and R2.
We also create a 2nd router named R2. This is the same R2 that is referenced in the line above that connects R1 and R2’s serial interfaces. As the comment says we don’t need to specify an adapter here as it is taken care of by the interface specification under Router R1.
The only change we need to make to the .net file above is to change the value of “image=” to the path of your IOS image. For instance:
image = /home/$USER/ios/7200/c7200-jk9s-mz.124-13b.image
That’s all the configuration we’ll need for the moment.
Before you start the server cd into your working directory where you plan to store the information about your router(s). There are a lot of files created when starting both the server (dynamips) and console (dynagen) so best to be aware of this as they will be created in your working directory wherever you are.
To run the server (-H 7200 means on port 7200) in the background use:
dynamips –H 7200 &
You can now start your console with the command:
dynagen sample.net
At this point you are best of continuing from the Running Simple Lab #1 section of the Dynamips / Dynagen Tutorial. Good luck!
In Linux is extremely easy to change your MAC address. All you need is a couple of commands. To start off you will need to take down the interface to make the change. To do so just type the following into your terminal:
$ ifconfig eth0 down
Now we can get to changing the MAC address. To do this we use the ifconfig command again along with the hw switch, we then specify the interface name (in this case eth0). Finally we will use the hw switch to set the hardware type to ethernet and give the interface the new MAC address. All in all it should look something like this.
$ ifconfig eth0 hw eth 0a:1b:2c:3d:4e:5f
Finally we can bring up the interface and this time we will see the new MAC address.
$ ifconfig eth0 up
$ ifconfig
eth0 Link encap:Ethernet HWaddr 0a:1b:2c:3d:4e:5f
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::216:36ff:fef0:cf11/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:191682 errors:0 dropped:0 overruns:0 frame:0
TX packets:120012 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28218459 (26.9 MB) TX bytes:13230519 (12.6 MB)
Interrupt:17 Base address:0xa000
Edit (Tue Jun 16 14:41:52 IST 2009): Please note this does not work with all network cards. In some cases the drivers for a card will not support changing of a MAC address. I myself have an Eeepc 901 which has this problem with a RaLink RT2860 wireless card. I’m sure in one of the driver updates it will be included but for now I’m stuck without!