前言:不要求别人评价什么(不对之处可说明),只为自己做个笔记,谢谢
实验要求:配置vlan10和vlan20的HRSP
实验说明:下图中R1为sw1,R2为sw2,R3为sw3,R4为连接ISP的路由器,R5为ISP,R6为PC1(vlan10),R7为PC2(vlan20)。sw1和sw2上做HSRP。让某一链路down时,PC还能ping通ISP。
部分命令解释:standay group_id(1-255) ip ip_address(Virtual IP address) //开启HSRP,设置组序号,并设置虚拟IP。
priority:设置优先级(0-255);preempt:设置抢占;track:设置端口跟踪
实验拓扑:
R4:
Router>en
Router#conf t
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#ho TO_ISP
TO_ISP(config)#in f2/0
TO_ISP(config-if)#ip add 202.106.99.2 255.255.255.252
TO_ISP(config-if)#no shu
TO_ISP(config-if)#exit
TO_ISP(config)#in f0/0
TO_ISP(config-if)#ip add 10.1.41.1 255.255.255.252
TO_ISP(config-if)#no shu
TO_ISP(config-if)#exit
TO_ISP(config-if)#exit
TO_ISP(config)#in f1/0
TO_ISP(config-if)#ip add 10.1.42.1 255.255.255.252
TO_ISP(config-if)#no shu
TO_ISP(config-if)#exit
TO_ISP(config)#router ospf 110
TO_ISP(config-router)#net 202.106.99.0 0.0.0.3 area 0
TO_ISP(config-router)#net 10.1.41.0 0.0.0.3 area 0
TO_ISP(config-router)#net 10.1.42.0 0.0.0.3 area 0
TO_ISP(config-router)#pass f2/0
TO_ISP(config-router)#no au
TO_ISP(config-router)#exit
TO_ISP(config)#ip route 0.0.0.0 0.0.0.0 f2/0
TO_ISP(config)#
R5
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#ho ISP
ISP(config)#in f0/0
ISP(config-if)#ip add 202.106.99.1 255.255.255.252
ISP(config-if)#no shu
ISP(config-if)#exit
ISP(config)#ip route 0.0.0.0 0.0.0.0 f0/0
ISP(config)#
R1
Router>en
Router#conf t
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#ho sw1
sw1(config)#end
sw1#vl da
sw1#vl da
sw1(vlan)#vl 10
VLAN 10 added:
Name: VLAN0010
sw1(vlan)#vl 20
VLAN 20 added:
Name: VLAN0020
sw1(vlan)#exit
APPLY completed.
Exiting....
sw#conf t
sw1(config)#in f0/0
sw1(config-if)#ip add 10.1.41.2 255.255.255.252
sw1(config-if)#no shu
sw1(config-if)#exit
sw1(config)#in f1/0
sw1(config-if)#sw mo tr
sw1(config-if)#exit
sw1(config)#in vl 10
sw1(config-if)#ip add 192.168.1.1 255.255.255.0
sw1(config-if)#stan 10 ip 192.168.1.254 //配置虚拟IP
sw1(config-if)#stan 10 pree //配置抢占
sw1(config-if)#stan 10 pri 150 //配置优先级
sw1(config-if)#stan 10 trac f0/0 100 //配置端口跟踪,端口出现问题,优先级减少100
sw1(config-if)#stan 10 trac f1/0 100
sw1(config-if)#exit
sw1(config)#in vl 20
sw1(config-if)#ip add 172.16.1.1 255.255.255.0
sw1(config-if)#stan 20 ip 172.16.1.254
sw1(config-if)#stan 20 pree
sw1(config-if)#exit
sw1(config)#router ospf 110
sw1(config-router)#no au
sw1(config-router)#net 10.1.42.0 0.0.0.3 area 0
sw1(config-router)#net 192.168.1.0 0.0.0.255 area 0
sw1(config-router)#net 172.16.1.0 0.0.0.255 area 0
sw1(config-router)#exit
sw1(config)#
R2
Router>en
Router#conf t
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#ho sw2
sw2(config)#end
sw2#vl da
sw2#vl da
sw2(vlan)#vl 10
VLAN 10 added:
Name: VLAN0010
sw2(vlan)#vl 20
VLAN 20 added:
Name: VLAN0020
sw2(vlan)#exit
APPLY completed.
Exiting....
sw2#conf t
sw2(config)#in f0/0
sw2(config-if)#ip add 10.1.42.2 255.255.255.252
sw2(config-if)#no shu
sw2(config-if)#exit
sw2(config)#in f1/0
sw2(config-if)#sw mo tr
sw2(config-if)#exit
sw2(config)#in vl 10
sw2(config-if)#ip add 192.168.1.2 255.255.255.0
sw2(config-if)#stan 10 ip 192.168.1.254
sw2(config-if)#stan 10 pree
sw2(config-if)#exit
sw2(config)#in vl 20
sw2(config-if)#ip add 172.16.1.2 255.255.255.0
sw2(config-if)#stan 20 ip 172.16.1.254
sw2(config-if)#stan 20 pree
sw2(config-if)#stan 20 pri
sw2(config-if)#stan 20 pri 150
sw2(config-if)#stan 20 trac f0/0 100
sw2(config-if)#stan 20 trac f1/0 100
sw2(config-if)#exit
sw2(config)#router ospf 110
sw2(config-router)#no au
sw2(config-router)#net 10.1.42.0 0.0.0.3 area 0
sw2(config-router)#net 192.168.1.0 0.0.0.255 area 0
sw2(config-router)#net 172.16.1.0 0.0.0.255 area 0
sw2(config-router)#exit
sw2(config)#
R3
Router>en
Router#vl da
Router(vlan)#vl 10
VLAN 10 added:
Name: VLAN0010
Router(vlan)#vl 20
VLAN 20 added:
Name: VLAN0020
Router(vlan)#exit
APPLY completed.
Exiting....
Router#conf t
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#ho sw3
sw3(config)#in ra f1/0 - 1
sw3(config-if-range)#sw mo tr
sw3(config-if-range)#exit
sw3(config)#in f1/14
sw3(config-if)#sw ac vl 10
sw3(config-if)#exit
sw3(config)#in f1/15
sw3(config-if)#sw ac vl 20
sw3(config-if)#exit
R6
Router>en
Router#conf t
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#ho PC1
PC1(config)#in f0/0
PC1(config-if)#ip add 192.168.1.10 255.255.255.0
PC1(config-if)#no shu
PC1(config-if)#exit
PC1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.254
PC1(config)#do ping 192.168.1.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 24/34/48 ms
PC1(config)#
R7
Router>en
Router#conf t
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#in f0/0
Router(config-if)#ip add 172.16.1.10 255.255.255.0
Router(config-if)#no shu
Router(config-if)#exit
Router(config)#ho PC2
PC2(config)#ip route 0.0.0.0 0.0.0.0 172.16.1.254
PC2(config)#do ping 172.16.1.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/28/48 ms
PC2(config)#
验证1:PC是否能ping通ISP
PC1:PC1(config)#do ping 202.106.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.106.99.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 52/67/80 ms
PC1(config)#
PC2:PC2(config)#do ping 202.106.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.106.99.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 48/62/72 ms
PC2(config)#
验证2:将sw1或sw2的f1/0或f0/0任意接口down掉,看是否能通
sw1(config)#in f1/0
sw1(config-if)#shu
sw1(config-if)#
PC1(config)#do ping 202.106.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.106.99.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/67/88 ms
PC2(config)#do ping 202.106.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.106.99.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/82/104 ms
总结:断掉任意端口,PC还能和ISP通信,说明HSRP配置正确。