Basic Dynamips Configuration Guide
Published on 2008-01-29 03:28:53.
Description
This is a simple Dynamips tutorial which guides the user from the first boot of dynamips, to setting multiple network interfaces on the router and binding them to real NICs of the host.Contents
[Hide]Content
Simple Dynamips tutorialDynamips is an emulator for Cisco's routers. It currently supports Cisco 3600 series (3620, 3640 and 3660), 3700 series (3725, 3745) and 2600 series (2610 to 2650XM, 2691).
Is it especially useful for CCNA/CCNP/CCIE training as it doesn't emulate the IOS as the rest of the training environments, it emulates the actual hardware of the router which makes it possile to boot Cisco IOS images directly.
Dynamips website: http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator
Dynamips binaries: http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator#Download
At the time of writing Dynamips 0.2.7 is the latest version.
This text assumes that you are using Linux or a platform with similar architecture.
What will follow is a bare minimum regarding dynamips's capabilities.
This text will show you how to boot a Cisco IOS image and how to set up basic networking.
For my 64bit Linux system the following applies:
$ mkdir dynamips
$ cd dynamips
$ wget http://www.ipflow.utc.fr/dynamips/dynamips-0.2.7-amd64.bin
$ ./dynamips-0.2.7-amd64.bin
Cisco Router Simulation Platform (version 0.2.7-amd64)
Copyright (c) 2005-2007 Christophe Fillot.
Build date: May 26 2007 11:55:39
Please specify an IOS image filename
Usage: ./dynamips-0.2.7-amd64.bin [options] <ios_image>
Available options:
-H <tcp_port> : Run in hypervisor mode
-P <platform> : Platform to emulate (7200, 3600, 2691, 3725 or 3745) (default: 7200)
-l <log_file> : Set logging file (default is dynamips_log.txt)
-j : Disable the JIT compiler, very slow
--exec-area <size> : Set the exec area size (default: 64 Mb)
--idle-pc <pc> : Set the idle PC (default: disabled)
--timer-itv <val> : Timer IRQ interval check (default: 1000)
-i <instance> : Set instance ID
-r <ram_size> : Set the virtual RAM size (default: 256 Mb)
-o <rom_size> : Set the virtual ROM size (default: 4 Mb)
-n <nvram_size> : Set the NVRAM size (default: 128 Kb)
-c <conf_reg> : Set the configuration register (default: 0x2102)
-m <mac_addr> : Set the MAC address of the chassis
(default: automatically generated)
-C <cfg_file> : Import an IOS configuration file into NVRAM
-X : Do not use a file to simulate RAM (faster)
-G <ghost_file> : Use a ghost file to simulate RAM
-g <ghost_file> : Generate a ghost RAM file
--sparse-mem : Use sparse memory
-R <rom_file> : Load an alternate ROM (default: embedded)
-k <clock_div> : Set the clock divisor (default: 4)
-T <port> : Console is on TCP <port>
-U <si_desc> : Console in on serial interface <si_desc>
(default is on the terminal)
-A <port> : AUX is on TCP <port>
-B <si_desc> : AUX is on serial interface <si_desc>
(default is no AUX port)
--disk0 <size> : Set PCMCIA ATA disk0: size (default: 64 Mb)
--disk1 <size> : Set PCMCIA ATA disk1: size (default: 0 Mb)
-t <npe_type> : Select NPE type (default: "npe-200")
-M <midplane> : Select Midplane ("std" or "vxr")
-p <pa_desc> : Define a Port Adapter
-s <pa_nio> : Bind a Network IO interface to a Port Adapter
-a <cfg_file> : Virtual ATM switch configuration file
-f <cfg_file> : Virtual Frame-Relay switch configuration file
-E <cfg_file> : Virtual Ethernet switch configuration file
-b <cfg_file> : Virtual bridge configuration file
-e : Show network device list of the host machine
<si_desc> format:
"device}}}}}"
<pa_desc> format:
"slot:pa_driver"
<pa_nio> format:
"slot:port:netio_type"
Available C7200 NPE drivers:
* npe-100
* npe-150
* npe-175
* npe-200
* npe-225
* npe-300
* npe-400
* npe-g1 (NOT WORKING)
* npe-g2 (NOT WORKING)
Available C7200 Port Adapter drivers:
* C7200-IO-FE
* C7200-IO-2FE (NOT WORKING)
* C7200-IO-GE-E (NOT WORKING)
* PA-FE-TX
* PA-2FE-TX (NOT WORKING)
* PA-GE (NOT WORKING)
* PA-4E
* PA-8E
* PA-4T
* PA-8T
* PA-A1
* PA-POS-OC3
* PA-4B (NOT WORKING)
* PA-MC-8TE1 (NOT WORKING)
Available NETIO types:
* unix : UNIX local sockets
* vde : Virtual Distributed Ethernet / UML switch
* tap : Linux/FreeBSD TAP device
* udp : UDP sockets
* tcp_cli : TCP client
* tcp_ser : TCP server
* linux_eth : Linux Ethernet device
* gen_eth : Generic Ethernet device (PCAP)
* fifo : FIFO (intra-hypervisor)
* null : Null device
As you can see dynamips has many options but we will focus on the very basics.
More information about the available options can be found in the README file of dynamips.
Next step is acquiring a Cisco IOS image, this will have to do on your own I'm afraid, as it would be illegal for me to provide one.
However, if you feel the need to “try before you buy” there is a “certain” distributed data sharing protocol which may be of some assistance. ;)
Now let's assume you got your hands on a Cisco IOS image, and that the image is in the “dynamips” folder we earlier created.
And let's also assume that the image's name is “c7200-jk9su2-mz.123-23.bin”.
Now we need to decompress it, dynamips can do it itself during the bootstrap process but the IOS will boot faster if the image it already decompressed.
$ unzip -p c7200-jk9su2-mz.123-23.bin > image.bin warning [c7200-jk9su2-mz.123-23.bin]: 28024 extra bytes at beginning or within zipfile (attempting to process anyway)
Now it's time to try and boot the decompressed image named “image.bin” and see if everything goes well.
My image requires a NPE400 processor and dynamips defaults to NPE200, so I added the “-t npe-400” option.
If you have an IOS image that requires a different architecture you can choose the appropriate type parameter.
$ ./dynamips-0.2.7-amd64.bin -t npe-400 image.bin
Cisco Router Simulation Platform (version 0.2.7-amd64)
Copyright (c) 2005-2007 Christophe Fillot.
Build date: May 26 2007 11:55:39
IOS image file: image.bin
ILT: loaded table "mips64j" from cache.
ILT: loaded table "mips64e" from cache.
ILT: loaded table "ppc32j" from cache.
ILT: loaded table "ppc32e" from cache.
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
C7200 instance 'default' (id 0):
VM Status : 0
RAM size : 256 Mb
IOMEM size : 0 Mb
NVRAM size : 128 Kb
NPE model : npe-400
Midplane : vxr
IOS image : image.bin
Loading ELF file 'image.bin'...
ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
ROMMON emulation microcode.
Launching IOS image at 0x80008000...
Restricted Rights Legend
Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.
[ ... blah blah blah legal Cisco stuff ... ]
cisco 7206VXR (NPE400) processor (revision A) with 245760K/16384K bytes of memory.
Processor board ID 4294967295
R7000 CPU at 150MHz, Implementation 39, Rev 2.1, 256KB L2, 512KB L3 Cache
6 slot VXR midplane, Version 2.1
Last reset from power-on
Bridging software.
X.25 software, Version 3.0.0.
SuperLAT software (copyright 1990 by Meridian Technology Corp).
TN3270 Emulation software.
[ .. some slot and bus information about the router ... ]
1 FastEthernet/IEEE 802.3 interface(s)
125K bytes of non-volatile configuration memory.
65536K bytes of ATA PCMCIA card at slot 0 (Sector size 512 bytes).
8192K bytes of Flash internal SIMM (Sector size 256K).
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: no
Press RETURN to get started!
*Jan 29 02:10:16.643: %PARSER-4-BADCFG: Unexpected end of configuration file.
*Jan 29 02:10:16.659: %LINEPROTO-5-UPDOWN: Line protocol on Interface LI-Null0, changed state to up
*Jan 29 02:10:17.127: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Jan 29 02:10:18.127: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
*Jan 29 02:10:40.039: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
*Jan 29 02:10:46.091: %SYS-5-RESTART: System restarted --
Cisco Internetwork Operating System Software
IOS (tm) 7200 Software (C7200-JK9SU2-M), Version 12.3(23), RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by cisco Systems, Inc.
Compiled Tue 24-Jul-07 21:41 by stshen
*Jan 29 02:10:46.091: %SNMP-5-COLDSTART: SNMP agent on host Router is undergoing a cold start
Router>
Great, everything worked out fine.
We can run some commands, play with the system a bit.
Router>enable Router#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Router#
Ok, this shows that we have one fast Ethernet NIC with no settings.
And, we can't really use it because it's not connected to anywhere, but it's time for that to change.
We will now bind an Ethernet NIC from our host machine to the IOS using dynamips.
From the first run of dynamips we were informed that:
-s <pa_nio> : Bind a Network IO interface to a Port Adapter
and
<pa_nio> format: "slot:port:netio_type"
so judging by the above we need something like:
-s 0:0:linux_eth:eth1
The only thing that you'd need to change is probably the “eth1” part.
Not to forget that you will probably need to run dynamips as root in order for the bind to be succesful.
Like so:
$ sudo ./dynamips-0.2.7-amd64.bin -t npe-400 -s 0:0:linux_eth:eth1 image.bin
Time for our network configuration.
Router>enable Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface fa0/0 Router(config-if)#ip address 192.168.0.10 255.0.0.0 Router(config-if)#no shutdown Router(config-if)#exit Router(config)#exit Router#show ip interface brief *Jan 29 02:42:17.759: %SYS-5-CONFIG_I: Configured from console by console Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.0.10 YES manual up up Router#
Of course you might need to adapt your network settings depending on your current network configuration.
My laptop has the IP address of 192.168.0.1 and is connected to eth1, so a ping attempt follows:
Router#ping 192.168.0.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 8/13/16 ms Router#
Hoorey! It worked.
For more networking options you can run the following:
$ sudo ./dynamips-0.2.7-amd64.bin -e Cisco Router Simulation Platform (version 0.2.7-amd64) Copyright (c) 2005-2007 Christophe Fillot. Build date: May 26 2007 11:55:39 Network device list: eth0 : no info provided wifi0 : no info provided wmaster0 : no info provided eth1 : no info provided eth2 : no info provided eth3 : no info provided any : Pseudo-device that captures on all interfaces lo : no info provided
These are the devices you can use with dynamips.
Actually, these are the devices I can use, you will obviously get a different list.
Now that you have reached this far let's see if we can push some more fast ethernet NICs into our router.
By default dynamips has only one fast ethernet NIC but it gives us the option of adding multiple NICs, not only fast ethernet but also ATM and others.
We will focus on fast ethernet NIC here though.
It's not hard to do so, we just need to append a few more arguments.
We already know that:
-p <pa_desc> : Define a Port Adapter
and
Available C7200 Port Adapter drivers: * C7200-IO-FE * C7200-IO-2FE (NOT WORKING) * C7200-IO-GE-E (NOT WORKING) * PA-FE-TX * PA-2FE-TX (NOT WORKING) * PA-GE (NOT WORKING) * PA-4E * PA-8E * PA-4T * PA-8T * PA-A1 * PA-POS-OC3 * PA-4B (NOT WORKING) PA-MC-8TE1 (NOT WORKING)
“PA-FE-TX” is the adapter we want, and the argument we need to append is:
-p 0:PA-FE-TX
“0” being the first slot, it has room for another NIC (0/1).
which will give us an extra fast ethernet NIC, two in total.
As mentioned earlier we need to bind each network card of the router to a network card of our host.
All in all we have:
$ sudo ./dynamips-0.2.7-amd64.bin -t npe-400 -p 1:PA-FE-TX -s 0:0:linux_eth:eth1 -s 0:1:linux_eth:eth0 image.bin
Router>enable Router#show ip int Router#show ip interface brief Router#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.0.10 YES NVRAM up up FastEthernet1/0 unassigned YES unset administratively down down Router#
There you go.
One more NIC ready for you.
Configuration is the same as usual.
I believe you have enough to start playing around on your own and expand what was mentioned here.
Should you have any problems please visit Haki's forum.
If you found something wrong in the above text please contact me as zapotek@segfault.gr.
If you found something you liked in this text, feel free to also contact me at the same address.