RFC 2281
Cisco Hot Standby Router Protocol (HSRP)
RFC 2281: Cisco Hot Standby Router Protocol (HSRP) π
okay bestie, the paperwork first π
- Number: RFC 2281
- Title: Cisco Hot Standby Router Protocol (HSRP)
- Authors: T. Li, B. Cole and P. Morton (Juniper Networks and Cisco Systems), and D. Li (Cisco Systems)
- Category: Informational π¦
- Date: March 1998
- Obsoletes / Updates: the header doesn't list anything it obsoletes or updates
Network Working Group, if you're wondering. The authors were from Juniper and Cisco, which is a whole vibe π
Status of This Memo β¨
This memo gives information to the Internet community. It is not an Internet standard of any kind, and it can be distributed without limits. πΈ
Copyright Notice π
Copyright (C) The Internet Society (1998). All Rights Reserved.
IESG Note π
This document describes a protocol that is already deployed in the wild. The IETF has a working group that is busy making a standards track protocol for the same problems. π₯
Abstract π§
okay so this memo specifies the Hot Standby Router Protocol, HSRP. The whole point is to let hosts act like they're using one router, and keep them connected even when the first hop router they're actually using dies. π Several routers join the protocol and together they make a single virtual router appear. The protocol ensures that one and only one of those routers is forwarding packets for the virtual router, and end hosts send their packets to the virtual router. π
The router doing the forwarding is the active router. A standby router is picked to take over if the active one fails. HSRP figures out who is active and who is standby using the IP addresses on the participating routers. If the active router goes down, the standby can take over without the host's connection really noticing. β¨
This memo also talks about ARP, MAC address and security issues with the protocol. π
TABLE OF CONTENTS π
1 Introduction .............................................. 2
2 Conditions of Use ......................................... 3
3 Scope ..................................................... 4
3.1 Terminology ............................................... 4
4 Definitions ............................................... 4
5 Protocol .................................................. 4
5.1 Packet formats ............................................ 4
5.2 Operational parameters .................................... 7
5.3 States .................................................... 8
5.4 Timers .................................................... 9
5.5 Events .................................................... 9
5.6 Actions ................................................... 10
5.7 State Transitions.......................................... 11
6 MAC address considerations ................................ 13
6.1 General ................................................... 13
6.2 Address Filter ............................................ 14
6.3 ICMP Redirect ............................................. 14
6.4 Proxy ARP ................................................. 15
7 Security Considerations ................................... 15
8 References ................................................ 15
9 Authors' Addresses ........................................ 16
10 Full Copyright Statement .................................. 17
1. Introduction β¨
okay so HSRP is a mechanism for non-disruptive failover of IP traffic in certain situations. π¦ It mainly protects against the first hop router failing when the source host can't find out that router's IP address dynamically. It's built for multi-access, multicast or broadcast capable LANs, like Ethernet. π
HSRP is NOT a replacement for the existing dynamic router discovery mechanisms. Those protocols should be used instead whenever possible [1]. π
There's a big group of legacy host implementations that don't support dynamic discovery but can still configure a default router. HSRP gives failover to those hosts. π«Ά
All of the routers in HSRP are assumed to run appropriate IP routing protocols and to have a consistent set of routes. Which protocols count as appropriate, and whether routing is consistent in a given situation, is outside the scope of this specification. π€·ββοΈ
So basically, a set of routers works together to make a single virtual router appear to the hosts on the LAN. π That set is called an HSRP group or a standby group. One router gets elected from the group to forward the packets hosts send to the virtual router. That one is the active router. Another router gets elected as the standby router. If the active router fails, the standby takes over its packet forwarding duties. β Any number of routers can run HSRP, but only the active router forwards the packets sent to the virtual router. π
To keep network traffic down, only the active and standby routers send periodic HSRP messages once the election process has finished. If the active router fails, the standby router becomes the active router. If the standby router fails or becomes the active router, a different router gets elected as the standby. π₯
On a single LAN, multiple hot standby groups can exist and overlap. πΈ Each standby group emulates a single virtual router. Each group gets one well-known MAC address, plus an IP address. The IP address SHOULD belong to the primary subnet in use on the LAN, but it MUST differ from the addresses assigned as interface addresses on all routers and hosts on the LAN, including the virtual IP addresses assigned to other HSRP groups. Serious rules, bestie π
If you use multiple groups on one LAN, you can split the load by spreading hosts across the different standby groups. π
The rest of this spec talks about how a single standby group works. With multiple groups, each group runs on its own, separate from the other groups on the LAN, and follows this specification. One more thing: individual routers can be in multiple groups. In that case the router keeps separate state and timers for each group. π§
2. Conditions of Use π
US Patent number 5,473,599 [2], assigned to Cisco Systems, Inc., may apply to HSRP. If an implementation needs any claims of patent no. 5,473,599, Cisco will license those claims on reasonable, nondiscriminatory terms for use in practicing the standard. More specifically, the license is available as a one-time, paid up fee. πΈ
3. Scope π
This document describes the packets, messages, states and events used to implement the protocol. It does NOT discuss network management or internal implementation issues. π ββοΈ
3.1. Terminology π
The language conventions of RFC 2119 [3] are used in this document.
4. Definitions π
Active Router - the router that is currently forwarding packets
for the virtual router
Standby Router - the primary backup router
Standby Group - the set of routers participating in HSRP that
jointly emulate a virtual router
Hello Time - the interval between successive HSRP Hello
messages from a given router
Hold Time - the interval between the receipt of a Hello
message and the presumption that the sending
router has failed
5. Protocol π
Inside a standby group, the routers periodically advertise state information using various messages. π
5.1. Packet formats β¨
okay so the standby protocol runs on top of UDP and uses port number 1985 π. Packets get sent to multicast address 224.0.0.2 with TTL 1 π¦.
Routers use their actual IP address as the source address for protocol packets, not the virtual IP address π . This is necessary so that the HSRP routers can identify each other π«Ά.
The data part of the UDP datagram looks like this π:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Version | Op Code | State | Hellotime |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Holdtime | Priority | Group | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Authentication Data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Authentication Data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Virtual IP Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Version: 1 octet
The version of the HSRP messages. This document describes version 0 β¨.
Op Code: 1 octet
The Op Code tells you what kind of message is inside the packet π¦. Possible values are:
0 - Hello
1 - Coup
2 - Resign
Hello messages are sent to show that a router is running and is capable of becoming the active or standby router π.
Coup messages are sent when a router wishes to become the active router π.
Resign messages are sent when a router no longer wishes to be the active router π« .
State: 1 octet
Internally, each router in the standby group runs a state machine π€. The State field says what state the router sending the message is in right now. More on each state below π. Possible values are:
0 - Initial
1 - Learn
2 - Listen
4 - Speak
8 - Standby
16 - Active
Hellotime: 1 octet
This field only means something in Hello messages β°. It holds the approximate period between the Hello messages that the router sends, in seconds.
If the Hellotime isn't configured on a router, then it MAY be learned from the Hello message from the active router. The Hellotime SHOULD only be learned if no Hellotime is configured and the Hello message is authenticated. A router that sends a Hello message MUST insert the Hellotime it's using into the Hellotime field in that Hello message. If the Hellotime isn't learned from a Hello message from the active router and it isn't manually configured, a default value of 3 seconds is RECOMMENDED π.
Holdtime: 1 octet
This field only means something in Hello messages β³. It holds how long the current Hello message should be considered valid, in seconds.
If a router sends a Hello message, then receivers should consider that Hello message valid for one Holdtime π. The Holdtime SHOULD be at least three times the value of the Hellotime and MUST be greater than the Hellotime. If the Holdtime isn't configured on a router, then it MAY be learned from the Hello message from the active router. The Holdtime SHOULD only be learned if the Hello message is authenticated. A router that sends a Hello message MUST insert the Holdtime it's using into the Holdtime field in that Hello message.
A router which is in active state MUST NOT learn new values for the Hellotime and the Holdtime from other routers π
ββοΈ, although it may keep using values it learned from the previous active router. It MAY also use the Hellotime and Holdtime values learned through manual configuration. The active router MUST NOT use one configured time and one learned time. If the Holdtime isn't learned and it isn't manually configured, a default value of 10 seconds is RECOMMENDED π
.
Priority: 1 octet
This field is used to elect the active and standby routers π. When comparing priorities of two different routers, the router with the numerically higher priority wins. If routers have equal priority, the router with the higher IP address wins.
Group: 1 octet
This field identifies the standby group π§. For Token Ring, values between 0 and 2 inclusive are valid. For other media, values between 0 and 255 inclusive are valid.
Authentication Data: 8 octets
This field contains a clear-text 8 character reused password π.
If no authentication data is configured, the RECOMMENDED default value is 0x63 0x69 0x73 0x63 0x6F 0x00 0x00 0x00 πΈ.
Virtual IP Address: 4 octets
The virtual IP address used by this group π¦.
If the virtual IP address isn't configured on a router, then it MAY be learned from the Hello message from the active router. An address SHOULD only be learned if no address was configured and the Hello message is authenticated.
5.2. Operational parameters π§
Okay, the following information MUST be known to each router in the standby group. The mechanisms used to work this out are outside the scope of this document π.
- Standby group number
- Virtual MAC address
- Priority
- Authentication Data
- Hellotime
- Holdtime
The following information MUST be known to at least one router in each standby group and MAY be known by any of the other routers in the group π«§.
- Virtual IP Address
The following information MAY be configured on any router π.
- Preemption capability
- If a router has higher priority than the active router and preemption is configured, it MAY take over as the active router using a Coup message π.
5.3. States π¦
Each router in the group joins the protocol by running a simple state machine π€. This specification describes the externally visible behaviour of this state machine. Implementations MAY vary their internal implementations within the functional description of the state machine.
All routers begin in the Initial state π±. This section talks about what each state is for. For the specific actions taken in each state, please see the state transition table in section 5.7.
1. Initial
This is the starting state, and it means HSRP isn't running yet π΄. A router enters this state through a configuration change or when an interface first comes up.
2. Learn
The router hasn't worked out the virtual IP address yet, and it hasn't seen an authenticated Hello message from the active router π. The router is still waiting to hear from the active router, so it's just vibing and waiting π« .
3. Listen
The router knows the virtual IP address, but it's 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 taking part 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 it 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 π. It sends periodic Hello messages too. Excluding transient conditions, there MUST be at most one router in Active state in the group.
5.4. Timers β°
Each router keeps track of three timers π°οΈ: an Active timer, a Standby timer, and a Hello timer.
The Active timer is used to monitor the active router π. The Active timer starts any time an authenticated Hello message is seen from the active router. It's set to expire in the Holdtime seen in that Hello message.
The Standby timer is used to monitor the standby router. The Standby timer starts any time an authenticated Hello message is seen from the standby router. It's set to expire in the Holdtime seen in that Hello message.
The Hello timer expires once per Hellotime period π. If the router is in Speak, Standby, or Active states, it should generate a Hello message when the Hello timer expires. The Hello timer MUST be jittered π².
5.5. Events π
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 π.
5.6 Actions β¨
Okay bestie, this is the to-do list for the state machine π Every action gets a letter, and when the table says "AB" it means do A, then B. π¦
- A Start Active Timer Okay so if this happened because an authenticated Hello message showed up from the active router, the Active timer gets set to the Holdtime field in that Hello message. Otherwise it gets set to whatever Holdtime value this router is currently using. Then the Active timer starts β°
- B Start Standby Timer Same energy as A, but for the standby router π«Ά If an authenticated Hello message came from the standby router, the Standby timer gets set to the Holdtime field in that message. Otherwise it gets set to the hold time value this router is currently using. Then the Standby timer starts.
- C Stop Active Timer The Active timer gets stopped. Done and dusted β
- D Stop Standby Timer The Standby timer gets stopped. Bye bye π
- E Learn Parameters This one happens when an authenticated message comes in from the active router π If the virtual IP address for this group wasn't manually configured, the router MAY learn it from the message. The router MAY also 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 tell the active router that there's a higher priority router around. Main character energy, but make it polite π
- H Send Resign Message The router sends a Resign message so another router can take over as 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 uses the virtual MAC address as the source MAC address in the link layer header, and also inside the ARP packet. Iconic.
5.7 State Transitions π
This table shows the state transitions for the state machine. For each event and current state, the router MUST perform the set of actions specified and transition to the designated state. If no action is specified, no action should be taken. If no state change is specified, no state change should be performed.
The actions are letters that match the ones in section 5.6, and the next state is a number from section 5.3. A slash ('/') separates the actions from the states. Some transitions have alternatives that depend on external state, and those are separated by a '|'. Check the attached notes for the details on those ones π
States
+-----+----------+----------+----------+----------+----------+----------+
| | 1 | 2 | 3 | 4 | 5 | 6 |
| | Initial | Learn | Listen | Speak | Standby | Active |
+-----+----------+----------+----------+----------+----------+----------+
|Event| |
+-----+----------+----------+----------+----------+----------+----------+
| a | AB/2|3+ | | | | | |
+-----+----------+----------+----------+----------+----------+----------+
| b | | CD/1 | CD/1 | CD/1 | CD/1 | CDH/1 |
+-----+----------+----------+----------+----------+----------+----------+
| c | | | AB/4 | | CDFI/6 | |
+-----+----------+----------+----------+----------+----------+----------+
| d | | | B/4 | D/5 | | |
+-----+----------+----------+----------+----------+----------+----------+
| e | | | | F | F | F |
+-----+----------+----------+----------+----------+----------+----------+
| f | | | | B/3 | B/3 | |
+-----+----------+----------+----------+----------+----------+----------+
| g | | EAB/3 | EA | EA | EA | AB/4 |
+-----+----------+----------+----------+----------+----------+----------+
| h | | EAB/3 | A|BGFI/6*| A|BGFI/6*| A|BGFI/6*| G |
+-----+----------+----------+----------+----------+----------+----------+
| i | | | AB/4 | A | CFI/6 | |
+-----+----------+----------+----------+----------+----------+----------+
| j | | | | | | ABH/4 |
+-----+----------+----------+----------+----------+----------+----------+
| k | | | B | B/3 | B/3 | B |
+-----+----------+----------+----------+----------+----------+----------+
| l | | | B/4 | D/5 | | B |
+-----+----------+----------+----------+----------+----------+----------+
Notes π
- + If the virtual IP address is configured, set state 3 (Listen). If the virtual IP address is not configured, set state 2 (Learn). In either case, do actions A and B.
*If the router is configured to preempt, do actions B, G, F, and I and set the state to 6 (Active). If the router is not configured to preempt, do action A with no state change.
6 MAC Address Considerations π§ββοΈ
6.1 General π
Each HSRP group has a well-known virtual MAC address. On token ring networks, these are actually functional addresses. The three addresses 0xC0 0x00 0x00 0x01 0x00 0x00, 0xC0 0x00 0x00 0x02 0x00 0x00, and 0xC0 0x00 0x00 0x04 0x00 0x00 belong to groups 0, 1, and 2 respectively.
On other media, the virtual MAC addresses are 0x00 0x00 0x0C 0x07 0xAC XX, where XX is the HSRP group number. Routers which implement HSRP SHOULD use well-known HSRP MAC addresses as the group's virtual MAC address whenever possible π
The active router MUST accept and forward traffic that is destined for the group's virtual MAC address. It MUST stop accepting or forwarding that traffic when the router leaves the Active state π«
If and only if the router is in the Active state, the router MUST use the group's virtual MAC address as the source MAC address for its Hello messages. This is needed so learning bridges can figure out which LAN segment the virtual MAC address currently belongs to π
For each group, there is one virtual IP address and one virtual MAC address. This is a total win, because the ARP table entries in end stations don't need to change as the HSRP active router moves from one router to another π
Also, for HSRP to work in bridging environments, bridges have to update themselves quickly as the virtual MAC address "moves." Learning bridges usually manage this, but some have been known to have problems. It is RECOMMENDED that only true learning bridges be used with HSRP π₯Ί
The movement of the virtual MAC address can cause other messy side effects where extra state is tied to the MAC address. For example, on Token Ring with Source Route Bridging, a RIF gets stored with the virtual MAC address in a host's RIF cache. The RIF shows the path and final ring used to reach that MAC address. When routers move into the Active state, they can't change the RIF caches on hosts on the bridged ring. This can lead to packets being bridged to the ring for the previous active router π¬
In situations like that, a router MAY use its normal MAC addresses as the virtual MAC address. This method of operation is strongly discouraged. In this mode, the virtual IP address maps to a different MAC address over time. That can cause problems for end stations, since ARP tables assume a fairly static mapping between MAC and IP addresses. Those ARP tables are normally updated when end stations receive the gratuitous ARP responses that a router sends when it enters the active state π
6.2 Address Filter π
As noted, routers emulating a virtual router adopt their group's MAC and IP addresses. MAC addresses are usually provided in an address filter, or "list," of MAC addresses in a router's interface controller. It's desirable for routers to be able to add one or more virtual MAC addresses to their controllers' MAC address filter while keeping their primary MAC addresses π
Unfortunately, some interface controllers only support address filtering for one unicast MAC address. Or, on Token Ring, the functional address HSRP would like to use is already taken by some other protocol. In these cases, such routers can still implement HSRP, but the protocol must change the interface's primary MAC address when assuming or giving up control as the active router π
This is potentially problematic, because some traffic may still want to use the router's primary MAC address. However, the problem MAY be mitigated by having the router send out gratuitous ARP packets about its non-HSRP IP addresses. That way, other network entities using IP should update their ARP tables to show that the router is now using a group virtual MAC address instead of its primary MAC address π¦
Some protocols may not be able to run at the same time as the standby protocol because of the interface primary MAC address change. For example, DECnet phase IV and HSRP will not be able to run at the same time on some equipment π
6.3 ICMP Redirect π
While running HSRP, it's important to stop the host from discovering the primary MAC addresses of the routers in its standby group. So any protocol that tells a host about a router's primary address should be disabled. That's why routers participating in HSRP on an interface MUST NOT send ICMP redirects on that interface π
6.4 Proxy ARP π
Usually, hosts learn the HSRP virtual IP address through the configuration of their default router. Those hosts then send packets for destinations outside the LAN to the virtual IP address. In some environments, hosts may use proxy ARP instead to route off the LAN. In that case, the hosts use the MAC address supplied in the proxy ARP responses. HSRP functionality is maintained if the proxy ARP responses specify the HSRP virtual MAC address π§
If an HSRP router is configured to support proxy ARP with HSRP, then the router MUST specify the HSRP virtual MAC address in any proxy ARP responses it generates. These proxy ARP responses MUST not be suppressed based on HSRP state. Suppression based on state could result in no proxy ARP response being generated at all, since these responses may already be suppressed for other reasons, like split-horizon rules π ββοΈ
7. Security Considerations π¨
This protocol does not provide security. The authentication field found within the message is useful for preventing misconfiguration. The protocol is easily subverted by an active intruder on the LAN. This can result in a packet black hole and a denial-of-service attack. It is difficult to subvert the protocol from outside the LAN, because most routers will not forward packets addressed to the all-routers multicast address (224.0.0.2) ππ₯
8. References π
okay so the refs are where the receipts live π§Ύβ¨ here's the full list, exactly as it's written:
[1]Deering, S., "ICMP Router Discovery Messages", RFC 1256, September 1991.[2]United States Patent. Patent Number : 5,473,599. Standby Router Protocol. Date of Patent: Dec. 5, 1995.[3]Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
9. Authors' Addresses π
bestie, these are the people who wrote it, and yes, two of them are at Juniper and two are at Cisco ππ¦ their contact info is below, verbatim:
Tony Li
Juniper Networks, Inc.
3260 Jay St.
Santa Clara, CA 95054
Phone: (408) 327-1900
EMail: tli@juniper.net
Bruce Cole
Juniper Networks, Inc.
3260 Jay St.
Santa Clara, CA 95054
Phone: (408) 327-1900
EMail: cole@juniper.net
Phil Morton
Cisco Systems
170 Tasman Dr.
San Jose, CA 95143
Phone: (408) 526-7632
EMail: pmorton@cisco.com
Dawn Li
Cisco Systems
170 Tasman Dr.
San Jose, CA 95143
Phone: (408) 527-2014
EMail: dawnli@cisco.com
10. Full Copyright Statement π¦
okay the legal part, but make it cute π the Internet Society owns the copyright (1998), and everything is reserved, obviously.
ngl this is the important bit: copying and sharing this document is totally fine, and so is writing derivative works that comment on it or explain it or help people implement it, as long as the copyright notice and this paragraph stay on every copy and derivative work. the document itself can't be modified in any way, though. you can't remove the copyright notice or the references to the Internet Society or other Internet organizations. the exceptions are when you're developing Internet standards, where the Internet Standards process copyright procedures have to be followed, or when you're translating it into a language other than English.
the permissions above are perpetual, and the Internet Society or its successors or assigns will never revoke them β¨
now the disclaimer, which is in caps because it's serious π
This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
that's the whole doc, babe πΈ we made it to the end ππ
π¦ where this page comes from
- ietf: rfc2281 1998-03
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms