思科HSRPVRRP双组双备

 

 

 

思科HSRP和VRRP双组双备_思科

 

 

 

R1#conf t

R1(config)#int fa0/1

R1(config-if)#ip add 13.0.0.1 255.255.255.0

R1(config-if)#no shut

R1(config-if)#exit

R1(config)#

*Mar  1 00:02:10.087: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up

*Mar  1 00:02:11.095: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

R1(config)#ip ro

R1(config)#ip route 0.0.0.0 0.0.0.0 13.0.0.3

R1(config)#int fa0/0

R1(config-if)#ip add 192.168.10.10 255.255.255.0

R1(config-if)#no shut

R1(config-if)#standby 1 ip 192.168.10.1   配置一个虚拟的ip地址

R1(config-if)#standby 1 priority 120       优先级

R1(config-if)#standby 1 preempt         抢占

R1(config-if)#standby 1 track fa0/1         跟踪上行口

R1(config-if)#

*Mar  1 00:09:14.259: %CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on FastEthernet0/0 (not full duplex),                                                           

R1(config-if)#end

R1#show standby brief       HSRP状态

                   P indicates configured to preempt.

                   |

Interface Grp  Pri P State   Active          Standby         Virtual IP

Fa0/0     1    120 P Active  local           unknown         192.168.10.1

R1#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#def

R1(config)#defa

R1(config)#default int

R1(config)#default interface fa0/0

R1(config-if)#no shut

R1(config-if)#int fa0/0.10

R1(config-subif)#encapsulation dot1Q 10

R1(config-subif)#ip add 192.168.10.01 255.255.255.0

R1(config-subif)#no shut                                                         

R1(config-subif)#standby 1 ip 192.168.10.1

R1(config-subif)#standby 1 preempt

R1(config-subif)#standby 1 track

R1(config-subif)#standby 1 track fa0/1

R1(config-subif)#exit

R1(config)#end

R1#show standby brief

思科HSRP和VRRP双组双备_HSRP _02 

思科HSRP和VRRP双组双备_HSRP _03

R1(config)#int fa0/0.20

R1(config-subif)#en

R1(config-subif)#encapsulation d

R1(config-subif)#encapsulation dot1Q 20

R1(config-subif)#ip add 192.168.20.10 255.255.255.0

R1(config-subif)#no shut

R1(config-subif)#vrrp 1 ip 192.168.20.1

R1(config-subif)#vrrp 1 preempt     抢占

R1(config-subif)# vrrp 1 priority  95    低优先级

R1(config-subif)#vrrp 1 authentication md5 key-string  7  

 

思科HSRP和VRRP双组双备_思科_04 

vrrp比hsrp更安全          Vrrp可以进行身份验证

R1#show vrrp brief

Interface          Grp Pri Time  Own Pre State   Master addr     Group addr

Fa0/0.20           1   95  3628       Y  Backup  192.168.20.20   192.168.20.1

 

 

 

R2#conf t

R2(config)#int fa0/1

R2(config-if)#ip add 23.0.0.2 255.255.255.0

R2(config-if)#no  shut

R2(config-if)#exit

R2(config)#ip route 0.0.0.0 0.0.0.0 23.0.0.3

R2(config)#do p 1.1.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:

.!!!!

R2(config)#int fa0/0

R2(config-if)#ip add 192.168.10.20 255.255.255.0

R2(config-if)#no shut

R2(config-if)#do p 192.168.10.10

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.10.10, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 20/27/32 ms

R2(config-if)#st

R2(config-if)#standby

R2(config-if)#standby 1 ip 192.168.10.1

R2(config-if)#standby 1 priority 115        比上行口低

R2(config-if)#standby 1 preempt

不用跟踪上行口 已经是备用的

 

R2(config-if)#end

R2#show standby brief      HSRP状态

                   P indicates configured to preempt.

                   |

Interface Grp  Pri P State   Active          Standby         Virtual IP

Fa0/0     1    115 P Standby 192.168.10.10   local           192.168.10.1

R2(config)#int fa0/0

R2(config-if)# default int fa0/0

