1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
5 | <meta http-equiv="Content-Style-Type" content="text/css" /> |
---|
6 | <meta name="generator" content="pandoc" /> |
---|
7 | <title>Using Dynagen for troubleshooting</title> |
---|
8 | <style type="text/css">code{white-space: pre;}</style> |
---|
9 | <link rel="stylesheet" href="http://wsnoc.nsrc.org/css/style.css" type="text/css" /> |
---|
10 | </head> |
---|
11 | <body> |
---|
12 | <div id="header"> |
---|
13 | <h1 class="title">Using Dynagen for troubleshooting</h1> |
---|
14 | </div> |
---|
15 | <div id="TOC"> |
---|
16 | <ul> |
---|
17 | <li><a href="#objective"><span class="toc-section-number">1</span> Objective</a></li> |
---|
18 | <li><a href="#some-basic-dynagen-commands"><span class="toc-section-number">2</span> Some basic dynagen commands</a></li> |
---|
19 | <li><a href="#checkpoint-your-routers-to-a-known-configuration"><span class="toc-section-number">3</span> Checkpoint your routers to a known configuration</a></li> |
---|
20 | <li><a href="#export-router-and-switch-configurations"><span class="toc-section-number">4</span> Export router and switch configurations</a></li> |
---|
21 | <li><a href="#stopping-starting-a-device"><span class="toc-section-number">5</span> Stopping, Starting a device</a></li> |
---|
22 | <li><a href="#recover-from-a-forgotten-password"><span class="toc-section-number">6</span> Recover from a forgotten password</a></li> |
---|
23 | </ul> |
---|
24 | </div> |
---|
25 | <h1 id="objective"><a href="#objective"><span class="header-section-number">1</span> Objective</a></h1> |
---|
26 | <p>To be able to use the Dynagen interface to resolve some common issues that you may encounter when teaching workshops.</p> |
---|
27 | <h1 id="some-basic-dynagen-commands"><a href="#some-basic-dynagen-commands"><span class="header-section-number">2</span> Some basic dynagen commands</a></h1> |
---|
28 | <p>Open the terminal session or screen window where you have dynagen running. You should have a prompt showing:</p> |
---|
29 | <pre><code>Dynagen management console for Dynamips and Pemuwrapper 0.11.0 |
---|
30 | Copyright (c) 2005-2007 Greg Anuzelli, contributions Pavel Skovajsa |
---|
31 | |
---|
32 | => </code></pre> |
---|
33 | <p>This is your interface to your virtual network devices (routers and switches). You can type:</p> |
---|
34 | <pre><code>=> help</code></pre> |
---|
35 | <p>To see what commands are available to you:</p> |
---|
36 | <pre><code>Documented commands (type help <topic>): |
---|
37 | ======================================== |
---|
38 | capture confreg cpuinfo export hist list py save show suspend |
---|
39 | clear console end filter idlepc no reload send start telnet |
---|
40 | conf copy exit help import push resume shell stop ver</code></pre> |
---|
41 | <p>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.</p> |
---|
42 | <h1 id="checkpoint-your-routers-to-a-known-configuration"><a href="#checkpoint-your-routers-to-a-known-configuration"><span class="header-section-number">3</span> Checkpoint your routers to a known configuration</a></h1> |
---|
43 | <p>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.</p> |
---|
44 | <p>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:</p> |
---|
45 | <pre><code>=> import /all configs/lab-l2-1-base</code></pre> |
---|
46 | <p>You should see lots of message about "Importing DEVICE from DEVICE.cfg" files.</p> |
---|
47 | <p>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:</p> |
---|
48 | <pre><code>=> reload /all</code></pre> |
---|
49 | <p>You should see lots of messages about "100-VM 'DEVICE' stopped" and "100-VM 'DEVICE' started"</p> |
---|
50 | <p>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.</p> |
---|
51 | <h1 id="export-router-and-switch-configurations"><a href="#export-router-and-switch-configurations"><span class="header-section-number">4</span> Export router and switch configurations</a></h1> |
---|
52 | <p>To export a single configuration you can do:</p> |
---|
53 | <pre><code>=> export DEVICE DIRECTORY</code></pre> |
---|
54 | <pre><code>=> export /all DIRECTORY</code></pre> |
---|
55 | <p>which can be useful if you are concerned about doing an import command and possibly overwriting in an unexpected manner.</p> |
---|
56 | <h1 id="stopping-starting-a-device"><a href="#stopping-starting-a-device"><span class="header-section-number">5</span> Stopping, Starting a device</a></h1> |
---|
57 | <p>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:</p> |
---|
58 | <pre><code>=> start DEVICE </code></pre> |
---|
59 | <h1 id="recover-from-a-forgotten-password"><a href="#recover-from-a-forgotten-password"><span class="header-section-number">6</span> Recover from a forgotten password</a></h1> |
---|
60 | <p>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.</p> |
---|
61 | <p>This recovery method simulates what you would do on an actual Cisco router with a console cable were this to happen.</p> |
---|
62 | <p>First go to dynagen and type:</p> |
---|
63 | <pre><code>=> confreg DEVICE 0x2142</code></pre> |
---|
64 | <p>0x2142 is the default register on cisco devices to tell the router to ignore the saved config, but not lose the configuration.</p> |
---|
65 | <p>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:</p> |
---|
66 | <pre><code>telnet localhost 2103</code></pre> |
---|
67 | <p>You will see something like this. Press ENTER as requested:</p> |
---|
68 | <pre><code>nsrc@s1:~$ telnet localhost 2053 |
---|
69 | Trying 127.0.0.1... |
---|
70 | Connected to localhost. |
---|
71 | Escape character is '^]'. |
---|
72 | Connected to Dynamips VM "R53" (ID 30, type c7200) - Console port |
---|
73 | Press ENTER to get the prompt. |
---|
74 | |
---|
75 | % Please answer 'yes' or 'no'. |
---|
76 | Would you like to enter the initial configuration dialog? [yes/no]:</code></pre> |
---|
77 | <p>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:</p> |
---|
78 | <pre><code>Router></code></pre> |
---|
79 | <p>Now go in to administrative mode with enable</p> |
---|
80 | <pre><code>Router> en</code></pre> |
---|
81 | <p>If you do:</p> |
---|
82 | <pre><code>Router# sh run</code></pre> |
---|
83 | <p>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):</p> |
---|
84 | <pre><code>Router# conf mem |
---|
85 | Router# sh run</code></pre> |
---|
86 | <p>Now you can set your password for a user and set your enable password. An example of this would look like:</p> |
---|
87 | <pre><code>Router# conf t |
---|
88 | Router(config)#service password-en |
---|
89 | Router(config)#service password-encryption |
---|
90 | Router(config)#hostname R53 |
---|
91 | R53(config)#enable secret cisco |
---|
92 | R53(config)#username cisco secret cisco |
---|
93 | R53(config)#line console 0 |
---|
94 | R53(config-line)#login local |
---|
95 | R53(config-line)#exit |
---|
96 | R53(config)#exit |
---|
97 | R53#wr mem</code></pre> |
---|
98 | <p>Now exit from the Telnet session:</p> |
---|
99 | <pre><code>ctrl-] |
---|
100 | telnet> quit</code></pre> |
---|
101 | <p>Now return to the dynagen prompt and do:</p> |
---|
102 | <pre><code>=> confreg DEVICE 0x2102 |
---|
103 | => reload DEVICE </code></pre> |
---|
104 | <p>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.</p> |
---|
105 | <p>If ssh access had been configured you may need to reconfigure that as well at this point.</p> |
---|
106 | </body> |
---|
107 | </html> |
---|