Protocol 26 of 81Layer 3FrameAssembly v3.1.2
llms-full.txt
hsrpCisco Hot Standby Router Protocol v1 & v2

Cisco Standby Router Coups (active <-> standby hsrp UDP 1985 / 2029)

Default Port / Protocol
UDP 1985 (v1) / UDP 2029 (v2)
Host Endpoint Rule
Dual-Stack Morphing (v4/v6)
Wireshark Display Filter
hsrp || hsrp2
Standards & Specs
RFC 2281
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6HSRPv1 / HSRPv2 (UDP 1985 (v1) / UDP 2029 (v2))

What It Does on the Wire

Cisco’s classic gateway protocol: hsrp writes HSRPv1 (UDP 1985) on IPv4 and automatically upgrades to TLV-formatted HSRPv2 (UDP 2029) on IPv6 endpoints.

Hot Standby Router Protocol (hsrp, RFC 2281) is Cisco’s First-Hop Redundancy Protocol. Between IPv4 hosts, FrameAssembly builds 20-byte HSRPv1 Hellos on UDP 1985 -> 1985 (Opcode 0 Hello, State, hellotime, holdtime, Priority, Group, 8-byte cleartext auth string, and Virtual IP vip). Between IPv6 hosts, hsrp automatically switches to HSRPv2 TLV format on UDP 2029 -> 2029.

Fields group, priority, state, hellotime, and holdtime each take a 1-byte value (0..255).

Default "cisco" Cleartext Auth Security Audits

Test network pentest & NDR rules that flag HSRPv1 routers broadcasting default cleartext auth "cisco" credentials with high priority takeovers.

Active (state 16) & Standby (state 8) Failover Captures

Document campus distribution switch failovers between Active (state 16), Standby (state 8), Speak (state 4), and Listen (state 2) states.

Dual-Stack HSRPv1 (IPv4) & HSRPv2 (IPv6) Dissector Testing

Verify monitoring sensors parse both fixed-layout UDP 1985 packets and TLV-encoded UDP 2029 IPv6 HSRP frames.

Minimal Quickstart (hsrp_quickstart.frasm)

Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.

hsrp_quickstart.frasm6 lines
Open in Playground
host dist_sw1 { ip 10.20.10.2 mac 00:00:0c:07:ac:0a }
host all_rtrs { ip 224.0.0.2 }
compile {
dist_sw1 -> all_rtrs hsrp group 10 priority 110 state 16 vip 10.20.10.1
}

What the Compiler Calculates So You Don't Have To

  • Defaults UDP source and destination ports to 1985 -> 1985 on IPv4 (HSRPv1) or 2029 -> 2029 on IPv6 (HSRPv2 TLV).
  • Zero-pads or truncates auth cleanly into the fixed 8-byte RFC 2281 Authentication Data field (default "cisco\0\0\0").
  • Validates hellotime and holdtime within 0..=255 (u8) at compile time and derives 01:00:5e:00:00:02 (224.0.0.2) multicast MACs automatically.
Multi-Frame Lab · Ready to Compile

Campus VLAN 20 Active/Standby HSRP Pair Plus HSRPv2 IPv6 Gateway

Models two distribution switches exchanging Active (state 16, priority 110) and Standby (state 8, priority 100) HSRPv1 Hellos on VLAN 20 alongside an IPv6 HSRPv2 Active router.

