Thursday, August 29, 2013

HSRP protocol - host redundancy

Configure HSRP redundancy


HSRP is Cisco's standard method of providing high network availability by providing first-hop redundancy for IP hosts on an IEEE 802 LAN configured with a default gateway IP address.

In this blog we have a host that has no clue what is happening behind a switch it is connected to. Main goal we want to achieve in this scenario is to create a redundant links for the traffic that is not on the PC-s subnet. We will achieve a redundant plan if one router fails, other is routing for the remote subnets.

First we should configure the IP addresses of the XP1 client and the router interfaces connected to each end point. We will chose the 10.0.0.254 address as the active failover IP address. This address will be the virtual ip address as the default gateway for the XP client.



The config scripts look like this:

R1
interface FastEthernet0/0
 ip address 10.0.0.1 255.255.255.0
 duplex auto
 speed auto
 standby 1 ip 10.0.0.254  << virtual IP
 standby 1 timers 5 15   << hold down timers
 standby 1 priority 200  << HSRP priority (100 is default priority router)
 standby 1 preempt   << allows a router with a higher priority to become a master router
 standby 1 track FastEthernet1/0 110  << tracks changes on interfaces not configured with HSRP, if they fail

interface FastEthernet1/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 log-adjacency-changes
 passive-interface FastEthernet0/0
 network 0.0.0.0 255.255.255.255 area 0


R2
interface FastEthernet0/0
 ip address 10.0.0.2 255.255.255.0
 duplex auto
 speed auto
 standby 1 ip 10.0.0.254
 standby 1 timers 5 15
 standby 1 preempt
 standby 1 track FastEthernet1/0
!
interface FastEthernet1/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 log-adjacency-changes
 passive-interface FastEthernet0/0
 network 0.0.0.0 255.255.255.255 area 0

To verify that HSRP is running we use a simple show output. R1 is the active and R2 is the standby router. They have now agreed on the HSRP parameters and serving the Virtual IP 10.0.0.254 address.

R1#sh standby
FastEthernet0/0 - Group 1
  State is Active
    2 state changes, last state change 00:14:11
  Virtual IP address is 10.0.0.254
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 5 sec, hold time 15 sec
    Next hello sent in 3.660 secs
  Preemption enabled
  Active router is local
  Standby router is 10.0.0.2, priority 100 (expires in 13.904 sec)
  Priority 200 (configured 200)
    Track interface FastEthernet1/0 state Up decrement 110
  IP redundancy name is "hsrp-Fa0/0-1" (default)

R2#sh standby
FastEthernet0/0 - Group 1
  State is Standby
    1 state change, last state change 00:04:06
  Virtual IP address is 10.0.0.254
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 5 sec, hold time 15 sec
    Next hello sent in 3.196 secs
  Preemption enabled
  Active router is 10.0.0.1, priority 200 (expires in 12.932 sec)
  Standby router is local
  Priority 100 (default 100)
    Track interface FastEthernet1/0 state Up decrement 10
  IP redundancy name is "hsrp-Fa0/0-1" (default)

To join the same Backbone area I will configure the R3 router with the same area ID and exhange a loopback address of 172.16.1.1 for testing purposes.

R3
interface Loopback1
 ip address 172.16.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.1.3 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0

We can see in the Routing table of R3 router, that it received the 10.0.0.0/24 prefix with equal OSPF calculations, so the router will load balance the networks.
Gateway of last resort is not set

R3#show ip route
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Loopback1
     10.0.0.0/24 is subnetted, 1 subnets
O       10.0.0.0 [110/2] via 192.168.1.2, 00:06:48, FastEthernet0/0
                        [110/2] via 192.168.1.1, 00:06:48, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0

To make an initial test of the HSRP setup, I will let a continuous ping from the XP1 machine and shutdown one of the R1 interfaces, because this is the active router.


We have seen that if the transition from one state to another in the HSRP setup gained us succesfull redundancy with only 16% of lost traffic. This is minimal, and can be tuned to even less. Take a look at the log messages of the R1.

*Mar  1 00:43:14.339: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 1 state Active -> Init

Simple enough R2 became an Active router for the 10.0.0.254 virtual IP address. If the second interfaces did fail. The interfaces that is exchanging the OSPF data with the R3, convergence time will not only rely on the timers for the HSRP protocol. Convergence time will wait untill the OSPF proccess does the calculation, and updates the database with the neighbor down message.

This is all for now. Very cool technology.

Feel free to comment.

No comments:

Post a Comment