分类: 系统运维
2009-07-17 21:59:59
实验目的:
1、掌握VTP配置方法。
2、掌握VLAN间路由配置方法以及子接口的配置。
实验拓扑图:
实验步骤及要求:
1、配置PC1、PC2和PC3用于模拟主机,配置如下:
PC1(config)#[stanley1] PC1(config)# PC1(config)#[stanley2] PC1(config)# PC1(config)#interface fastEthernet 0/0 PC1(config-if)#ip address 192.168.1.10 255.255.255.0 PC1(config-if)#no shutdown PC1(config-if)#exit PC1(config)# |
PC2(config)#no ip routing PC2(config)# PC2(config)#ip default-network 192.168.2.1 PC2(config)# PC2(config)#interface fastEthernet 0/0 PC2(config-if)#ip address 192.168.2.10 255.255.255.0 PC2(config-if)#no shutdown PC2(config-if)#exit PC2(config)# |
PC3(config)#no ip routing PC3(config)# PC3(config)#ip default-network 192.168.2.1 PC3(config)# PC3(config)#interface fastEthernet 0/0 PC3(config-if)#ip address 192.168.2.20 255.255.255.0 PC3(config-if)#no shutdown PC3(config-if)#exit PC3(config-if)# |
2、首先配置SW1与SW2的TRUNK,配置如下:
SW1(config)#interface fastEthernet 1/1 SW1(config-if)#[stanley3] SW1(config-if)#[stanley4] SW1(config-if)#exit |
SW2(config)#interface fastEthernet 1/2 SW2(config-if)#[stanley5] SW2(config-if)#switchport mode trunk SW2(config-if)#exit |
3、查看TRUNK信息:
SW2#show interfaces trunk Port Mode Encapsulation Status Native vlan Fa1/2 1-1005 Port Vlans allowed and active in management domain Fa1/2 1 Port Vlans in spanning tree forwarding state and not pruned Fa1/2 1 SW2# |
4、在配置VTP协议之前,先查看SW1或SW2的VTP的状态:
SW2#show vtp status Maximum VLANs supported locally : 256 Number of existing VLANs : 5 VTP Domain Name : VTP V2 Mode : Disabled VTP Traps Generation : Disabled Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 Local updater ID is 0.0.0.0 (no valid interface found) |
5、配置SW1与SW2的VTP协议:
SW1#vlan database SW1(vlan)#[stanley13] Changing VTP domain name from NULL to ccnp SW1(vlan)# SW1(vlan)#[stanley14] Device mode already VTP SERVER. SW1(vlan)# SW1(vlan)#[stanley15] Setting device VLAN database password to cisco. SW1(vlan)# SW1(vlan)#[stanley16] SW1(vlan)# |
也可以从全局配置模式,配置VTP协议:
SW2(config)#[stanley17] Setting device VLAN database password to cisco SW2(config)# SW2(config)#[stanley18] Changing VTP domain name from fuckcisco to ccnp SW2(config)# SW2(config)#[stanley19] Pruning switched on SW2(config)# SW2(config)#[stanley20] Setting device to VTP CLIENT mode. SW2(config)# |
6、查看SW1或是SW2的VTP的状态信息:
SW2#show vtp status VTP Version : 2 Configuration Revision : 1 Maximum VLANs supported locally : 1005 Number of existing VLANs : 10 VTP Operating Mode : Client VTP Domain Name : ccnp VTP Pruning Mode : Enabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x71 0x62 0x0B 0xD1 0xED 0xFD 0x7D 0xAC Configuration last modified by 199.1.1.3 at 3-2-93 02:11:08 SW2# |
7、在SW1和SW2上创建VLAN:
SW1#[stanley21] SW1(vlan)#[stanley22] VLAN 10 added: Name: cisco SW1(vlan)#exit APPLY completed. Exiting.... SW1# SW1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. SW1(config)# SW1(config)#[stanley23] SW1(config-vlan)#[stanley24] SW1(config-vlan)#exit |
8、查看SW1的VLAN配置:
SW1#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa1/0, Fa1/2, Fa1/3, Fa1/4 Fa1/5, Fa1/6, Fa1/7, Fa1/8 Fa1/9, Fa1/10, Fa1/11, Fa1/12 Fa1/13, Fa1/14, Fa1/15 20 microsoft active [stanley25] 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 1002 1003 10 enet 100010 1500 - - - - - 0 0 20 enet 100020 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 1 1003 1003 tr 101003 1500 1005 0 - - srb 1 1002 1004 fdnet 101004 1500 - - 1 ibm - 0 0 1005 trnet 101005 1500 - - 1 ibm - 0 0 SW1# |
9、查看VTP的状态信息:
SW1#show vtp status VTP Version : 2 Maximum VLANs supported locally : 256 Number of existing VLANs : 7 VTP Operating Mode : Server VTP Domain Name : ccnp VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0xF3 0x1C 0x33 0x46 0xEA 0x14 0xBB 0x9F Configuration last modified by 0.0.0.0 at 3-1-02 00:52:53 Local updater ID is 0.0.0.0 (no valid interface found) SW1# |
10、查看SW2的VTP的状态信息:
SW2#show vtp status VTP Version : 2 Maximum VLANs supported locally : 256 Number of existing VLANs : 7 VTP Operating Mode : Client VTP Domain Name : ccnp VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0xF3 0x1C 0x33 0x46 0xEA 0x14 0xBB 0x9F Configuration last modified by 0.0.0.0 at 3-1-02 00:52:53 SW2# |
11、查看SW2的VLAN信息:
SW1#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13, Fa0/14 Fa0/15, Fa0/16, Fa0/17, Fa0/18 Fa0/19, Fa0/20, Fa0/21, Fa0/22 Fa0/23, Fa0/24, Gi0/1, Gi0/2 20 microsoft active [stanley28] 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup ………… |
12、在SW1和SW2上将相应VLAN的主机端口加入到VLAN:
SW1(config)#interface fastEthernet 1/11 SW1(config-if)#[stanley29] SW1(config-if)#exit SW1(config)# SW1(config)#interface fastEthernet 1/12 SW1(config-if)#switchport access vlan 20 SW1(config-if)#exit |
在SW2上配置VLAN:
SW2(config)#interface fastEthernet 1/11 SW2(config-if)#switchport access vlan 20 SW2(config-if)#exit |
13、在PC1和PC2及PC3上使用ping命令测试VLAN间的通信:
PC1#ping 192.168.1.20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.20, timeout is 2 seconds: Success rate is 0 percent (0/5) PC1# |
PC2#ping 192.168.2.20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.20, timeout is 2 seconds: Success rate is 80 percent (4/5), round-trip min/avg/max = 24/24/24 ms PC2# PC2#ping 192.168.1.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds: Success rate is 0 percent (0/5) PC2# |
PC3#ping 192.168.2.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.10, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/18/32 ms PC3# PC3#ping 192.168.1.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) PC3# |
14、在R1上配置单臂路由,确保两个VLAN之间通信。
15、首先配置R1与SW1之间的TRUNK链路,配置如下:
SW1(config)#interface fastEthernet 1/5 SW1(config-if)#switchport trunk encapsulation dot1q SW1(config-if)# SW1(config-if)#switchport mode trunk SW1(config-if)#exit |
R1(config)# R1(config)#interface fastEthernet 0/0 R1(config-if)#no shutdown [stanley33] R1(config-if)#exit R1(config)# R1(config)#[stanley34] R1(config-subif)#[stanley35] R1(config-subif)#[stanley36] R1(config-subif)#exit R1(config)# R1(config)#interface fastEthernet 0/0.20 R1(config-subif)#encapsulation dot1Q 20 R1(config-subif)#ip address 192.168.2.1 255.255.255.0 R1(config-subif)#exit R1(config)# |
16、查看R1的路由表:
R1#show ip route Gateway of last resort is not set C 192.168.2.0/24 is directly connected, FastEthernet0/0.20 [stanley37] R1# |
17、在PC1、PC2和PC3使用ping命令测试VLAN间路由:
PC1#ping 192.168.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 16/232/1040 ms PC1# PC1#ping 192.168.2.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 4/223/1012 ms PC1# PC1#ping 192.168.2.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.10, timeout is 2 seconds: Success rate is 60 percent (3/5), round-trip min/avg/max = 12/48/92 ms PC1# PC1#ping 192.168.2.20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.20, timeout is 2 seconds: ..!!! Success rate is 60 percent (3/5), round-trip min/avg/max = 20/52/96 ms PC1# |
PC2#ping 192.168.1.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 20/48/88 ms PC2# |
PC3#ping 192.168.1.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 12/50/88 ms PC3# |
18、实验完成。