R2(config)#int fa0/0

R2(config-if)#no shut

R2(config-if)#int fa0/0.10

R2(config-subif)#encapsulation dot1Q 10

R2(config-subif)#ip add 192.168.10.20 255.255.255.0

R2(config-subif)#no shut

R2(config-subif)#standby 1 ip 192.168.10.1

R2(config-subif)#standby 1 priority 95

R2(config-subif)#standby  1 preempt

R2(config-subif)#standby 1 preempt

R2(config-subif)#do show stan b

                   P indicates configured to preempt.

                   |

Interface Grp  Pri P State   Active          Standby         Virtual IP

Fa0/0.10  1    95  P Active  local           unknown         192.168.10.1

思科HSRP和VRRP双组双备_思科_05 

R2(config-subif)#exit

R2(config)#end

R2#show ip int b

Interface                  IP-Address      OK? Method Status                Protocol

FastEthernet0/0            unassigned      YES TFTP   up                    up

FastEthernet0/0.10         192.168.10.20   YES manual up                    up

FastEthernet0/1            23.0.0.2        YES manual up                    up

R2#conf t

R2(config)#int fa0/0.20

R2(config-subif)#encapsulation dot1Q 20

R2(config-subif)#ip add 192.168.20.20 255.255.255.0

R2(config-subif)#vrrp 1 ip 192.168.20.1

R2(config-subif)#vrrp 1 preempt   抢占

R2(config)#track 1 int fa0/1 line-protocol    track对象

R2(config)#int fa0/0.20

R2(config-subif)#vrrp  1 track 1

R2 vrrp已经配置完成

R2#show vrrp brief

Interface          Grp Pri Time  Own Pre State   Master addr     Group addr

Fa0/0.20           1   100 3609       Y  Master  192.168.20.20   192.168.20.1

 

 

 

R3(config)#int fa0/0

R3(config-if)#ip add 13.0.0.3 255.255.255.0

R3(config-if)#no shut

R3(config-if)#int fa0/1

R3(config-if)#ip add 23.0.0.3 255.255.255.0

R3(config-if)# no shut

R3(config-if)#exit

R3(config)#int loo 0

R3(config-if)#ip add 1.1.1.1 255.255.255.0 

R3(config-if)#ip route 192.168.10.0 255.255.255.0 13.0.0.1      配制回城路由

R3(config)#ip route 192.168.10.0 255.255.255.0 23.0.0.2 10       上面挂了走这个路由

R3(config)#end

R3#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is not set

 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

S    192.168.10.0/24 [1/0] via 13.0.0.1

     23.0.0.0/24 is subnetted, 1 subnets

C       23.0.0.0 is directly connected, FastEthernet0/1

     13.0.0.0/24 is subnetted, 1 subnets

C       13.0.0.0 is directly connected, FastEthernet0/0

R3#conft

R3(config)#ip route 192.168.20.0 255.255.255.0 23.0.0.2  做路由

R3(config)#ip route 192.168.20.0 255.255.255.0 13.0.0.1 10   1大就行

R3(config)#int fa0/1

R3(config-if)#shut

 

 

 

R4(config)#

R4(config)#vlan 10

R4(config-vlan)#vlan 20

R4(config-vlan)#int ran fa1/10 -11

R4(config-if-range)#switchport mode trunk

R4(config-if-range)#exit

R4(config)#int fa1/1

R4(config-if)#switchport access vlan  10

R4(config-if)#int fa1/2

R4(config-if)#switchport access vlan 20

 

 

PC的配置

 

思科HSRP和VRRP双组双备_HSRP _06 

 

 

 

 

 

 

 

 

 

 

验证:

思科HSRP和VRRP双组双备_思科_07 

 

  

 

 

C1从那边走的

 

思科HSRP和VRRP双组双备_HSRP _08 

 

C2从那边走的

思科HSRP和VRRP双组双备_VRRP_09 

 

把R2和R3fa0/1   shut  

思科HSRP和VRRP双组双备_HSRP _10 

 

看shut之后c2怎么走

思科HSRP和VRRP双组双备_VRRP_11