Filtering HSRP Revisited

Peter Welcher
Architect, Operations Technical Advisor

I recently got the chance to revisit the topic of filtering HSRP traffic between datacenters. It was in the initial stages of setup for testing a LISP VM Mobility scenario — but that’s a topic for a later blog. The big picture for this blog: Data Center Interconnect (DCI), filtering HSRP between datacenters as part of optimal forwarding. This topic is also known as “DCI FHRP Isolation”. Along the way, I and those working with me found a couple of surprises. I’d like to share those with you. 

Technical Background: In OTV it has historically been necessary to manually block HSRP or any other FHRP (First Hop Routing Protocol) between datacenters. It appears that is still the case, despite the expectation of automated FHRP blocking for OTV. 

Lab Background: We were testing various forms of LISP optimal forwarding and VM-mobility in a dual datacenter setting, using 6500 VSS port-channeled Layer 2 links. I hope to provide more information about that in a subsequent blog, if / when time permits. To achieve VM / host computer localization, FHRP filtering is needed. We also did BPDU filtering, to emulate another benefit of OTV: Spanning Tree Protocol (STP) termination, so that STP is not propagated between datacenters. 

First Surprise

The first semi-surprise repeated a lesson I’ve learned a lot of times: unless you lab test it, you can’t count on it being right. 

For a while now, there has been a documented VACL approach for FHRP filtering. I documented it in a blog titled Cisco Overlay Transport Virtualization. See also FHRP Isolation — the example there is fairly clearly for a Nexus 7K, and I have not tested it on that platform. Cisco probably tested it rather well, unless post-testing edits crept in. 

Minor surprise: the VACL approach shown there doesn’t work on a 6500 switch. The problem: on the 6500 I was using, with fairly recent code, the VACL cannot have multiple match conditions in a block. And even with the IP access list entries omitted, only using MAC entries, the VACL did not seem to be working. 

Due to lab time constraints, I chose a different approach, namely filtering with both IP and MAC port access lists. 

Caveat: On the Nexus, it appears that IP and MAC filtering cannot be done simultaneously on Layer 2 interfaces (cf. “mac packet-classify”). So the best bet appears to be using VACLs on Nexus, which is where most of us will likely be doing this sort of thing. 

The port access lists that worked are:

interface TenGigabitEthernet1/1
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan …
 switchport mode trunk
 access-group mode prefer port
 ip access-group HSRP-VIP in
 mac access-group HSRP-VMAC in
 spanning-tree bpdufilter enable
mac access-list extended HSRP-VMAC
 deny   0000.0c07.ac00 0000.0000.00ff any 
 deny   any 0000.0c07.ac00 0000.0000.00ff 
 deny   0000.0c9f.f000 0000.0000.0fff any 
 deny   any 0000.0c9f.f000 0000.0000.0fff 
 permit any any 
ip access-list extended HSRP-VIP
 deny   ip any host   ! VIP of the HSRP default gateway
 deny   udp any host eq 1985
 deny   udp any host eq 1985
 permit ip any any

The entry blocking traffic to the virtual IP is likely unnecessary. I put it in out of an abundance of caution. 

Note the “access-group prefer port” command — the 6500 platform does not normally apply MAC filters to IP traffic (for efficiency, I presume). 

This works (well, mostly — keep reading)! When the above was configured in the lab, it definitely blocked the HSRP hellos and clearly the FHRP routers (separate from the 6500 switches for reasons I’ll go into in the sequel to this). 

If you’re wondering why 6500 switches and not Nexus, well, their capacity was adequate and cost lower, i.e. business requirement, customer’s choice. 

Second Surprise

After making a lot of lab progress, we were doing some ping testing and noticed a lot of dropped packets. This was rather perplexing. I finally tracked it down to the following (assisted by muttered four letter words for an unwanted digression at the end of a long day):

  • The PC could ping the “real” IP of the adjacent FHRP router through the Layer 2 switch just fine.
  • When the ping destination was the virtual IP for HSRP, about 50% packet loss occurred. 

