Friday, November 18, 2011

How HSRP Works

The point of this blog is to help others who are currently seeking out their CCNP certification.  I will take topics from the "Implementing Cisco Switched Networks (SWITCH)" book and try to get as detailed as possible.  If you are like me, you need to see what is actually happening on the network to understand and remember the concepts of networking. I will begin with Cisco's proprietary standby protocol: HSRP.

What the book doesn't provide is a good visualization of how HSRP broadcasts packets during a failover or normal operation.  Please read RFC2281:

From Cisco Academy Network:

“HSRP is a redundancy protocol developed by Cisco to provide gateway redundancy without any additional configuration on the end devices in the subnet. With HSRP configured between a set of routers, they work in concert to present the appearance of a single virtual router to the hosts on the LAN. By sharing an IP address and a MAC (Layer 2) address, two or more routers can act as a single virtual router.”



“The IP address of the virtual router will be configured as the default gateway for the workstations on a specific IP segment. When frames are to be sent from the workstation to the default gateway, the workstation uses ARP to resolve the MAC address associated with the IP address of the default gateway. The ARP resolution returns the MAC address of the virtual router. Frames sent to the MAC address of the virtual router can then be physically processed by the active router that is part of that virtual router group. The physical router that forwards this traffic is transparent to the end stations.”



“HSRP provides the mechanism for determining which router should take the active role in forwarding traffic. HSRP also has a mechanism to determine when that active role must be taken over by a standby router. The transition from one forwarding router to another is transparent to the end devices.”



Read on 5.3 – states,5.5 – events, 5.6 – actions.  These definitions have associated codes that will be referenced in a highly useful table for predicting the behavior of HSRP.  I will use this table to predict the behavior of shutting down an active HSRP router in my home lab.

HSRP states (Section 5.3):

1. Initial
This is the starting state and indicates that HSRP is not running.
This state is entered via a configuration change or when an
interface first comes up.
2. Learn
The router has not determined the virtual IP address, and not yet
seen an authenticated Hello message from the active router. In
this state the router is still waiting to hear from the active
router.
3. Listen
The router knows the virtual IP address, but is neither the active
router nor the standby router. It listens for Hello messages from
those routers.
4. Speak
The router sends periodic Hello messages and is actively
participating in the election of the active and/or standby router.
A router cannot enter Speak state unless it has the virtual IP
address.
5. Standby
The router is a candidate to become the next active router and
sends periodic Hello messages. Excluding transient conditions,
there MUST be at most one router in the group in Standby state.
6. Active
The router is currently forwarding packets that are sent to the
group's virtual MAC address. The router sends periodic Hello
messages. Excluding transient conditions, there MUST be at most
one router in Active state in the group.
 
HSRP Events (Section 5.5):
 
These are the events in the HSRP finite state machine.
           a - HSRP is configured on an enabled interface.
           b - HSRP is disabled on an interface or the interface is disabled.
           c - Active timer expiry. The Active timer was set to the Holdtime
           when the last Hello message was seen from the active router.
           d - Standby timer expiry. The Standby timer was set to the
           Holdtime when the last Hello message was seen from the standby
           router.
           e - Hello timer expiry. The periodic timer for sending Hello
           messages has expired.
           f - Receipt of a Hello message of higher priority from a router in
           Speak state.
           g - Receipt of a Hello message of higher priority from the active
           router.
           h - Receipt of a Hello message of lower priority from the active
                router.
           i - Receipt of a Resign message from the active router.
           j - Receipt of a Coup message from a higher priority router.
           k - Receipt of a Hello message of higher priority from the standby
           router.
           l - Receipt of a Hello message of lower priority from the standby
           router.


HSRP Actions (Section 5.6):

A Start Active Timer
         If this action occurred as the result of the receipt of a an
         authenticated Hello message from the active router, the Active
         timer is set to the Holdtime field in the Hello message.
         Otherwise the Active timer is set to the current Holdtime value
         in use by this router. The Active timer is then started.
B Start Standby Timer
         If this action occurred as the result of the receipt of an
         authenticated Hello message from the standby router, the
         Standby timer is set to the Holdtime field in the Hello
         message. Otherwise the Standby timer is set to the current
         hold time value in use by this router. The Standby timer is
         then started.
C Stop Active Timer
The Active timer is stopped.
D Stop Standby Timer
The Standby timer is stopped.
E Learn Parameters
This action is taken when an authenticated message is received
from the active router. If the virtual IP address for this
group was not manually configured, the virtual IP address MAY
be learned from the message. The router MAY learn Hellotime
and Holdtime values from the message.
F Send Hello Message
The router sends a Hello message with its current State,
Hellotime and Holdtime.
G Send Coup Message
The router sends a Coup message to inform the active router
that there is a higher priority router available.
H Send Resign Message
The router sends a Resign message to allow another router to
become the active router.
I Send Gratuitous ARP Message
The router broadcasts an ARP response packet advertising the
group's virtual IP address and virtual MAC address. The packet
is sent using the virtual MAC address as the source MAC address
in the link layer header, as well as within the ARP packet.

