实验拓扑:
 
 
 
实验要求:
 
 
在交换机上面配置VLAN,TRUNK,VTP,STP,SPANNING TREE PORTFAST(速端口)和UPLINKFAST(上行速链路).
在路由器上面配置单臂路由实现不同VLAN 之间通讯,配置双向HSRP 热备份组,实现负载均衡.
 
配置部分:
 
 
1.SW1 配置:

SW1#vlan database
SW1(vlan)#vlan 2
SW1(vlan)#vlan 3
SW1(vlan)#vtp server
SW1(vlan)#vtp domain sy
SW1(vlan)#vtp password cisco
SW1(vlan)#vtp pruning
SW1(vlan)#exit
SW1#conf t
SW1(config)#int rang f0/1 - 5
SW1(config-if-range)#switchport mode trunk
SW1(config-if-range)#exit
SW1(config)#int range f0/3 - 4
SW1(config-if-range)#channel-group 1 mode on // 配置以太通道
SW1(config-if-range)#end

2.SW2 配置:

SW2#vlan database
SW2(vlan)#vtp server
SW2(vlan)#vtp domain sy
SW2(vlan)#vtp password cisco
SW2(vlan)#exit
SW2#conf t
SW2(config)#int range f0/1 - 5
SW2(config-if-range)#switchport mode trunk
SW2(config-if-range)#exit
SW2(config)#int range f0/3 - 4
SW2(config-if-range)#channel-group 1 mode on // 配置以太通道
SW2(config-if-range)#end

3.SW3 配置:

SW3#vlan database
SW3(vlan)#vtp client
SW3(vlan)#vtp domain sy
SW3(vlan)#vtp password cisco
SW3(vlan)#exit
SW3#conf t
SW3(config)#int rang f0/1 -2
SW3(config-if-range)#int rang f0/1 - 2
SW3(config-if-range)#switchport mode trunk
SW3(config-if-range)#end

4.SW4 配置:

SW4#vlan database
SW4(vlan)#vtp client
SW4(vlan)#vtp domain sy
SW4(vlan)#vtp password cisco
SW4(vlan)#exit
SW4#conf t
SW4(config)#int range f0/1 - 2
SW4(config-if-range)#switchport mode trunk
SW4(config-if-range)#end
SW4#conf t
SW4(config)#spanning-tree uplinkfast
SW4(config)#int f0/4
SW4(config-if)#spanning-tree portfast
SW4(config-if)#end

5.SW3 配置:

SW3#conf t
SW3(config)#spanning-tree uplinkfast
SW3(config)#int f0/4
SW3(config-if)#spanning-tree portfast
SW3(config-if)#exit
SW3(config)#end

6.SW2 配置:

SW2#conf t
SW2(config)#spanning-tree vlan 3 priority 4096 // (spanning-tree vlan 3 root primary)设置为VLAN3 的根桥
SW2(config)#end

7.SW1 配置:

SW1#conf t
SW1(config)#spanning-tree vlan 2 priority 4096 // (spanning-tree vlan 2 root primary)设置为VLAN2 的根桥
SW1(config)#end

8.R1 配置:

R2#conf t
R1(config)#int f0/0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#int f0/0.1
R1(config-subif)#encapsulation dot1Q 1 // HSRP 配置部分
R1(config-subif)#ip address 192.168.1.254 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#exit
R1(config)#int f0/0.2
R1(config-subif)#encapsulation dot1q 2
R1(config-subif)#ip address 192.168.2.254 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#exit
R1(config-subif)#int f0/0.3
R1(config-subif)#encapsulation dot1q 3
R1(config-subif)#ip address 192.168.3.254 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#exit
R1(config)#int f0/0.1
R1(config-subif)#standby 1 ip 192.168.1.1
R1(config-subif)#standby 1 priority 200
// 默认优先级为100,这里更改为200 是使其成为活跃路由器
R1(config-subif)#standby 1 preempt
// 配置抢占,使得本路由器从DOWN 中恢复了后仍可以抢占为活跃路由器
R1(config-subif)#exit
R1(config)#int f0/0.2
R1(config-subif)#standby 2 ip 192.168.2.1
R1(config-subif)#standby 2 priority 200
R1(config-subif)#standby 2 preempt
R1(config-subif)#exit
R1(config)#int f0/0.3
R1(config-subif)#standby 3 ip 192.168.3.1

