-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter.switch.xml
More file actions
1483 lines (1283 loc) · 44.5 KB
/
Copy pathchapter.switch.xml
File metadata and controls
1483 lines (1283 loc) · 44.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: chapter.switch.xml 390 2012-04-17 10:49:40Z netkiller $ -->
<chapter id="switch">
<title>Switch</title>
<para>Cisco 固定配置交换机命名规则</para>
<screen>
对于Cisco的固定配置的交换机,一般有3750,3550,3560,2960,2970这几个系列。
它们在型号命令上有自己相应的规则,特总结如下:
eg: WS-C3750G-48TS-S
C3750表明这款产品属于3750这个系列,也就是产品的型号。
G----表明其所有接口都是支持千兆或以上,如果没有这个就表明其主要端口都是10/100M的或者100M的
48----表明其拥有主要的端口数量为48个
T----表明其主要端口是电口(也就是所谓的Twirst Pair的端口
P----表明其主要端口是电口,同时支持PoE以太网供电
S----表明其带的扩展的接口为SFP类型的接口
最后部分的-S表明交换机带的软件是SMI标准影像的,-E表明是EMI影像的
</screen>
<section id="switch.started">
<title>交换机初始化</title>
<para>Cisco Catalyst 2960 Series Switches</para>
<screen>
<![CDATA[
Press RETURN to get started!
*Mar 1 00:00:25.073: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, cha nged state to down
*Mar 1 00:00:26.189: %SPANTREE-5-EXTENDED_SYSID: Extended SysId enabled for typ e vlan
*Mar 1 00:00:47.102: %SYS-5-RESTART: System restarted --
Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(44)SE6, REL EASE SOFTWARE (fc1)
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Mon 09-Mar-09 18:10 by gereddy
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]:
Would you like to enter the initial configuration dialog? [yes/no]: yes
At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.
Basic management setup configures only enough connectivity
for management of the system, extended setup will ask you
to configure each interface on the system
Would you like to enter basic management setup? [yes/no]: yes
Configuring global parameters:
Enter host name [Switch]:
The enable secret is a password used to protect access to
privileged EXEC and configuration modes. This password, after
entered, becomes encrypted in the configuration.
Enter enable secret: chen
The enable password is used when you do not specify an
enable secret password, with some older software versions, and
some boot images.
Enter enable password: chen
% Please choose a password that is different from the enable secret
Enter enable password: chen
The virtual terminal password is used to protect
access to the router over a network interface.
Enter virtual terminal password: chen
Configure SNMP Network Management? [no]: yes
Community string [public]:
Current interface summary
Interface IP-Address OK? Method Status Protocol
Vlan1 unassigned YES unset up down
FastEthernet0/1 unassigned YES unset down down
FastEthernet0/2 unassigned YES unset down down
FastEthernet0/3 unassigned YES unset down down
FastEthernet0/4 unassigned YES unset down down
FastEthernet0/5 unassigned YES unset down down
FastEthernet0/6 unassigned YES unset down down
FastEthernet0/7 unassigned YES unset down down
FastEthernet0/8 unassigned YES unset down down
FastEthernet0/9 unassigned YES unset down down
FastEthernet0/10 unassigned YES unset down down
FastEthernet0/11 unassigned YES unset down down
FastEthernet0/12 unassigned YES unset down down
FastEthernet0/13 unassigned YES unset down down
FastEthernet0/14 unassigned YES unset down down
FastEthernet0/15 unassigned YES unset down down
FastEthernet0/16 unassigned YES unset down down
FastEthernet0/17 unassigned YES unset down down
FastEthernet0/18 unassigned YES unset down down
FastEthernet0/19 unassigned YES unset down down
FastEthernet0/20 unassigned YES unset down down
FastEthernet0/21 unassigned YES unset down down
FastEthernet0/22 unassigned YES unset down down
FastEthernet0/23 unassigned YES unset down down
FastEthernet0/24 unassigned YES unset down down
GigabitEthernet0/1 unassigned YES unset down down
GigabitEthernet0/2 unassigned YES unset down down
Enter interface name used to connect to the
management network from the above interface summary: FastEthernet0/24
Configuring interface FastEthernet0/24:
Configure IP on this interface? [no]: yes
IP address for this interface: 172.16.0.253
Subnet mask for this interface [255.255.0.0] :
Class B network is 172.16.0.0, 16 subnet bits; mask is /16
Would you like to enable as a cluster command switch? [yes/no]: yes
Enter cluster name: cl1
The following configuration command script was created:
hostname Switch
enable secret 5 $1$W1RW$ZdWR.sS/g2RwJMv4F5sRq0
enable password chen
line vty 0 15
password chen
snmp-server community public
!
!
interface Vlan1
shutdown
no ip address
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
--More--
]]>
</screen>
<section>
<title>密码设置</title>
<para>基本操作</para>
<screen>
Switch command
Switch > en 进入特权模式
Switch # conf t 进入全局配置模式
Switch(config)# interface interface-num 进入接口
Switch(config)# hostname name 给交换机命名
Switch(config)# enable password password 设置明文密码
Switch(config)# enable secret password 设置加密的启用秘密口令。如果设置则取代明文口令
Switch # copy running-config startup-config
Switch # write 保存设置
</screen>
</section>
<section>
<title>域名,网管</title>
<para>初始化设置</para>
<screen>
Switch setup
switch(config)# ip default-gateway ip-address
switch(config)# ip domain-name domain-name
switch(config)# ip name-server IP-address 交换机上设置远程访问,用于交换机管理
</screen>
</section>
<section id="switch.telnet">
<title>Telnet</title>
<para>通过Telnet进入命令行接口</para>
<screen>
Switch>enable
Switch#conf t
Switch(config)#line vty 0 4
Switch(config-line)#login
Switch(config-line)#password cisco
</screen>
<section>
<title>privilege level</title>
<screen>
line vty 5 15
privilege level 15
password neo
login
!
</screen>
</section>
</section>
<section>
<title>保存当前配置</title>
<para>Save</para>
<screen>
Switch#wr
Building configuration...
[OK]
</screen>
</section>
<section>
<title>恢复交换机出厂值</title>
<screen>
Switch# erase startup-config
</screen>
</section>
</section>
<section id="switch.interface">
<title>interface</title>
<section>
<title>show interfaces status</title>
<screen>
show interfaces status
</screen>
</section>
<section>
<title>ip address</title>
<para>DHCP</para>
<screen>
ip address dhcp
</screen>
<para>指定IP地址</para>
<screen>
ip address 192.20.135.21 255.255.255.0
</screen>
</section>
<section>
<title>配置端口速率及双工模式</title>
<literallayout>
Step 1 configure terminal 进入配置状态.
Step 2 interface interface-id 进入端口配置状态.
Step 3 speed {10 | 100 | 1000 | auto | nonegotiate} 设置端口速率 注 1000 只工作在千兆口. GBIC模块只工作在1000 Mbps下. nonegotiate 只能在这些GBIC上用 1000BASE-SX, -LX, and -ZX GBIC.
Step 4 duplex {auto | full | half} 设置全双工或半双工.
Step 5 end 退出
Step 6 show interfaces interface-id 显示有关配置情况
Step 7 copy running-config startup-config 保存
</literallayout>
<screen>
Switch# configure terminal
Switch(config)# interface fastethernet0/3
Switch(config-if)# speed 10
Switch(config-if)# duplex half
</screen>
</section>
<section>
<title>range</title>
<screen>
Switch# configure terminal
Switch(config)# interface range fastethernet0/1 - 5
Switch(config-if-range)# no shutdown
Switch(config-if-range)#
*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/4, changed state to up
*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to up
*Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/05,
changed state to up
*Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
state to up
*Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed
state to up
</screen>
<para>同时选择多个端口</para>
<screen>
Switch# configure terminal
Switch(config)# interface range fastethernet0/1 - 3, gigabitethernet0/1 - 2
Switch(config-if-range)# no shutdown
Switch(config-if-range)#
*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up
*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to up
*Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/ 1,
changed state to up
*Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 2,
changed state to up
*Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 3,
changed state to up
</screen>
</section>
<section>
<title>端口隔离</title>
<screen>
Switch(config)# interface 端口号
Switch(config-if)# switchitchport protected //开启端口保护功能
</screen>
<para>注:思科个别型号交换机采用PVLAN来实现端口保护功能</para>
</section>
</section>
<section id="switch.dhcp">
<title>DHCP</title>
<para>关闭DHCP服务</para>
<screen>
no service dhcp
</screen>
<para>开启DHCP服务</para>
<screen>
Switch(config)#service dhcp
</screen>
<screen>
<![CDATA[
ip dhcp pool global //global是pool name, 由用户指定
network 10.1.0.0 255.255.0.0 //动态分配的地址段
default-router 10.1.1.100 10.1.1.101 //为客户机配置默认网关
domain-name client.com //为客户机配置域后缀
dns-server 10.1.1.1 10.1.1.2 //为客户机配置dns服务器
netbios-name-server 10.1.1.5 10.1.1.6 //为客户机配置wins服务器
netbios-node-type h-node //为客户机配置节点模式(影响名称解释的顺利,如h-node=先通过wins服务器解释...)
lease 3 //地址租用期限: 3天
]]>
</screen>
<para>VLAN 指定DHCP地址</para>
<screen>
<![CDATA[
ip helper-address 10.1.1.8 //假设这是DHCP客户机所在的VLAN
]]>
</screen>
<section id="switch.gateway">
<title>Gateway</title>
<para>显示地址分配情况</para>
<screen>
show ip dhcp binding
</screen>
<para>显示地址冲突情况</para>
<screen>
show ip dhcp conflict
</screen>
<para>观察DHCP服务器工作情况</para>
<screen>
debug ip dhcp server {events | packets | linkage}
</screen>
</section>
<section id="switch.dhcp.snooping">
<title>snooping</title>
<screen>
Switch(config)#ip dhcp snooping
Switch(config)#ip dhcp snooping vlan 2
Switch(config)#ip dhcp snooping vlan 3
or
Switch(config)#ip dhcp snooping vlan 2-3
Switch(config)#ip dhcp snooping verify mac-address
Switch(config)#ip dhcp snooping information option
Switch(config)#int range f0/1-12
Switch(config-if-range)#ip dhcp snooping trust
Switch(config-if-range)#ip dhcp snooping limit rate 15
</screen>
</section>
<section>
<title>DHCP中继代理</title>
<screen>
Switch(config)#service dhcp
Switch(config)#ip dhcp replay infomation option
</screen>
</section>
</section>
<section id="switch.switchport">
<title>Route port</title>
<para>no switchport</para>
<screen>
<![CDATA[
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface gigabitethernet0/2
Switch(config-if)# no switchport
Switch(config-if)# ip address 192.20.135.21 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# end
]]>
</screen>
</section>
<section id="switch.monitor">
<title>交换机端口镜像配置</title>
<para>举例:通过交换机的第2号口监控第1号口的流量</para>
<screen>
<![CDATA[
Switch(config)# monitor session 1 source interface gigabitethernet0/1
Switch(config)# monitor session 1 destination interface gigabitethernet0/2
Switch(config)# end
]]>
</screen>
<para>删除一个span会话: </para>
<screen>
<![CDATA[
Switch(config)# no monitor session 1 source interface gigabitethernet0/1
Switch(config)# end
]]>
</screen>
</section>
<section id="switch.channel-group">
<title>Ethernet Port Groups</title>
<para>SwitchA</para>
<screen>
<![CDATA[
SwitchA# configure terminal
SwitchA (config)# interface range GigabitEthernet1/1-2
SwitchA (config-if-range)# switchport mode access
SwitchA (config-if-range)# switchport access vlan 10
SwitchA (config-if-range)# channel-group 5 mode on
Switch(config-if-range)# end
]]>
</screen>
<para>SwitchB</para>
<screen>
<![CDATA[
SwitchB# configure terminal
SwitchB(config)#interface range GigabitEthernet1/0/1-2
SwitchB(config-if-range)#switchport mode access
SwitchB(config-if-range)#switchport access vlan 10
SwitchB(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel 1
SwitchB(config-if-range)#int port-channel 1
SwitchB(config-if)#exit
SwitchB(config)#do show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(SU) - Gi1/0/1(P) Gi1/0/2(P)
]]>
</screen>
<section>
<title>LACP</title>
<para>channel-group 4 mode active 这个命令控制是否用LACP的。</para>
<screen>
c4506(config)#inter g6/5
c4506(config-if)#channel-group 4 mode ?
active Enable LACP unconditionally
auto Enable PAgP only if a PAgP device is detected
desirable Enable PAgP unconditionally
on Enable Etherchannel only
passive Enable LACP only if a LACP device is detected
c4506(config-if)#channel-group 4 mode active
</screen>
</section>
<section>
<title>desirable</title>
<example>
<title>desirable</title>
<para>switch A</para>
<screen>
Switch(config)#interface range fa0/1-4 #range配置二个以上的接口
Switch(config-if-range)#channel-group 1 mode desirable #封装为自动协商模式
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#switchport trunk encapsulation dot1q
Switch(config-if-range)#switchport trunk allowed vlan all #允许所以vlan通过
</screen>
<para>switch B</para>
<screen>
Switch(config)#interface range fa0/1-4
Switch(config-if-range)#channel-group 1 mode desirable
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#switchport trunk encapsulation dot1q
Switch(config-if-range)#switchport trunk allowed vlan all
</screen>
</example>
</section>
</section>
<section id="switch.vlan">
<title>VLAN</title>
<section>
<title>vlan database</title>
<screen>
<![CDATA[
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
Switch(vlan)#
*Mar 1 00:29:54.407: %SYS-5-CONFIG_I: Configured from console by console
Switch(vlan)#show
VLAN ISL Id: 1
Name: default
Media Type: Ethernet
VLAN 802.10 Id: 100001
State: Operational
MTU: 1500
Backup CRF Mode: Disabled
Remote SPAN VLAN: No
VLAN ISL Id: 2
Name: server
Media Type: Ethernet
VLAN 802.10 Id: 100002
State: Operational
MTU: 1500
Backup CRF Mode: Disabled
Remote SPAN VLAN: No
VLAN ISL Id: 3
Name: office
Media Type: Ethernet
VLAN 802.10 Id: 100003
State: Operational
MTU: 1500
Backup CRF Mode: Disabled
Remote SPAN VLAN: No
VLAN ISL Id: 1002
Name: fddi-default
Media Type: FDDI
VLAN 802.10 Id: 101002
State: Operational
MTU: 1500
Backup CRF Mode: Disabled
Remote SPAN VLAN: No
VLAN ISL Id: 1003
Name: token-ring-default
Media Type: Token Ring
VLAN 802.10 Id: 101003
State: Operational
MTU: 1500
Maximum ARE Hop Count: 7
Maximum STE Hop Count: 7
Backup CRF Mode: Disabled
Remote SPAN VLAN: No
VLAN ISL Id: 1004
Name: fddinet-default
Media Type: FDDI Net
VLAN 802.10 Id: 101004
State: Operational
MTU: 1500
STP Type: IEEE
Backup CRF Mode: Disabled
Remote SPAN VLAN: No
VLAN ISL Id: 1005
Name: trnet-default
Media Type: Token Ring Net
VLAN 802.10 Id: 101005
State: Operational
MTU: 1500
STP Type: IBM
Backup CRF Mode: Disabled
Remote SPAN VLAN: No
Switch(vlan)#
]]>
</screen>
</section>
<section>
<title>两层Switch配置讲解</title>
<para>路由器配制</para>
<screen>
<![CDATA[
Router#configure terminal
Router(config)#interface f0/0
Router(config-if)#no shutdown
Router(config-if)#interface f0/0.1 --------------- 创建子接口1
Router(config-subif)#encapsulation dot1q 2 ------ 2为VLAN号 对应VLAN 2
Router(config-subif)#ip address 10.10.11.1 255.255.255.0
Router(config-if)#interface f0/0.2 ---------------- 创建子接口2
Router(config-subif)#encapsulation dot1q 3 ------- 3为VLAN号 对应VLAN 3
Router(config-subif)#ip address 10.10.10.1 255.255.255.0
路由器已经配制完毕,可以在Router#show run 看一下当前的配制,用Router#show interfaces 看当前端口的状态,f0/0.1 和f0/0.2两个子
接口是否为up状态。
]]>
</screen>
<para>交换机配制</para>
<screen>
<![CDATA[
Switch#vlan database
Switch(vlan)#vlan 2 name 财务部 ------- 创建vlan 2为财务部
Switch(vlan)#vlan 3 name 市场部----------创建vlan 3为市场部
Switch(vlan)#exit
Switch configure terminal
Switch(coning)#interface range f0/2 - 9
Switch(coning-if)#switch port access vlan 2 ------- 将f0/-f0/9端口分到vlan 2中
Switch(config-if)#interface range f0/10 - 14
Switch(config-if)#switchport access vlan 3 --------将端f0/10至f0/14口3分到vlan 3中
Switch(config-if)#interface f0/1
Switch(config-if)#switchport trunk encapsulation dot1q ------将端口封装
Switch(config-if)#switchport mode trunk -------- 将端口配制为trunk模式
]]>
</screen>
<para>客户端配制:</para>
<screen>
<![CDATA[
WorKstation 1 配制为:10.10.11.3 255.255.255.0 网关:10.10.11.1
Workstation 2 配制为:10.10.10.3 255.255.255.0 网关:10.10.10.1
]]>
</screen>
</section>
<section>
<title>3 Layer Switch</title>
<para>3560交换机VLAN间路由的具体设置</para>
<para>路由, VLAN, 交换机, 设置
在3560交换机上划三个VLAN,并且要求其中两个VLAN间能够互相访问,操作如下,请指点:</para>
<procedure>
<title>Switch VLan 配置步骤</title>
<step>
<para>激活vlan路由 </para>
<screen>
Switch1#config t
Switch1(config)#ip routing
</screen>
</step>
<step>
<para>创建三个VLAN</para>
<screen>
Switch1#
Switch1#vlan database
Switch1(vlan)#vlan 2
Switch1(vlan)#vlan 3
Switch1(vlan)#vlan 10
Switch1(vlan)#exit
</screen>
</step>
<step>
<para>给VLAN分配IP</para>
<screen>
Switch1#config t
Switch1(config)#config vlan2
Switch1(config-if)#ip address 192.168.2.1 255.255.255.0
Switch1(config-if)#no shutdown
Switch1#config t
Switch1(config)#config vlan3
Switch1(config-if)#ip address 192.168.3.1 255.255.255.0
Switch1(config-if)#no shutdown
</screen>
</step>
<step>
<para>配VTP</para>
<screen>
Switch1#
Switch1#config t
Switch1(config)#vtp domain SMG
Switch1(config)#vtp mode server
Switch1(config)#end
</screen>
</step>
<step>
<para>交换机通往路由器的接口配IP</para>
<screen>
<![CDATA[
Switch1#
Switch1#config t
Switch1(config)#interface fastethernet0/1
Switch1(config-if)#no switchport
Switch1(config-if)#ip address 200.1.1.1 255.255.255.0
Switch1(config-if)#no shutdown
]]>
</screen>
</step>
<step>
<para>交换机配置缺省路由</para>
<screen>
<![CDATA[
Switch1#
Switch1#config t
Switch(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.2
]]>
</screen>
</step>
<step>
<para>把VLAN号分配给IP接口 </para>
<screen>
<![CDATA[
Switch1#
Switch1#config t
Switch1(config)#interface fastethernet0/2
Switch1(config-if)#switchport mode access
Switch1(config-if)#switchport access vlan2
Switch1(config-if)#spanning-tree portfast
… …
Switch1#
Switch1#config t
Switch1(config)#interface fastethernet0/13
Switch1(config-if)#switchport mode access
Switch1(config-if)#switchport access vlan3
Switch1(config-if)#spanning-tree portfast
]]>
</screen>
</step>
<step>
<para>配访问控制列表ACL禁VLAN3子网的客户机访问服务器</para>
<screen>
<![CDATA[
Switch1#
Switch1#config t
Switch1(config)#access-list 1 deny 192.168.3.0 0.0.0.255
Switch1(config)#access-list 1 permit any
Switch1(config)#interface fastethernet0/13 (此接口接服务器)
Switch1(config-if)#ip access-group 1 out
]]>
</screen>
</step>
<step>
<para>检查上述配置 </para>
<screen>
<![CDATA[
Switch1#show vlan
Switch1#show ip route
Switch1#show interface gigabitethernet0/1 switchport
Switch1#show run
Switch1#show vtp status
]]>
</screen>
</step>
<step>
<para>存配置 </para>
<screen>
<![CDATA[
Switch1#copy running-config startup-config
]]>
</screen>
</step>
</procedure>
</section>
<section id="switch.vtp">
<title>VTP</title>
<para>VLAN Trunking Protocol(VLAN 中继协议)</para>
<section>
<title>Configuring a VTP Server</title>
<para>Server</para>
<screen>
Switch# config terminal
Switch(config)# vtp mode server
Switch(config)# vtp domain cisco
Switch(config)# vtp password mypassword
Switch(config)# end
</screen>
<screen>
Switch# vlan database
Switch(vlan)# vtp server
Switch(vlan)# vtp domain cisco
Switch(vlan)# vtp password mypassword
Switch(vlan)# exit
APPLY completed.
Exiting....
Switch#
</screen>
</section>
<section>
<title>Configuring a VTP Client</title>
<screen>
2960#conf t
2960(config)#int f0/15
2960(config-if)#switchport mode trunk
2960(config-if)#end
2960#vlan database
2960(vlan)#vtp client
2960(vlan)#vtp domain eng_group
2960(vlan)#vtp password mypassword
2960(vlan)#exit
</screen>
</section>
<section>
<title>example for vtp</title>
<screen>
<![CDATA[
cisco3750>en
cisco3750#conf t
cisco3750(config)#vtp domain cisco(创建域名)
cisco3750(config)#vtp password 123(设置密码)
cisco3750(config)#vtp mode server(改成服务器模式)
cisco3750(config-if)#int g0/0(进入千兆端口)
cisco3750(config-if)#switchport trunk encapsulation dot1q(封装)
cisco3750(config-if)#switch mode trunk(改成trunk模式)
3560>en
3560#conf t
3560(config)#vtp domain cisco(要以前面一致)
3560(config)#vtp password 123(要以前面一致)
3560(config)#vtp mode client(改成客户机模式)
]]>
</screen>
<screen>
3750G-1.240#show vtp stat
VTP Version : 2
Configuration Revision : 4
Maximum VLANs supported locally : 1005
Number of existing VLANs : 8
VTP Operating Mode : Server
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x5D 0x64 0xFF 0xB1 0x87 0xF7 0x5B 0x0E
Configuration last modified by 0.0.0.0 at 3-1-93 00:17:47
Local updater ID is 0.0.0.0 (no valid interface found)
3750G-1.240#show vtp password
VTP Password: 123
</screen>
</section>
</section>
</section>
<section id="switch.acl">
<title>ACL</title>
<para>配置访问控制列表</para>
<screen>
Switch(Config)access-list 103 permit ip 192.168.2.0 0.0.0.255 192.168.3.0 0.0.0.255
Switch(Config)access-list 103 permit ip 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255
Switch(Config)access-list 103 permit udp any any eq bootpc
Switch(Config)access-list 103 permit udp any any eq tftp
Switch(Config)access-list 103 permit udp any eq bootpc any
Switch(Config)access-list 103 permit udp any eq tftp any
Switch(Config)access-list 104 permit ip 192.168.2.0 0.0.0.255 192.168.4.0 0.0.0.255
Switch(Config)access-list 104 permit ip 192.168.4.0 0.0.0.255 192.168.2.0 0.0.0.255
Switch(Config)access-list 104 permit udp any eq tftp any
Switch(Config)access-list 104 permit udp any eq bootpc any
Switch(Config)access-list 104 permit udp any eq bootpc any
Switch(Config)access-list 104 permit udp any eq tftp any
</screen>
<para>应用访问控制列表</para>
<screen>
Switch(Config)int Vlan 3
Switch(Config-vlan)ip access-group 103 out
Switch(Config-vlan)int Vlan 4
Switch(Config-vlan)ip access-group 104 out
</screen>
<para>结束并保存配置</para>
<screen>
Switch(Config-vlan)End
Switch#write memory
</screen>
</section>
<section id="switch.speed">
<title>流量控制</title>
<screen>
<![CDATA[
]]>
</screen>
<section>
<title>粗糙的流量限制</title>
<screen>
Switch(config-if)#speed ?
10 Force 10 Mbps operation
100 Force 100 Mbps operation
auto Enable AUTO speed configuration
Switch(config-if)#speed 10
</screen>
</section>
<section>
<title>bandwidth</title>
<screen>
access-list 10 permit host 172.16.1.222
class-map ftp
match access-group 10
exit
policy-map ftp
class ftp
bandwidth 100000
exit
</screen>
</section>
<section>
<title>priority</title>
<screen>
access-list 20 permit host 172.16.1.222
class-map web
match access-group 20
exit
policy-map web
class web
police 1024000 1024000 conform-action drop
interface FastEthernet0/0
ip address 10.10.10.11 255.255.255.0
service-policy output bandwidth
</screen>
</section>
</section>
<section id="stack-manager">
<title>stack-manager</title>
<screen>
察看当前堆叠状态:
show platform stack-manager all 显示所有交换堆叠的信息
show switch 显示堆叠交换机的汇总信息
show switch 1 显示一号交换机的信息
show switch detail 显示堆叠成员明细的信息
show switch neighbors 显示堆叠邻居的完整信息
show switch stack-ports 显示堆叠交换机的完整端口信息
</screen>
<screen>
3750#show platform stack-manager all
Switch/Stack Mac Address : aca0.165f.9800
H/W Current
Switch# Role Mac Address Priority Version State
----------------------------------------------------------
1 Member 0000.0000.0000 0 0 Provisioned
2 Member 40f4.ec3c.6780 1 0 Ready
*3 Master aca0.165f.9800 1 0 Ready