Agenda: exercises-cisco-config.txt

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