9.R2 配置:

R2#conf t
R2(config)#int f0/0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#int f0/0.2 //HSRP 配置部分
R2(config-subif)#encapsulation dot1q 253 255.255.255.0
R2(config-subif)#no shutdown
R2(config-subif)#int f0/0.3
R2(config-subif)#encapsulation dot1q 3
R2(config-subif)#ip address 192.168.3.253 255.255.255.0
R2(config-subif)#no shutdown
R2(config-subif)#exit
R2(config)#int f0/0.1
R2(config-subif)#encapsulation dot1Q 1
R2(config-subif)#ip address 192.168.1.253 255.255.255.0
R2(config-subif)#no shutdown
R2(config-subif)#end
R2(config-subif)#exit
 
R2(config)#int f0/0.1 //这一部分没有配置抢占,它将成为备用路由器
R2(config-subif)#standby 1 ip 192.168.1.1
R2(config-subif)#exit
R2(config)#int f0/0.2
R2(config-subif)#standby 2 ip 192.168.2.1
R2(config-subif)#exit
R2(config)#int f0/0.3
R2(config-subif)#standby 3 ip 192.168.3.1
R2(config-subif)#standby 3 priority 200
R2(config-subif)#standby 3 preempt

10.客户机配置:

PC1:
IP:192.168.2.2/24
GW:192.168.2.1 //这里的网关地址实际上是虚拟出来的地址,真正转发数据的是活跃路由器
PC3:
IP:192.168.3.3/24
GW:192.168.3.1
 
实验效果验证部分:

sw3#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/3, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15
2 VLAN0002 active Fa0/4
3 VLAN0003 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
sw3#
sw3#sho vtp status
VTP Version : 2
Configuration Revision : 1
Maximum VLANs supported locally : 256
Number of existing VLANs : 7
VTP Operating Mode : Client
VTP Domain Name : sy
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xC6 0xB6 0xCD 0xF2 0xA5 0x97 0x3C 0x7B
Configuration last modified by 0.0.0.0 at 3-1-02 00:16:27
r1#show standby brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Fa0/0.1 1 100 P Active local 192.168.1.253 192.168.1.1
Fa0/0.2 2 200 P Active local 192.168.2.253 192.168.2.1
Fa0/0.3 3 100 Standby 192.168.3.253 local 192.168.3.1
r1#
r2#sho standby brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Fa0/0.1 1 100 Standby 192.168.1.254 local 192.168.1.1
Fa0/0.2 2 100 Standby 192.168.2.254 local 192.168.2.1
Fa0/0.3 3 200 P Active local 192.168.3.254 192.168.3.1
r2#show standby
FastEthernet0/0.1 - Group 1
State is Standby
4 state changes, last state change 00:06:53
Virtual IP address is 192.168.1.1
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.716 secs
Preemption disabled
Active router is 192.168.1.254, priority 100 (expires in 8.364 sec)
Standby router is local
Priority 100 (default 100)
IP redundancy name is "hsrp-Fa0/0.1-1" (default)
FastEthernet0/0.2 - Group 2
State is Standby
4 state changes, last state change 00:06:53
Virtual IP address is 192.168.2.1
Active virtual MAC address is 0000.0c07.ac02
Local virtual MAC address is 0000.0c07.ac02 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.824 secs
Preemption disabled
Active router is 192.168.2.254, priority 200 (expires in 8.348 sec)
Standby router is local
Priority 100 (default 100)
IP redundancy name is "hsrp-Fa0/0.2-2" (default)
FastEthernet0/0.3 - Group 3
State is Active
2 state changes, last state change 00:09:31
Virtual IP address is 192.168.3.1
Active virtual MAC address is 0000.0c07.ac03
Local virtual MAC address is 0000.0c07.ac03 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.048 secs
Preemption enabled
Active router is local
Standby router is 192.168.3.254, priority 100 (expires in 8.676 sec)
Priority 200 (configured 200)
IP redundancy name is "hsrp-Fa0/0.3-3" (default)
r2#
pc2#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 = 60/84/108 ms
pc2#
pc2#
pc2#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 80 percent (4/5), round-trip min/avg/max = 60/66/76 ms
pc2#
pc2#
pc2#ping 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/45/76 ms
pc2#
 
本实验平台基于 DynamipsGUI 2.83 未注册版,感谢小凡