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

 

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

  • LXC Containers LXD How to Install and Configure Tutorial Ubuntu Debian Mint
  • Ubuntu Mint audio output not working pulseaudio "pulseaudio[13710]: [pulseaudio] sink-input.c: Failed to create sink input: too many inputs per sink."
  • How To Shrink Dynamically Allocated VM QEMU KVM VMware Disk Image File
  • How To Enable Linux Swapfile Instead of Partition Ubuntu Mint Debian Centos
  • 404 Not Found [IP: 151.101.194.132 80] apt update Debian 11 Bullseye Solution The repository 'http://security.debian.org bullseye/updates Release' does not have a Release file.
  • WARNING: Can't download daily.cvd from db.local.clamav.net freshclam clamav error solution
  • (firefox:9562): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory) Solution
  • Debian Mint Ubuntu Which Package Provides missing top, ps and w Solution
  • Vbox Virtualbox DNS NAT Network Mode NOT working
  • Docker Tutorial HowTo Install Docker, Use and Create Docker Container Images Clustering Swarm Mode Monitoring Service Hosting Provider
  • Zoom Password Error 'That passcode was incorrect' - Solution Wrong Passcode Wrong Meeting Name
  • How To Startup and Open Remote/Local Folder/Directory in Ubuntu Linux Mint automatically upon login
  • How To Reset Windows Server Password 2019, 2022, 7, 8, 10, 11 Recovery and Removal Guide Using Linux Ubuntu Mint Debian
  • How To Create OpenVPN Server for Secure Remote Corporate Access in Linux Debian/Mint/Ubuntu with client public key authentication
  • HongKong VPS Server, Cloud, Dedicated Server, Co-Location, Datacenter The Best Guide on Hong Kong, China Internet IT/Computing
  • ssh-keygen id_rsa private key howto remove the passphrase so no password is required and no encryption is used
  • Package wget is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source. E: Package 'wget' has no installation candidate. Solution
  • tag#4 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE tag#4 Sense Key : Illegal Request [current] res 40/00:b4:98:02:00/00:00:00:00:00/40 Emask 0x10 (ATA bus error) solution
  • Wazuh Install and Configuration Howto Tutorial Guide for Monitoring Agents
  • Linux Debian How To Enable Sudo/Sudoers for User "User not in sudoers file" Solution