It turned out, the 6500 was learning the HSRP virtual MAC address, and in fact the VMAC was flapping between the port the FHRP router was on, and the trunk to the other “datacenter” and its FHRP router. Google search quickly revealed that the 6500 switch learns MAC addresses even though a MAC ACL blocks that MAC. And apparently the Nexus does similarly. See also and other recent DCI documents. 

My workaround was to use a static MAC entry, which you’ll note the above URL recommends. 

Another planned blog will go into how this also led us down the path of writing some EEM scripts, along with some basic aspects of DCI and optimal forwarding. I highly advise not having a single FHRP router in either datacenter — and plan to explain why!


Per the above reference, a VACL is effective outbound whereas a Port ACL cannot be applied outbound. That also would also solve the flapping MAC problem noted above. If the other datacenter never sees frames with the HSRP VMAC, they won’t learn that MAC address on the DCI port. 

As the above article notes, that might be acceptable on a Nexus OTV VDC, since the separate Aggregation VDCs with the FHRP configuration would still be able to exchange MAC traffic and would likely provide the FHRP routers as well. In our lab scenario, the 6500 VSS pair in each datacenter would block HSRP within each datacenter if we used a VACL. Offsetting that, the particular design involved only one FHRP router in each datacenter, so it looks like VACLs might have worked for us. 

Hashtags: #CiscoChampion #DCI #OTV #FHRPfilter

Twitter: @pjwelcher

Disclosure Statement

 ccie_15years_med   CiscoChampion200PX

2 responses to “Filtering HSRP Revisited

  1. Would using different HSRP groups or Passwords on either side of the DCI have prevented the need for filtering?

  2. Ken, interesting idea. That might get both peers active, unless the error condition reaction is for neither to be active. It doesn’t remove the need to filter, because (a) you don’t want MAC flapping from HSRP updates being seen on two different ports, and (b) you want frames sent to the VMAC of the HSRP gateway to go to the local gateway and [b]not[/b] be forwarded by the other one. Coming up with alternatives that cover all the requirements would be a good CCIE practice type question, perhaps.

Leave a Reply


Nick Kelly

Cybersecurity Engineer, Cisco

Nick has over 20 years of experience in Security Operations and Security Sales. He is an avid student of cybersecurity and regularly engages with the Infosec community at events like BSides, RVASec, Derbycon and more. The son of an FBI forensics director, Nick holds a B.S. in Criminal Justice and is one of Cisco’s Fire Jumper Elite members. When he’s not working, he writes cyberpunk and punches aliens on his Playstation.


Virgilio “BONG” dela Cruz Jr.

CCDP, CCNA V, CCNP, Cisco IPS Express Security for AM/EE
Field Solutions Architect, Tech Data

Virgilio “Bong” has sixteen years of professional experience in IT industry from academe, technical and customer support, pre-sales, post sales, project management, training and enablement. He has worked in Cisco Technical Assistance Center (TAC) as a member of the WAN and LAN Switching team. Bong now works for Tech Data as the Field Solutions Architect with a focus on Cisco Security and holds a few Cisco certifications including Fire Jumper Elite.


John Cavanaugh

CCIE #1066, CCDE #20070002, CCAr
Chief Technology Officer, Practice Lead Security Services, NetCraftsmen

John is our CTO and the practice lead for a talented team of consultants focused on designing and delivering scalable and secure infrastructure solutions to customers across multiple industry verticals and technologies. Previously he has held several positions including Executive Director/Chief Architect for Global Network Services at JPMorgan Chase. In that capacity, he led a team managing network architecture and services.  Prior to his role at JPMorgan Chase, John was a Distinguished Engineer at Cisco working across a number of verticals including Higher Education, Finance, Retail, Government, and Health Care.

He is an expert in working with groups to identify business needs, and align technology strategies to enable business strategies, building in agility and scalability to allow for future changes. John is experienced in the architecture and design of highly available, secure, network infrastructure and data centers, and has worked on projects worldwide. He has worked in both the business and regulatory environments for the design and deployment of complex IT infrastructures.