How To Setup a Cisco CME (Cisco Manager Express) Virtual Router under Linux using dynamips and dynagen

1.) Install dynagen and dynamips

2.) Also configure your bridge or br0

If you don't have a br0 on your Linux machine then follow this guide or video for Debian:

Alternatively you can use NIO_linux_eth:eth0 for f0/0 below but remember the host machine cannot talk to the router then.

3.) Create your dynagen config

Save the file below to something.conf


#Example config:

 autostart = False
[127.0.0.1:2000]
workingdir = /home/mint/router
udp = 10100
[[7200]]
image = c7200-adventerprisek9-mz.151-4.M.bin
disk0 = 256
#idlepc = 0x60be916c
[[ROUTER r1]]
model = 7200
console = 2521
aux = 2119
#wic0/0 = WIC-1T
#wic0/1 = WIC-1T
#wic0/2 = WIC-1T

#instead youcould use f0/0=NIO_linux_eth:eth0 but your host would not have communication with the router


f0/0 = nio_tap:tap1
x = 22.0
y = -351.0

4.) Start dynamips

sudo dynamips -H 2000&

5.) Start your router

dynagen yourconffromstep3.conf

6.) Connect to your router and configure

telnet localhost 2521

enable
conf t
int fa0/0
ip address 192.168.5.1 255.255.255.0
no shut

7.) Test connectivity

Make sure you put your tap1 on the bridge and put up tap1.  After this you should be able to ping your router but remember your host's br0:0 should be created and be on the same subnet to work.

sudo brctl addif br0 tap1

sudo ifconfig tap1 up

Performance Tuning

I recommend you set calculate and set idlepc, as a wrong value or no value will guarantee it will use at least ~100% of the CPU core dynamips is on.  Check this guide here to set idlepc for dynamips with dynagen

 

How do you configure CME guide/tutorial?

 

Helpful Dynagen and Dynamips Startup Script

This script as it is will get your r1 and r2 router up without typing any commands.  All you have to do is change the .conf file name to your own and make sure to save the contents of the script to an "something.sh", chmod +x something.sh and then ./something.sh and it will automatically get you going.  It also kills any other instances of dynamips or dynagen to avoid conflicts.  The only thing it does need is sudo so it will ask for your sudo password.

Remember that you need "expect" installed or this script will not work (use apt install expect or yum install expect).


The script makes a few assumptions but you can of course change it.

1.) Dynamips is to be started on port 2000 if not change it!

2.) That you want to create two tap devices "tap1" and "tap2" and add them to your bridge br0

3.) It also assumes you are in the directory of "yourconffile.conf" in bold in the script below.  Change that name to the name of yours

4.) Finally it also assumes that you have routers r1 and r2 that you want to be started automatically in the send "start r1\n" area.  You can add more lines for more routers or change the names according to your needs.

#!/bin/bash
sudo killall dynamips dynagen
sudo dynamips -H 2000 &

sudo ip tuntap add tap1 mode tap
sudo ip tuntap add tap2 mode tap
sudo brctl addif br0 tap1
sudo brctl addif br0 tap2

sudo ifconfig tap1 up
sudo ifconfig tap2 up

expect <(cat <<'EOD'
spawn dynagen yourconffile.conf
expect "Dynagen management console for Dynamips"
send "start r1\n"
send "start r2\n"
interact
exit
EOD
)


Tags:

cisco, cme, virtual, router, linux, dynamips, dynagenexample, config, autostart, workingdir, mint, udp, adventerprisek, mz, bin, disk, idlepc, console, aux, wic, nio_tap,

Latest Articles

  • CentOS 7 / 8 cannot boot with with mdadm RAID array solution
  • How To Add Default Gateway in Linux using the ip route command routing
  • Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist Solution for Centos8 yum package install error
  • md mdadm array inactive how to start and activate the RAID array
  • Loaded: masked (Reason: Unit hostapd.service is masked.) Solution in Linux Debian Mint Ubuntu
  • Linux Mint Ubuntu Ubiquity Installer Bug EFI Installed To Wrong Partition Solution
  • Libreoffice Impress How To Change The Color of Links
  • ecryptfs How To Backup / Migrate Linux Mint Ubuntu Debian system ecryptfs properly and restore access
  • i915 nouveau Nvidia GPU not starting lightdm Xorg failing solution for Could not determine valid watermarks for inherited state
  • br0: received packet on bond0 with own address as source address Linux Solution Mint Debian Redhat CentOS bridge bridging
  • Debian Mint Ubuntu Howto Disable Network Manager
  • AMD GPU Xorg Won't Start [3576284.324] (EE) Segmentation fault at address 0x0 [3576284.325] (EE) Fatal server error: [3576284.325] (EE) Caught signal 11 (Segmentation fault). Server aborting
  • symbol 'grub_calloc' not found grub boot error solution / fix
  • /var/log/journal huge/too large solution in Debian Mint Ubuntu Linux Howot Fix
  • Libreoffice Calc Opens CSV Spreadsheet File as Asian Language/Chinese Characters Solution Fix
  • RTL8821AU Setup Configure Wifi Realtek 8821 in Linux Debian Mint Ubuntu Howto
  • How To Tell Which Repository a Package Comes From Debian Mint Ubuntu
  • How To Reload All Kernel Modules And List Required Moduels for Each Device - Linux Mint Debian Ubuntu Troubleshooting
  • Debian Ubuntu Mint How To Change Default Display Manager
  • Ubuntu Mint Debian Howto Execute Command / Script / Program Upon Wakeup From Sleep