Kevin_306

练习笔记-思科交换机2960新设备启用等配置20201230

修改名称

1 Switch>en
2 Switch#conf t
3 Enter configuration commands, one per line.  End with CNTL/Z.
4 Switch(config)#hostname keasysc2960-00
5 keasysc2960-00(config)#end

 查看一下交换机是否有配置

  1 keasysc2960-00#sh run
  2 *Mar  1 00:02:58.190: %SYS-5-CONFIG_I: Configured from console by console
  3 Building configuration...
  4 
  5 Current configuration : 2066 bytes
  6 !
  7 ! Last configuration change at 00:02:58 UTC Mon Mar 1 1993
  8 !
  9 version 15.0
 10 no service pad
 11 service timestamps debug datetime msec
 12 service timestamps log datetime msec
 13 no service password-encryption
 14 !
 15 hostname keasysc2960-00
 16 !
 17 boot-start-marker
 18 boot-end-marker
 19 !
 20 !
 21 no aaa new-model
 22 system mtu routing 1500
 23 !
 24 !
 25 !
 26 !
 27 !
 28 !
 29 !
 30 !
 31 !
 32 !
 33 spanning-tree mode pvst
 34 spanning-tree extend system-id
 35 !
 36 vlan internal allocation policy ascending
 37 !
 38 !
 39 !
 40 !
 41 !
 42 interface FastEthernet0/1
 43 !
 44 interface FastEthernet0/2
 45 !
 46 interface FastEthernet0/3
 47 !
 48 interface FastEthernet0/4
 49 !
 50 interface FastEthernet0/5
 51 !
 52 interface FastEthernet0/6
 53 !
 54 interface FastEthernet0/7
 55 !
 56 interface FastEthernet0/8
 57 !
 58 interface FastEthernet0/9
 59 !
 60 interface FastEthernet0/10
 61 !
 62 interface FastEthernet0/11
 63 !
 64 interface FastEthernet0/12
 65 !
 66 interface FastEthernet0/13
 67 !
 68 interface FastEthernet0/14
 69 !
 70 interface FastEthernet0/15
 71 !
 72 interface FastEthernet0/16
 73 !
 74 interface FastEthernet0/17
 75 !
 76 interface FastEthernet0/18
 77 !
 78 interface FastEthernet0/19
 79 !
 80 interface FastEthernet0/20
 81 !
 82 interface FastEthernet0/21
 83 !
 84 interface FastEthernet0/22
 85 !
 86 interface FastEthernet0/23
 87 !
 88 interface FastEthernet0/24
 89 !
 90 interface FastEthernet0/25
 91 !
 92 interface FastEthernet0/26
 93 !
 94 interface FastEthernet0/27
 95 !
 96 interface FastEthernet0/28
 97 !
 98 interface FastEthernet0/29
 99 !
100 interface FastEthernet0/30
101 !
102 interface FastEthernet0/31
103 !
104 interface FastEthernet0/32
105 !
106 interface FastEthernet0/33
107 !
108 interface FastEthernet0/34
109 !
110 interface FastEthernet0/35
111 !
112 interface FastEthernet0/36
113 !
114 interface FastEthernet0/37
115 !
116 interface FastEthernet0/38
117 !
118 interface FastEthernet0/39
119 !
120 interface FastEthernet0/40
121 !
122 interface FastEthernet0/41
123 !
124 interface FastEthernet0/42
125 !
126 interface FastEthernet0/43
127 !
128 interface FastEthernet0/44
129 !
130 interface FastEthernet0/45
131 !
132 interface FastEthernet0/46
133 !
134 interface FastEthernet0/47
135 !
136 interface FastEthernet0/48
137 !
138 interface GigabitEthernet0/1
139 !
140 interface GigabitEthernet0/2
141 !

将交换机fa0/1 -48加入vlan168并配置生成树协议 

 1 keasysc2960-00#conf t
 2 Enter configuration commands, one per line.  End with CNTL/Z.
 3 keasysc2960-00(config)#int ran fa0/1 -48
 4 keasysc2960-00(config-if-range)#sw mo acc
 5 keasysc2960-00(config-if-range)#sw acc vlan 168
 6 % Access VLAN does not exist. Creating vlan 168
 7 keasysc2960-00(config-if-range)#spanning-tree portfast
 8 %Warning: portfast should only be enabled on ports connected to a single
 9  host. Connecting hubs, concentrators, switches, bridges, etc... to this
10  interface  when portfast is enabled, can cause temporary bridging loops.
11  Use with CAUTION
12 
13 %Portfast will be configured in 48 interfaces due to the range command
14  but will only have effect when the interfaces are in a non-trunking mode.
15 keasysc2960-00(config-if-range)#end

修改交换机千兆口为trunk口用于通信

 1 keasysc2960-00#conf
 2 *Mar  1 00:03:46.744: %SYS-5-CONFIG_I: Configured from console by consolet
 3 Enter configuration commands, one per line.  End with CNTL/Z.
 4 
 5 keasysc2960-00(config)#int ran g0/1 -2
 6 keasysc2960-00(config-if-range)#sw mo tr
 7 keasysc2960-00(config-if-range)#end
 8 keasysc2960-00#wr
 9 Building configuration...
