Dec 14 2009

A Virtual Cisco Router on your Network

Published by at 9:10 pm under Cisco,Linux

Dynamips and dynagen let you create a virtual Cisco router on a Linux box. It would be even better if that router was reachable from the LAN, wouldn’t it? Going further, that same router could lead us to another couple of virtual routers running in a lab.

Download and Installation

Download dynamips and dynagen from Pay attention Dynagen last version 0.11.0 requires Dynamips 0.2.8-RC2.
The 2 programs are provided as rpm packages for Redhat/Fedora.
On other Linux systems such as Debian or Ubuntu, Dynagen is provided as an archive you can extract and from which dynagen can be linked from a bin directory of yours. As for Dynamips, it needs to be taken out from the rpm. You can also download it from
You may get an error while running dynamips:

[root@cisco_host]$ dynamips -h
dynamips: error while loading shared libraries: cannot open shared object file: No such file or directory

[root@cisco_host]$ ln -s /usr/lib/ /usr/lib/

A symbolic link should sort things out.

Install Network Utilities

The 2 following tools are needed:
– brctl from bridge-utils package (on all Linux flavours) – to create a bridge
– tunctl from rpmfind for Redhat/Fedora and uml-utilities for Debian/Ubuntu – to create a tap interface. This isn’t absolutely needed since dynagen can create a tap interface on its own but is definately handy.

Create Bridge and Connect to the Network

Bridge br0 will be made up of the eth1 interface connected to the LAN and tap0 linked to the Cisco router. is the Linux box IP.

[root@cisco_host]$ brctl addbr br0
[root@cisco_host]$ ifconfig br0 up
[root@cisco_host]$ ifconfig eth1
[root@cisco_host]$ brctl addif br0 eth1
[root@cisco_host]$ ifconfig br0 netmask up

Virtual Cisco Router Configuration File

Create the following Dynagen configuration file. You will need to copy your own Cisco image on your server as this is proprietary indeed. This is where we map the Cisco f0/0 interface to tap0.

workingdir = /tmp

    [[ 7200 ]]
    image = /root/c7200-js-mz.124-3.bin
    ram = 128
    idlepc = 0x6082c30c

    [[ router R1 ]]
    console = 2001
    f0/0 = NIO_tap:tap0

I suggest you check dynagen tutorial to find out what’s your your best idlepc value so you do not get your CPU load rise to 100%. We can then launch Dynamips hypervisor and Dynagen to run the virtual router.

[root@cisco_host]$ dynamips -H 7200&
[1] 2347
[root@cisco_host]$ Cisco Router Simulation Platform (version 0.2.8-RC2-x86)
Copyright (c) 2005-2007 Christophe Fillot.
Build date: Apr 20 2008 12:25:53
Hypervisor TCP control server started (port 7200).

[root@cisco_host]$ dynagen
Reading configuration file...

Shutdown in progress...
Shutdown completed.
Network successfully loaded

Dynagen management console for Dynamips and Pemuwrapper 0.11.0
Copyright (c) 2005-2007 Greg Anuzelli, contributions Pavel Skovajsa


Adding the Cisco Router to the Bridge

tap0 has now been created by Dynagen and can now be brought up and added to the bridge.

[root@cisco_host]$ brctl addif br0 tap0
[root@cisco_host]$ ifconfig tap0 up

Connect to the Router

Connect on the router with telnet on port 2001 – as set in the configuration file earlier – and experience the console as if you were on a real Cisco router IOS.

[root@cisco_host]$ telnet localhost 2001
router#show interface summary

 *: interface is up
 IHQ: pkts in input hold queue     IQD: pkts dropped from input queue
 OHQ: pkts in output hold queue    OQD: pkts dropped from output queue
 RXBS: rx rate (bits/sec)          RXPS: rx rate (pkts/sec)
 TXBS: tx rate (bits/sec)          TXPS: tx rate (pkts/sec)
 TRTL: throttle count

  Interface              IHQ   IQD  OHQ   OQD  RXBS RXPS  TXBS TXPS TRTL
* FastEthernet0/0          0     0    0     0     0    0     0    0    0
  FastEthernet0/1          0     0    0     0     0    0     0    0    0
NOTE:No separate counters are maintained for subinterfaces
     Hence Details of subinterface are not shown

router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
router(config)#int fa0/0
router(config-if)#ip address
router(config-if)#no shutdown


Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/11/16 ms

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/20/36 ms being the gateway or a device on the LAN.
You can now virtualize as many Cisco routers as you wish, within the limits of your machine’s resources.

One response so far

One Response to “A Virtual Cisco Router on your Network”

  1. Makison 25 Aug 2014 at 12:49 am


    very good article… My problem is that ping is not working…

    It is pinging normally the br0 interface (from inside the router) but no luck when I am trying to ping an external host..

    The external host is pingable from the local host (I mean in the same server but outside the router)

    Any ideas?

Comments RSS

Leave a Reply