Skip to main content
Virtual Routing and Forwarding (VRF) on Metal with Terraform
  • Labs / 
  • Virtual Routing an...
Version 0.2.0 was released on 17 May, 2023 View changelog External link icon

Virtual Routing and Forwarding (VRF) on Metal with Terraform

Set up VRF using a Terraform script

What is it?

Metal Virtual Routing and Forwarding (VRF) is a high availability layer 3 networking service that can be implemented with a Terraform script.

The script deploys a Metal Gateway with a hardcoded single VLAN to a specified number of Metal nodes and a VRF. You can then reach Network Edge or colo network devices by setting up matching VLANs (fabric virtual connection) and configuring BGP.

A diagram showing two metros: one metro containing Equinix Metal Servers, the Metal Gateway, and VRF...  the other metro containing redundant routers, with both metros connected by primary and secondary fabric virtual connections undergoing BGP Peering.

Why do we love it?

Other than mapping the IPs and obtaining a dedicated port in the Metal console, everything to set up redundant connectivity on the Metal side is deployed by the Terraform script. From the Metal servers to their gateway to the VRF instance, all the BGP session configuration and virtual connections are included.

From there, it becomes much easier to go to pre-existing network devices in colo or new Network Edge routers as needed and connect them back to those Metal servers using Fabric. They can act as a small anchor footprint that never has to change as you extend networking capabilities. Or vice versa, you can continue to use this script and architecture in different metros to extend from a larger colo deployment or other Fabric capable location.

Pro-tip: You can also use the complementary terraform-fabric module to speed up creation of the primary and secondary fabric virtual connections. Otherwise the instructions will lead you to do this part in the Fabric console.

How do you use it?

If this is your first time using Terraform, consider exploring the provider or starting with our hands on Terraform workshop. Otherwise, skip ahead to download the project and deploy the Terraform template.

Instructions for installing Terraform and implementing the VRF deployment can be found at this relevant GitHub repo.

Before running this script, we recommend some prep work: mapping out your network architecture, gathering your ASN information, obtaining the dedicated Metal port and creating the Metal project in the Metal console.

From there you can consider starting on the existing infrastructure side, creating the matching VLANs in the Metal portal and setting the BGP rules on your colo network edge devices according to your earlier plan. Changing the variable values in the Terraform script and executing will deploy the rest.

Subscribe to our newsletter

A monthly digest of the latest news, articles, and resources.