RFC 2281 Table:


                   
3 timers - active timer, standby timer, hello timer

1.       Active timer - monitor active router, expires in the holdtime

2.       Standby timer - monitor the standby router, started when hello message is seen from standby router

3.       Hello timer - expires once per hellotime period (default 3 seconds), if router is in speak/standby/active states it should generate a hello message upon hello timer expiry

Note: coup message is sent when a router wants to become and active router during preemption

Part 1 - shutting down active router in HSRP

  1. Run continuous ping from laptop – 172.16.10.100 to gateway ip 172.16.10.1
  2. Shut down all interfaces on DLS1.  Int range fa0/7 -12. Shutdown command
  3.  On standby router - hold time expires (3 x hello), (CDFI/6 - stop active/standby timers, send hello message, send GARP, transition to active)
       


    4. Standby now sending advertise active messages:



   5. Gratuitous ARP sent after standby becomes active:


    6. Standby promotes to active.  ARPs for laptops mac address:



    7. Ping can now reply:



        

Part 2 – Preempt
1.       DLS1 comes back up and preempts. DLS2: ABH/4 - start active/standby timer, send resign message, transition to speak.  
2.       DLS1 router receives hello message of lower priority from DLS2 active router.
3.       DLS1 router: BGFI/6 - start standby timer, send coup, send hello, send GARP, transition to active.
4.       172.16.10.3 sends a coup message in the listen state, it wants to become active.  Next packet 172.16.10.3 says hello I’m active!  Send GARP.  172.16.10.4 sends hello message in speak state.


5.       Hello exchanged from original router saying I have higher priority:


6.       Active router now is the original router that went down
7.       Screenshot of DLS1 – 172.16.10.3

8.       Previous active Router goes from active -> speak (standby timer times out, transition from speak to standby)
9.       Screenshot of DLS2 – 172.16.10.4


10.   Standby router is local, speak -> standby (EA: learn, start active timer)

           Question for readers:

  1.       Is the resign message a broadcast?  I did not receive this packet on my access port on ALS1
     Additional reading:
  1. Visual animation of HSRP: visualland.net
  2. RFC 2281: http://www.ietf.org/rfc/rfc2281.txt




