Building network automation solutions

9 module online course

Start now!

netlab: IRB with Anycast Gateways

netlab release 1.4 added support for static anycast gateways and VRRP. Today we’ll use that functionality to add anycast gateways to the VLAN trunk lab:

Lab topology

Lab topology

We’ll start with the VLAN trunk lab topology and make the following changes:

  • We’ll rearrange the node list to make sure the switches get the lowest possible node ID:
nodes: [ s1, s2, h1, h2, h3, h4 ]
  • The switches have to use the new gateway module:
groups: switches: members: [ s1, s2 ] module: [ vlan, gateway ] device: eos
  • We have to enable first-hop gateway on VLAN links:
vlans: red: gateway: True blue: gateway: True
  • The default FHRP protocol is anycast (we could also use VRRP), and the default shared IP address is the last IP address in the subnet. We’ll use the first IP address in the subnet: 1

After starting the lab you’ll notice the change in node identifiers and interface IP addresses. Without the anycast gateway, netlab assigns node ID 1 (and loopback IP address to S1. Now that the node ID 1 is reserved, S1 gets loopback address

The only other change on the switches is the VLAN interface configuration – netlab configures ip address as well as ip virtual-router address on EOS devices:

VLAN interface configuration on S1
interface Vlan1000
   description VLAN red (1000) -> [h1,s2,h2]
   ip address
   ip virtual-router address
interface Vlan1001
   description VLAN blue (1001) -> [h3,s2,h4]
   ip address
   ip virtual-router address
ip virtual-router mac-address 02:00:ca:fe:00:ff

Finally, the static routes on Linux hosts use the anycast gateway IP address (the default route points to the management network):

Static routes on H1
h1:/# ip route
default via dev eth0 via dev eth1 via dev eth1 via dev eth1 dev eth1 scope link  src via dev eth1 dev eth0 scope link  src

Want to run this lab on your own, or try it out with different devices? No problem:

Latest blog posts in Build Virtual Labs with netlab series

Add comment