hsrp_active_standby.frasm14 lines
Open in Playground
host dist_a { ip 10.20.20.2 mac 00:00:0c:07:ac:14 }
host dist_b { ip 10.20.20.3 mac 00:1c:73:20:00:03 }
host hsrp_v4 { ip 224.0.0.2 }
host dist6_a { ip fe80::20:2 mac 00:05:73:a0:00:14 }
host hsrp_v6 { ip ff02::66 }
compile {
// 1. Active router (state 16, priority 110, virtual MAC 00:00:0c:07:ac:14 for group 20)
dist_a -> hsrp_v4 hsrp group 20 priority 110 state 16 hellotime 3 holdtime 10 auth "corpkey1" vip 10.20.20.1 vlan 20 ttl 1 dscp 48 wait 3ms
// 2. Standby router (state 8, priority 100) monitoring Active peer
dist_b -> hsrp_v4 hsrp group 20 priority 100 state 8 hellotime 3 holdtime 10 auth "corpkey1" vip 10.20.20.1 vlan 20 ttl 1 dscp 48 wait 5ms
// 3. HSRPv2 over IPv6 on UDP 2029 -> ff02::66
dist6_a -> hsrp_v6 hsrp group 20 priority 110 state 16 hellotime 3 holdtime 10 vip 2001:db8:20::1 vlan 20 ttl 255
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show hsrp_active_standby.frasm

# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly hsrp_active_standby.frasm hsrp_active_standby.pcap
frameassembly hsrp_active_standby.frasm hsrp_active_standby.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse hsrp_active_standby.pcap hsrp_active_standby_edited.frasm

All hsrp Keywords & Header Options

Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after hsrp:

src_host -> dst_host hsrp [group <0..255>] [priority <0..255>] [state <0..255>] [hellotime <0..255>] [holdtime <0..255>] [auth "<text>"] [vip <ip>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
group <0..255>Whole number (0..255) (0..255)1Sets the Standby Group number (HSRPv1 virtual MACs follow 00:00:0c:07:ac:<group_hex>).
priority <0..255>Whole number (0..255) (0..255)100Sets router election priority (higher value wins when preemption is enabled).
state <0..255>8-bit RFC 2281 HSRP state code16 (Active)Sets router state: 0 Initial, 1 Learn, 2 Listen, 4 Speak, 8 Standby, 16 Active.
hellotime <0..255> | holdtime <0..255>8-bit unsigned integers (seconds)hellotime 3, holdtime 10Sets the 1-byte Hello Time and Hold Time fields in seconds.
auth "<text>"ASCII string (up to 8 bytes in v1)"cisco"Populates the 8-byte Authentication Data field in HSRPv1 packets.
vip <ip>IPv4 or IPv6 Virtual IP addressSource host IPSets the shared Virtual IP address served by the HSRP group.

Cross-Layer Wrappers Valid with hsrp

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

10 options
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac>Colon, hyphen, or Cisco dot MACHost MAC / RFC multicast MACOverrides the 14-byte Ethernet II source or destination MAC address for this single packet.
vlan <0..4095> [pcp <0..7>] [dei <0|1>]VLAN ID 0..4095, PCP 0..7, DEI 0..1UntaggedWraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority.
qinq <0..4095> [innervlan <0..4095>]Outer S-VLAN 0..4095, Inner C-VLAN 0..4095Untagged (innervlan 1 when qinq is set)Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100).
mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255Unlabeled (at most 1 mpls tag per packet)Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header.
ttl <0..255> [dscp <0..63>] [ecn <0..3>]TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3ttl 64, dscp 0, ecn 0Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings.
ipid <0..65535> [df] [mf] [fragoffset <0..8191>]IPv4 ID, DF/MF flags, fragment offset 0..8191ipid 1, flags 0, fragoffset 0Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6).
flowlabel <0..1048575>20-bit IPv6 Flow Label (0..1048575)0Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts).
srcport <0..65535> | dstport <0..65535>Port number 0..65535srcport 49152 (remembered), UDP 1985 (v1) / UDP 2029 (v2)Overrides source or destination port and remembers the port pair automatically on <- replies.

Gotchas & Quick Fixes

hellotime and holdtime Must Be Between 0 and 255 Seconds

Avoid
dist_a -> hsrp_v4 hsrp hellotime 300
Valid v3.1.2 Syntax
dist_a -> hsrp_v4 hsrp hellotime 3 holdtime 10

RFC 2281 stores hellotime and holdtime as 1-byte fields in seconds, so values above 255 are rejected.

Numeric State Codes (16 = Active, 8 = Standby)

Avoid
dist_a -> hsrp_v4 hsrp state "active"
Valid v3.1.2 Syntax
dist_a -> hsrp_v4 hsrp state 16

state takes its numeric RFC 2281 bit value (16 Active, 8 Standby, 4 Speak, 2 Listen).

Field Guide 05
VLANs, QinQ, MPLS, Tunnel Soup & Dual-Stack IPv6