10 *Mar  1 00:04:08.495: %SYS-5-CONFIG_I: Configured from console by console[OK]

 配置远程telnet访问地址

1 keasysc2960-00#conf t
2 *Mar  1 00:04:27.730: %SYS-5-CONFIG_I: Configured from console by console
3 Enter configuration commands, one per line.  End with CNTL/Z.
4 keasysc2960-00(config)#line vty 0 4
5 keasysc2960-00(config-line)#password k1234****(#此处为了保密省略真实密码#)
6 keasysc2960-00(config-line)#end

密码以明文显示

(Tips:enable password是明文保存, enable secret是密文保存 showrun中, enable password可以看到密码k12345678,enable secret 看到的是MD5加密后的密码)

1 keasysc2960-00#conf t
2 *Mar  1 00:04:49.281: %SYS-5-CONFIG_I: Configured from console by console
3 Enter configuration commands, one per line.  End with CNTL/Z.
4 keasysc2960-00(config)#enable password k12345678
5 keasysc2960-00(config)#end

 别忘了保存配置(此步骤可以随时操作保存):

1 keasysc2960-00#wr

 配置交换机管理地址

1 Building configuration...
2 
3 *Mar  1 00:05:09.959: %SYS-5-CONFIG_I: Configured from console by console[OK]
4 keasysc2960-00#
5 keasysc2960-00#conf t
6 Enter configuration commands, one per line.  End with CNTL/Z.
7 keasysc2960-00(config)#int vlan 168
8 keasysc2960-00(config-if)#ip address 192.168.168.2 255.255.255.0
9 keasysc2960-00(config-if)#end

保存之后再来看一下最终配置

  1 keasysc2960-00#sh ru
  2 *Mar  1 00:05:55.752: %SYS-5-CONFIG_I: Configured from console by console
  3 Building configuration...
  4 
  5 Current configuration : 5914 bytes
  6 !
  7 ! Last configuration change at 00:05:55 UTC Mon Mar 1 1993
  8 !
  9 version 15.0
 10 no service pad
 11 service timestamps debug datetime msec
 12 service timestamps log datetime msec
 13 no service password-encryption
 14 !
 15 hostname keasysc2960-00
 16 !
 17 boot-start-marker
 18 boot-end-marker
 19 !
 20 enable password k12345678(#明文加密的密码#)
 21 !
 22 no aaa new-model
 23 system mtu routing 1500
 24 !
 25 !
 26 !
 27 !
 28 !
 29 !
 30 !
 31 !
 32 !
 33 !
 34 spanning-tree mode pvst
 35 spanning-tree extend system-id
 36 !
 37 vlan internal allocation policy ascending
 38 !
 39 !
 40 !
 41 !
 42 !
 43 interface FastEthernet0/1
 44  switchport access vlan 168
 45  switchport mode access
 46  spanning-tree portfast
 47 !
 48 interface FastEthernet0/2
 49  switchport access vlan 168
 50  switchport mode access
 51  spanning-tree portfast
 52 !
 53 interface FastEthernet0/3
 54  switchport access vlan 168
 55  switchport mode access
 56  spanning-tree portfast
 57 !
 58 interface FastEthernet0/4
 59  switchport access vlan 168
 60  switchport mode access
 61  spanning-tree portfast
 62 !
 63 interface FastEthernet0/5
 64  switchport access vlan 168
 65  switchport mode access
 66  spanning-tree portfast
 67 !
 68 interface FastEthernet0/6
 69  switchport access vlan 168
 70  switchport mode access
 71  spanning-tree portfast
 72 !
 73 interface FastEthernet0/7
 74  switchport access vlan 168
 75  switchport mode access
 76  spanning-tree portfast
 77 !
 78 interface FastEthernet0/8
 79  switchport access vlan 168
 80  switchport mode access
 81  spanning-tree portfast
 82 !
 83 interface FastEthernet0/9
 84  switchport access vlan 168
 85  switchport mode access
 86  spanning-tree portfast
 87 !
 88 interface FastEthernet0/10
 89  switchport access vlan 168
 90  switchport mode access
 91  spanning-tree portfast
 92 !
 93 interface FastEthernet0/11
 94  switchport access vlan 168
 95  switchport mode access
 96  spanning-tree portfast
 97 !
 98 interface FastEthernet0/12
 99  switchport access vlan 168
100  switchport mode access
101  spanning-tree portfast
102 !
103 interface FastEthernet0/13
104  switchport access vlan 168
105  switchport mode access
106  spanning-tree portfast
107 !
108 interface FastEthernet0/14
109  switchport access vlan 168
110  switchport mode access
111  spanning-tree portfast
112 !
113 interface FastEthernet0/15
114  switchport access vlan 168
115  switchport mode access
116  spanning-tree portfast
117 !
118 interface FastEthernet0/16
119  switchport access vlan 168
120  switchport mode access
121  spanning-tree portfast
122 !
123 interface FastEthernet0/17
124  switchport access vlan 168
125  switchport mode access
126  spanning-tree portfast
127 !
128 interface FastEthernet0/18
129  switchport access vlan 168
130  switchport mode access
131  spanning-tree portfast
132 !
133 interface FastEthernet0/19
134  switchport access vlan 168
135  switchport mode access
136  spanning-tree portfast
137 !
138 interface FastEthernet0/20
139  switchport access vlan 168
140  switchport mode access
141  spanning-tree portfast
142 !
143 interface FastEthernet0/21
144  switchport access vlan 168
145  switchport mode access
146  spanning-tree portfast
147 !
148 interface FastEthernet0/22
149  switchport access vlan 168
150  switchport mode access
151  spanning-tree portfast
152 !
153 interface FastEthernet0/23
154  switchport access vlan 168
155  switchport mode access
156  spanning-tree portfast
157 !
158 interface FastEthernet0/24
159  switchport access vlan 168
160  switchport mode access
161  spanning-tree portfast
162 !
163 interface FastEthernet0/25
164  switchport access vlan 168
165  switchport mode access
166  spanning-tree portfast
167 !
168 interface FastEthernet0/26
169  switchport access vlan 168
170  switchport mode access
171  spanning-tree portfast
172 !
173 interface FastEthernet0/27
174  switchport access vlan 168
175  switchport mode access
176  spanning-tree portfast
177 !
178 interface FastEthernet0/28
179  switchport access vlan 168
180  switchport mode access
181  spanning-tree portfast
182 !
183 interface FastEthernet0/29
184  switchport access vlan 168
185  switchport mode access
186  spanning-tree portfast
187 !
188 interface FastEthernet0/30
189  switchport access vlan 168
190  switchport mode access
191  spanning-tree portfast
192 !
193 interface FastEthernet0/31
194  switchport access vlan 168
195  switchport mode access
196  spanning-tree portfast
197 !
198 interface FastEthernet0/32
199  switchport access vlan 168
200  switchport mode access
201  spanning-tree portfast
202 !
203 interface FastEthernet0/33
204  switchport access vlan 168
205  switchport mode access
206  spanning-tree portfast
207 !
208 interface FastEthernet0/34
209  switchport access vlan 168
210  switchport mode access
211  spanning-tree portfast
212 !
213 interface FastEthernet0/35
214  switchport access vlan 168
215  switchport mode access
216  spanning-tree portfast
217 !
218 interface FastEthernet0/36
219  switchport access vlan 168
220  switchport mode access
221  spanning-tree portfast
222 !
223 interface FastEthernet0/37
224  switchport access vlan 168
225  switchport mode access
226  spanning-tree portfast
227 !
228 interface FastEthernet0/38
229  switchport access vlan 168
230  switchport mode access
231  spanning-tree portfast
232 !
233 interface FastEthernet0/39
234  switchport access vlan 168
235  switchport mode access
236  spanning-tree portfast
237 !
238 interface FastEthernet0/40
239  switchport access vlan 168
240  switchport mode access
241  spanning-tree portfast
242 !
243 interface FastEthernet0/41
244  switchport access vlan 168
245  switchport mode access
246  spanning-tree portfast
247 !
248 interface FastEthernet0/42
249  switchport access vlan 168
250  switchport mode access
251  spanning-tree portfast
252 !
253 interface FastEthernet0/43
254  switchport access vlan 168
255  switchport mode access
256  spanning-tree portfast
257 !
258 interface FastEthernet0/44
259  switchport access vlan 168
260  switchport mode access
261  spanning-tree portfast
262 !
263 interface FastEthernet0/45
264  switchport access vlan 168
265  switchport mode access
266  spanning-tree portfast
267 !
268 interface FastEthernet0/46
269  switchport access vlan 168
270  switchport mode access
271  spanning-tree portfast
272 !
273 interface FastEthernet0/47
274  switchport access vlan 168
275  switchport mode access
276  spanning-tree portfast
277 !
278 interface FastEthernet0/48
279  switchport access vlan 168
280  switchport mode access
281  spanning-tree portfast
282 !
283 interface GigabitEthernet0/1
284  switchport mode trunk
285 !
286 interface GigabitEthernet0/2
287  switchport mode trunk
288 !
289 interface GigabitEthernet0/3
290 !
291 interface GigabitEthernet0/4
292 !
293 interface Vlan1
294  no ip address
295  no ip route-cache
296 !
297 interface Vlan168
298  ip address 192.168.168.2 255.255.255.0
299  no ip route-cache
300 !
301 ip http server
302 ip http secure-server
303 !
304 !
305 line con 0
306 line vty 0 4
307  password k12345678
308  login
309 line vty 5 15
310  login
311 !
312 end

 最后再次别忘了保存配置(此步骤可以随时操作保存): 

1 keasysc2960-00#write
2 Building configuration...
3 
4 *Mar  1 00:06:23.678: %SYS-5-CONFIG_I: Configured from console by console[OK]

posted on 2021-01-03 17:50  熊猫小虾  阅读(981)  评论(0编辑  收藏  举报

导航