Anycast Stateless Services with NSX-T, the Theory
Tags: bgp, datacenternetworking, homelab, nsxt
Published: 2020-03-08 00:45:54

---
title: Anycast Stateless Services with NSX-T, the Theory
published: true
date: 2019-10-20 06:07:00 UTC
tags: BGP,Datacenter Networking,Home Lab,NSX-T
canonical_url: 
---

Before getting started, let's cover what different IP message types exist in a brief summary, coupled with a "day in the life of a datagram" as it were.

| [![](https://1.bp.blogspot.com/-GVpvNlTSnv0/XauK6_cqCHI/AAAAAAAAA0c/x6caMS--1VoKi3A7yyT9rsNieeYGgNX7QCLcBGAsYHQ/s1600/unicast.png)](https://1.bp.blogspot.com/-GVpvNlTSnv0/XauK6_cqCHI/AAAAAAAAA0c/x6caMS--1VoKi3A7yyT9rsNieeYGgNX7QCLcBGAsYHQ/s1600/unicast.png) | Unicast:  
  
One source, one well-defined destination. Most network traffic falls into this category.  
  
Mayfly perspective:  
Source device originates packet, and fires it to whatever route (yes, **hosts, VMs and containers can have a routing table** ) matches based on the destination.  
The destination router, if reachable, forwards the packet, and decrements the time-to-live (TTL) field by 1. Rinse and repeat until the destination is reached. Note: the TTL field is 8 bits, so if a message needs over 255 hops, it won't make it. **(we're looking at YOU, Mars!)** Pretty boring, but boring is good.  |
| [![](https://1.bp.blogspot.com/-hqMbvkjRA7c/XavCRngwsoI/AAAAAAAAA1M/w8uq7HowfGcUXXN0IkLFuCc-I841wprbQCEwYBhgL/s1600/multicast.png)](https://1.bp.blogspot.com/-hqMbvkjRA7c/XavCRngwsoI/AAAAAAAAA1M/w8uq7HowfGcUXXN0IkLFuCc-I841wprbQCEwYBhgL/s1600/multicast.png) | Multicast:  
  
One source, many specific destinations. This has a moderate gain in efficiency over bandwidth constrained links when routed.  
  
In most cases, if a group pruning protocol, e.g. IGMP, MLD, is not running, multicast traffic "floods" and distributes all messages across all ports. The most common application for multicast is as a discovery or routing protocol.   
  
Mayfly perspective:  
Source device originates packet and the next layer 2 device replicates the packet to all multicast destinations ( **if IGMP/MLD** is not doing its job, this becomes a flood, and forwards on all ports, which removes the forwarding efficiency) and then stops.  
If multicast routing is enabled, traffic will forward just like it did with unicast, and have a moderate increase in efficiency. This is at the expense of traffic control. Since all multicast traffic is inherently stateless, there's no way to manage bandwidth consumption, fully eliminating the efficiency gain in many cases. If you're running routed multicast, I'd highly recommend using BGP [to prune the multicast table...](https://datatracker.ietf.org/meeting/98/materials/slides-98-bess-09-bgp-based-multicast-00) to help with some of this. |
| [![](https://1.bp.blogspot.com/-GdZjlvgw_tg/XavEy9sbloI/AAAAAAAAA1k/nqRJbjmeeUQQ7ZACx7eTAez7dMs72vAigCLcBGAsYHQ/s1600/broadcast.png)](https://1.bp.blogspot.com/-GdZjlvgw_tg/XavEy9sbloI/AAAAAAAAA1k/nqRJbjmeeUQQ7ZACx7eTAez7dMs72vAigCLcBGAsYHQ/s1600/broadcast.png) | Broadcast:   
  
One source, **ALL**  destinations. This is usually the least efficient traffic type and is part of why most networks don't have one all-encompassing VLAN, but instead use a number of subnetworks. With some exceptions, this traffic type is exclusively for when a source doesn't know how to get to a destination, e.g. ARP.  
  
Mayfly Perspective:  
Source device originates packet and the next layer 2 device floods on all ports but the origin (unless it's a hub). This traffic is subsequently dropped by all layer 3 forwarding devices unless a [broadcast helper address](https://en.wikipedia.org/wiki/UDP_Helper_Address) is configured. |
| [![](https://1.bp.blogspot.com/-trFJwi7n6cw/XavGNfwGxhI/AAAAAAAAA1w/QYMuezKky3sanHmrRvgG1F_XaOIbRhcZACLcBGAsYHQ/s1600/anycast.png)](https://1.bp.blogspot.com/-trFJwi7n6cw/XavGNfwGxhI/AAAAAAAAA1w/QYMuezKky3sanHmrRvgG1F_XaOIbRhcZACLcBGAsYHQ/s1600/anycast.png) | Anycast:   
  
Unicast with a twist. Addresses (or networks) are advertised by multiple nodes, all capable of providing a service, enabling an end device to speak to the nearest available node.  
  
Mayfly Perspective:  
Source device originates packet and forwards on the appropriate interface leverages whatever routing metrics will choose. Next Layer 3 device will forward traffic to the available node with the most favorable routing protocol metric.  |

There's a lot to unpack here. Let's focus on the main points re: Anycast:

- It **DOES**  forward to the nearest available node, and if configured correctly, will use less reachable nodes as a backup.
- It **DOES NOT** load balance traffic in any meaningful way.
- It **DOES NOT** retain state

This is a pretty big deal-breaker, but let's keep in mind that we have more tools - these incapabilities are completely achievable. The only things you need to provide to make a anycast service are:

- A load balancer
- A load balancer that provides stateful services, or one that will synchronize state.
- A load balancer

NSX-T conveniently provides the above with fully integrated routing and switching (We set up BGP, the routing protocol of the internet before), and adds micro-segmentation firewalling to boot. I'll cover more of that on the next post.

  

Before we go much further, this is a critically important that we understand something very fundamental. 

  

**ALL OVERLAY NETWORKING WITH NSX-T, SHOULD BE ANYCAST BY DESIGN.**

  

I know it sounds dramatic, but VMWare's concept of a "transport zone" seems to imply that universal reachability via a **PORTABLE SUBNET**  is the primary goal. In NSX-V, this was described as a Universal Distributed Logical Router (UDLR), and does not appear to be [fully implemented in NSX-T](https://communities.vmware.com/docs/DOC-39405). As a network designer, we should plan for universal reachability leveraging the Anycast model, e.g. "Will the nearest NSX-T Edge please stand up" wherever possible. 

  

Hopefully, it is clear by now, but Anycast isn't a specific IP message type, but instead a design for network reachability. It's commonly Unicast, but can be multicast if an implementation is carefully designed. The core principle for Anycast is to provide the shortest path to an asset, to the best knowledge of the network routing protocol.

  

More on the practical side of this post, but common Anycast applications include:

- DNS
- Application load balancers
- Content Delivery Networks (CDNs)

Coming soon - how to do this with NSX-T!