60 comments:

  1. Thanks for sharing such useful information on the blog and refer the link Oracle Training in Chennai

    ReplyDelete
  2. Awesome article........... very helpful

    ReplyDelete

  3. My cousin recommended this blog and she was totally right keep up the fantastic work!


    Modular Workstations Chennai

    ReplyDelete
  4. This is first time, I have come across your site. You have shared useful details with me.
    Oracle dba training | Oracle dba training syllabus

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again

    soon.
    PSD to Wordpress
    wordpress website development

    ReplyDelete
  7. Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.
    Digital Marketing online training

    full stack developer training in pune

    full stack developer training in annanagar

    full stack developer training in tambaram

    full stack developer training in velachery

    ReplyDelete
  8. "I like this post,And I guess that they having fun to read this post,they shall take a good site to make a information,thanks for sharing it to me.
    Read more here:
    kim kardashian sex tape
    porn sex video hd
    mia khalifa sex video
    sunny leone sexy movie"

    ReplyDelete
  9. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Devops Training in pune|Devops training in tambaram|Devops training in velachery|Devops training in annanagar
    DevOps online Training|DevOps Training in USA
    Devops Training in Chennai

    Devops Training in Bangalore

    ReplyDelete
  10. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    python training in chennai
    python training in Bangalore

    ReplyDelete
  11. Fantastic work! This is the type of information that should follow collective approximately the web. Embarrassment captivating position Google for not positioning this transmit higher! Enlarge taking place greater than and visit my web situate

    Data Science training in rajaji nagar
    Data Science training in chennai
    Data Science training in electronic city
    Data Science training in USA
    Data science training in pune
    Data science training in kalyan nagar

    ReplyDelete
  12. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    python training in pune
    python online training
    python training in OMR

    ReplyDelete
  13. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    java online training | java training in pune

    java training in chennai | java training in bangalore

    ReplyDelete
  14. Great Article...Thanks for sharing the best information how HSRP works.It was so good to read and useful to improve my knowledge as updated one.

    PHP Training in Chennai
    PHP Training

    ReplyDelete
  15. I would really like to read some personal experiences like the way, you've explained through the above article. I'm glad for your achievements and would probably like to see much more in the near future. Thanks for share.

    java training in jayanagar | java training in electronic city

    java training in chennai | java training in USA

    ReplyDelete
  16. Resources like the one you mentioned here will be very useful to me ! I will post a link to this page on my blog. I am sure my visitors will find that very useful
    angularjs-Training in pune

    angularjs-Training in chennai

    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    ReplyDelete
  17. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.is article.
    Data Science course in Chennai
    Data science course in bangalore
    Data science course in pune
    Data science online course

    ReplyDelete
  18. When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove people from that service? Thanks.

    AWS Interview Questions And Answers

    AWS Training in Pune | Best Amazon Web Services Training in Pune

    AWS Training in Chennai |Best Amazon Web Services Training in Chennai


    AWS Training in Chennai | Best AWS Training in Chennai


    Amazon Web Services Training in Pune | Best AWS Training in Pune

    ReplyDelete
  19. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    python training Course in chennai
    python training in Bangalore
    Python training institute in bangalore

    ReplyDelete
  20. Thanks For Sharing your Information The Information Shared Is Very Valuable Please Keep Updating Us Time Just Went On reading the article Data Science Online Training Hadoop Science Online Training AWS Online Training Python Online Training

    ReplyDelete
  21. Well somehow I got to read lots of articles on your blog. It’s amazing how interesting it is for me to visit you very often.
    Microsoft Azure online training
    Selenium online training
    Java online training
    Java Script online training
    Share Point online training

    ReplyDelete
  22. Such an great and nice blog, Thank you for sharing this wonderful post.


    Data Science in Bangalore

    ReplyDelete
  23. I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles.





    DATA SCIENCE COURSE MALAYSIA

    ReplyDelete
  24. I am looking for and I love to post a comment that "The content of your post is awesome" Great work!
    data science course malaysia

    ReplyDelete
  25. Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
    salesforce Training in Bangalore
    uipath Training in Bangalore
    blueprism Training in Bangalore

    ReplyDelete
  26. This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. Automation Anywhere Training in Bangalore

    ReplyDelete
  27. You have done amazing work. I really impress by your post about approach a Website designing. This is very useful information for every one.
    You have done amazing work. I really impress by your post about approach a Website designing. This is very useful information for every one.
    keep it up.
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  28. This Was An Amazing ! I Haven't Seen This Type of Blog Ever ! Thankyou For Sharing data science training in Hyderabad

    ReplyDelete
  29. Wonderful article, very useful and well explanation. Your post is extremely incredible. I will refer this to my candidates...data science courses

    ReplyDelete
  30. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. data scientist courses

    ReplyDelete

  31. ExcelR provides Data analyst course. It is a great platform for those who want to learn and become a Data Analyst. Students are tutored by professionals who have a degree in a particular topic. It is a great opportunity to learn and grow.

    Data analyst course

    ReplyDelete
  32. It is really a helpful blog to find some different source to add my knowledge. I came into aware of new professional blog and I am impressed with suggestions of author. You can also check us in this Bio fit for weight loss

    ReplyDelete
  33. This is an awesome blog post by Tom Venuto. In it he explains why the Obama Stimulus Package should be considering a "Good" debt relief plan. The Federal Stimulus Package,Buy snapchat account or so they say, is being pushed on all media outlets to pump up consumer confidence, which should start a recovery in the US economy, and make us once again a beacon on the world stage. Okay, so let's talk about this for second shall we? Yes, absolutely, and here's why:Buy Twitter accounts

    ReplyDelete
  34. There are many important things in life to consider. Some of the most important things in life to consider are love, family, health, and survival. All of these things can be easily taken for granted, but they will be more appreciated if they are not taken for granted. There are also many important
    Buy Bulk Twitter accounts things in life that we sometimes take for granted but never get around to doing. Some examples of these would be: having a job, getting out of bed in the morning, getting groceries, and taking care of your children.
    Buy snapchat account

    ReplyDelete
  35. Reach to the best Data Science Training institute in Chennaifor skyrocketing your career, Infycle Technologies. It is the best Software Training & Placement institutes in and around Chennai. that also gives the best placement training for personality tests, interview preparation, and mock interviews for leveling up the candidate's grades to a professional level.

    ReplyDelete
  36. Thanks for sharing the informative article, keep writing and keep sharing.

    Data Science Training in Pune

    ReplyDelete
  37. Are you looking to finding the best Instagram influencer for your business? Then you have come to the right place. I will give you the best influencer service for your marketing.
    instagram marketing for organic engagement

    ReplyDelete
  38. Some may stag in Interviews!!! OOPS!! More than 50% of students do this in their career. Instead, do Hadoop Training in Chennai at Infycle. Those students can easily clear this Interview session because more than 5 times at INFYCLE practicing mock-interview sessions, Hence students are Getting out of their interview fear.

    ReplyDelete
  39. Your blog provided us with valuable information to work with. Each & every tip of your post is awesome. Thanks a lot for sharing. Keep blogging,
    data science institutes in hyderabad

    ReplyDelete
  40. Nice blog. Informative and knowledgeable content. Big thumbs up for this blog. I really enjoyed this blog. Thank you for sharing with us.
    Data Scientist Training in Hyderabad

    ReplyDelete
  41. https://zanaatdepolama.com/maltepe-esya-depolama/

    ReplyDelete
  42. You completed certain reliable points there. I did a search on the subject and found nearly all people will agree with your blog.
    data science training institute in hyderabad

    ReplyDelete