To be able to use the Dynagen interface to resolve some common issues that you may encounter when teaching workshops.
Open the terminal session or screen window where you have dynagen running. You should have a prompt showing:
Dynagen management console for Dynamips and Pemuwrapper 0.11.0
Copyright (c) 2005-2007 Greg Anuzelli, contributions Pavel Skovajsa
=>
This is your interface to your virtual network devices (routers and switches). You can type:
=> help
To see what commands are available to you:
Documented commands (type help <topic>):
========================================
capture confreg cpuinfo export hist list py save show suspend
clear console end filter idlepc no reload send start telnet
conf copy exit help import push resume shell stop ver
As you can see you can stop, start, reload (restart) a device, see a list of running devices, import configurations for devices, export device configurations and much more.
For the Campus Network Design workshop we have several sets of configurations for all the network devices that verify that every device is at the same point in the class. For other workshops we include base device configurations you can use to get started.
Let's load all the configuration files for all the running devices so that everything will be at the point you would be if you had completed all the initial lab exercises in the Campus Network Design workshop. To do this go back to your dynagen command prompt and type:
=> import /all configs/lab-l2-1-base
You should see lots of message about "Importing DEVICE from DEVICE.cfg" files.
Once this is done you need to reload all the network devices so that they pick up their new configurations. To do this you do:
=> reload /all
You should see lots of messages about "100-VM 'DEVICE' stopped" and "100-VM 'DEVICE' started"
Now your entire virtual network is running at a known checkpoint in the workshop. This can be very useful if students are working out-of-phase and you need to move the class forward.
To export a single configuration you can do:
=> export DEVICE DIRECTORY
=> export /all DIRECTORY
which can be useful if you are concerned about doing an import command and possibly overwriting in an unexpected manner.
Sometimes students will stop a network device when they did not mean to. It's very easy in dynagen to restart the device is this happens:
=> start DEVICE
This is one of our favorite situations. In some cases one student might change a password on a device and then not be in class after they have done this. Or, a student does not use the suggested class password and forgets what they typed. Or, a student makes a typo while configuring a device's password and save the configuration and exits from the console.
This recovery method simulates what you would do on an actual Cisco router with a console cable were this to happen.
First go to dynagen and type:
=> confreg DEVICE 0x2142
0x2142 is the default register on cisco devices to tell the router to ignore the saved config, but not lose the configuration.
Next connect to your device via the console. That is telnet to localhost on the correct port for the device. If the device was running on port 2103 you would do:
telnet localhost 2103
You will see something like this. Press ENTER as requested:
nsrc@s1:~$ telnet localhost 2053
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connected to Dynamips VM "R53" (ID 30, type c7200) - Console port
Press ENTER to get the prompt.
% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]:
Answer "no" to the above question and you will see a bunch of informational text. Press ENTER one more time and you will arrive to the device prompt:
Router>
Now go in to administrative mode with enable
Router> en
If you do:
Router# sh run
You'll notice your current configuration is now empy. Now you can load the configuration in memory and see what it looks like (not necessary, but interesting to do):
Router# conf mem
Router# sh run
Now you can set your password for a user and set your enable password. An example of this would look like:
Router# conf t
Router(config)#service password-en
Router(config)#service password-encryption
Router(config)#hostname R53
R53(config)#enable secret cisco
R53(config)#username cisco secret cisco
R53(config)#line console 0
R53(config-line)#login local
R53(config-line)#exit
R53(config)#exit
R53#wr mem
Now exit from the Telnet session:
ctrl-]
telnet> quit
Now return to the dynagen prompt and do:
=> confreg DEVICE 0x2102
=> reload DEVICE
And test that your new user and password are working as expected using telnet again to the correct port on localhost or telnet directly to the router's IP address if one has been set.
If ssh access had been configured you may need to reconfigure that as well at this point.