Skip to content

IPv6 Prefix Failover

Let’s say we have a single web server with addresses from two IPv6 prefixes:

  • Primary prefix: 2001:db8:cafe:/64 with upstream router upstream1.example.com
  • Secondary prefix: 2001:db8:feed/64 with upstream router upstream1.example.com

The addresses it self-assigns from those prefixes are 2001:db8:cafe::80 and 2001:db8:feed::80 respectively.

The secondary address should only be used if upstream connectivity for the primary prefix is lost (i.e. if the primary prefix’s upstream router is unreachable).

layers: {
up: {
r1: upstream1.example.com
user -> Greenlight: ?\nwww.example.com
user <- Greenlight: 2001:db8:cafe::80
Greenlight -> r1: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r1: ✅
}
down: {
r1: upstream1.example.com
user -> Greenlight: ?\nwww.example.com
user <- Greenlight: 2001:db8:feed::80
Greenlight -> r1: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r1: ❌
}
}
  1. Create a Plain resource records with an AAAA record type
  2. Choose a Bitmask function kind with the following settings:
Parameter Value
Operation or
Masks Conditional that healthchecks upstream1, returning 2001:db8:cafe:: if it’s up, and 2001:db8:feed:: if not
Inner Constant returning ::80

Rather than have the Bitmask’s Masks parameter be a Conditional with simple Constant functions, have it change to yet a third prefix (2001:db8:dead::) if both upstream1 and upstream2 are down.

layers: {
up: {
r1: upstream1.example.com
r2: upstream2.example.com
user -> Greenlight: ?\nwww.example.com
user <- Greenlight: 2001:db8:cafe::80
Greenlight -> r1: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r1: ✅
Greenlight -> r2: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r2: ✅
}
down1: {
r1: upstream1.example.com
r2: upstream2.example.com
user -> Greenlight: ?\nwww.example.com
user <- Greenlight: 2001:db8:feed::80
Greenlight -> r1: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r1: ❌
Greenlight -> r2: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r2: ✅
}
down2: {
r1: upstream1.example.com
r2: upstream2.example.com
user -> Greenlight: ?\nwww.example.com
user <- Greenlight: 2001:db8:dead::80
Greenlight -> r1: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r1: ❌
Greenlight -> r2: TCP Connection Check\n(e.g. against port 22)
Greenlight <- r2: ❌
}
}

To do this, set the Conditional’s If False parameter to another Conditional that healthchecks upstream2 and returns 2001:db8:dead:: if the healthcheck fails.