Agenda: exercises-cisco-config.txt

File exercises-cisco-config.txt, 5.1 KB (added by jens, 8 years ago)

Cisco Config Elements Exercises

Line 
1Cisco Config Elements
2=====================
3
4Notes:
5------
6* Commands preceded with "$" imply that you should execute the command as
7  a general user - not as root.
8* Commands preceded with "#" imply that you should be working as root.
9* Commands with more specific command lines (e.g. "rtr>" or "mysql>")
10  imply that you are executing commands on remote equipment, or within
11  another program.
12* If a command line ends with "\" this indicates that the command continues
13  on the next line and you should treat this as a single line.
14
15Exercises Part I
16================
17
181. Connect to your router
19-------------------------
20
21Log in to your vm/pc image and install Telnet:
22
23        $ sudo apt-get install telnet
24
25Connect to router in your group. If you are not sure remember to review the
26classroom network diagram:
27
28        http://noc.ws.nsrc.org/wiki/Diagram
29
30Now connect to your router:
31
32        $ telnet 10.10.N.254
33
34        username: cisco
35        password: cisco
36
37Display information about your router
38
39        rtrN>enable                             (default pw "cisco")
40        rtrN#show run                           (space to continue)
41        rtrN#show int FastEthernet0/0
42        rtrN#show ?                             (lists all options)
43        rtrN#exit                               (log off router)
44
45
46
472. Configure your router to only use SSH
48----------------------------------------
49
50These steps will do the following:
51
52        * Create an ssh key for your router
53        * Create an encrypted password for the user cisco
54        * Encrypt the enable password (cisco)
55        * Turn off telnet (unencrypted) access to your router
56        * Turn on SSH (version 2) access to your router
57
58You need to work in groups of 4.
59
60Get together with the members of your router
61group and assign one person to enter commands. To start connect to one of the
62PCs in use by your group. From that PC image telnet to your router:
63
64        $ telnet rtrN.ws.nsrc.org       (or "telnet 10.10.N.254")
65       
66        username: cisco
67        password: cisco
68
69        rtrN> enable                                    (en)
70        password: cisco
71        rtrN# configure terminal                        (conf t)
72
73Let's activate the usernames/passwords model (should be activated by default, but let's just be sure):
74
75        rtrN(config)# aaa new-model
76
77First let's remove our cisco user temporarily, then we'll recreate
78the user:
79
80        rtrN(config)# no username cisco
81        rtrN(config)# username cisco secret 0 cisco
82
83Now the cisco user's password (of cisco) is encrypted. Next let's encrypt
84the enable password as well:
85
86        rtrN(config)# enable secret 0 cisco
87
88
89To activate SSH, we need to generate a router key:
90        rtrN(config)# crypto key generate rsa
91
92        How many bits in the modulus [512]: 2048
93       
94Wait for the key to generate.
95
96Now we'll tell our router to only allow SSH connections on the 5 defined
97consoles (vty 0 through 4):
98
99        rtrN(config)# line vty 0 4
100        rtrN(config-line)# transport input ssh
101        rtrN(config-line)# exit
102
103This drops us out of the "line" configuration mode and back in to the general
104configuration mode. Now we'll tell the router to log SSH-related events and to
105only allow SSH version 2 connections:
106
107        rtrN(config)# ip ssh logging events
108        rtrN(config)# ip ssh version 2
109
110Now exit from configuration mode:
111
112        rtrN(config)# exit
113
114And, write these changes to the routers permament configuration:
115
116        rtrN# write memory                              (wr mem)
117
118Ok. That's it. You can no longer use telnet to connect to your router. You must
119connect using SSH with the user "cisco" and password "cisco". The enable password
120is, also, "cisco" - Naturally in a real-world situation you would use much more
121secure passwords.
122
123Let's exit from the router interface and reconnect using SSH:
124
125        rtrN# exit
126
127First, try connection again with telnet:
128
129        $ telnet rtrN.ws.nsrc.org
130
131What happens? You should see something like:
132
133        Trying 10.10.N.254...
134        telnet: Unable to connect to remote host: Connection refused
135
136Now try connecting with SSH:
137
138        $ ssh cisco@rtrN.ws.nsrc.org
139
140You should see something like:
141
142        The authenticity of host 'rtr2.ws.nsrc.org (10.10.2.254)' can't be     
143        established. RSA key fingerprint is 93:4c:eb:ad:5c:4a:a6:3e:8b:9e:
144        4f:e4:e2:eb:e4:7f. Are you sure you want to continue connecting
145        (yes/no)?
146
147Enter in "yes" and press ENTER to continue...
148
149Now you'll see the follwoing:
150
151        Password: cisco
152        rtrN>
153
154Type "enable" to allow us to execute privileged commands:
155
156        rtrN> enable
157        Password: cisco
158        rtrN#
159
160Now let's view the current router configuration:
161
162        rtrN# show running                                      (sh run)
163
164Press the space bar to continue. Note some of the entries like:
165
166        enable secret 5 $1$p4/E$PnPk6VaF8QoZMhJx56oXs.
167        .
168        .
169        .
170        username cisco secret 5 $1$uNg1$M1yscHhYs..upaPP4p8gX1
171        .
172        .
173        .
174        line vty 0 4
175         exec-timeout 0 0
176         transport input ssh
177
178You can see that both the enable password and the password for the user cisco
179have been encrypted. This is a good thing.
180
181Now you should exit the router interface to complete this exercise:
182
183        rtrN# exit
184
185NOTES
186-----
187
1881.) If you are locked out of your router after this exercise let your
189    instructor know and they can reset your router's configuration back to its
190    original state.
191
1922.) Please only do this exercise once. If multiple people do this exercise
193    it's very likely that access to the router will be broken.
1943.) During the week you will configure items such as SNMP, Netflow and more on
195    your group's router. From now on you can simply connect to the router
196    directly from your laptop or desktop machine using SSH.