交換綜合實驗(基礎)

實驗拓撲:
 
 
 
實驗要求:
 
 
在交換機上面配置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 未註冊版,感謝小凡
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章