Anycast: IP-SLA HOWTO

As promised, here’s the condensed step-by-step version of the series on Anycasting, complete with a legend:

Anycast Config Locations

Configuration to be performed on a server
Configuration to be performed on the router in site A
Configuration to be performed on the router in site B

The first step is to setup the loopback interface on the servers (they should be identical):

[root@server1 ~]# cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-lo:2
DEVICE=lo:2
ONBOOT=yes
IPADDR=10.10.10.10
NETMASK=255.255.255.255
EOF
[root@server1 ~]# ifup lo:2
[root@server1 ~]# ssh -l root server2
[root@server2 ~]# cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-lo:2
DEVICE=lo:2
ONBOOT=yes
IPADDR=10.10.10.10
NETMASK=255.255.255.255
EOF
[root@server2 ~]# ifup lo:2

The next step is to configure the routers to route packets destined for the anycast address via the primary network interface on the servers, run test queries against named on the primary network interface of that server, and remove the route to the anycast address if those queries take longer than 2 seconds to return:

Router1(config)#ip sla 500
Router1(config-ip-sla)#dns example.org name-server 10.20.20.20
Router1(config-ip-sla-dns)#frequency 9
Router1(config-ip-sla-dns)#timeout 2000
Router1(config-ip-sla-dns)#exit
Router1(config)#ip sla schedule 500 life forever start-time now
Router1(config)#track 500 ip sla 500
Router1(config)#ip route 10.10.10.10 255.255.255.255 10.20.20.20 name dns.example.org track 500
Router1(config)#ip access list standard static-to-ospf-list
Router1(config-ip-access)#permit 10.10.10.10
Router1(config-ip-access)#exit
Router1(config)#route-map static-to-ospf-map 10
Router1(config-route-map)#match ip address static-to-ospf-list
Router1(config-route-map)#exit
Router1(config)#router ospf 1
Router1(config-router)#redistribute static metric-type 1 subnets route-map static-to-ospf-map
Router1(config-router)#exit
Router1(config)#
Router2(config)#ip sla 500
Router2(config-ip-sla)#dns example.org name-server 10.30.30.30
Router2(config-ip-sla-dns)#frequency 9
Router2(config-ip-sla-dns)#timeout 2000
Router2(config-ip-sla-dns)#exit
Router2(config)#ip sla schedule 500 life forever start-time now
Router2(config)#track 500 ip sla 500
Router2(config)#ip route 10.10.10.10 255.255.255.255 10.30.30.30 name dns.example.org track 500
Router2(config)#ip access list standard static-to-ospf-list
Router2(config-ip-access)#permit 10.10.10.10
Router2(config-ip-access)#exit
Router2(config)#route-map static-to-ospf-map 10
Router2(config-route-map)#match ip address static-to-ospf-list
Router2(config-route-map)#exit
Router2(config)#router ospf 1
Router2(config-router)#redistribute static metric-type 1 subnets route-map static-to-ospf-map
Router2(config-router)#exit
Router2(config)#

Confused? Read the other entries in this series:

  1. Anycast: Networking Introduction
  2. Anycast: The Loophole
  3. Anycast: The Interface
  4. Anycast: Handling Routes
  5. Anycast: DGRAM vs. STREAM
  6. Anycast: IP-SLA HOWTO
Advertisements