Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Using Static Routes with Services

Static Routes for Service Instances

Static routes are manually configured in a network to initiate data transmission between two networks. The traffic generated by a set of devices in a network is directed through a static route, which ensures an efficient flow of traffic towards a specific destination address.

Static routes are used in small networks and networks with simple architecture as a route for direct communication between two networks. Static routes cannot operate in large, dynamic networks due to the frequent change in networks and routes. In such cases, we can use BGPaaS in Contrail for dynamic routing updates. A static route can also be configured as the Default route (a gateway of last resort), which the routers use to send data packets with unknown destination address.

In a virtual network, you can configure static routes towards a service virtual machine (VM) interface to direct all network traffic through the service virtual machine. The configured static routes are advertised to other nodes through BGP, which ensures that traffic is directed through specific virtual machine.

In Figure 1, there are three VMs in a virtual network (VN1) with subnet address 192.0.2.0/24. The virtual machines are VM1 (192.0.2.251), VM2 (192.0.2.252), and a Service VM (192.0.2.253). When VM1 or VM2 in VN1 generates traffic targeted towards another virtual network (VN2) with subnet address 198.51.100.0/24, you need to configure a static route. You can configure a static route towards the Service VM interface to direct the traffic generated by VM1 and VM2 destined towards VN2. Once configured, all traffic targeted towards VN2 from VN1 is directed through the static route (192.0.2.253).

Figure 1: Static Route in a Virtual NetworkStatic Route in a Virtual Network

Configuring Static Routes on a Service Instance

To configure static routes on a service instance, first enable the static route option in the service template to be used for the service instance.

To enable the static route option in a service template:

  1. Go to Configure > Services > Service Templates and click Create.
  2. At Add Service Template, complete the fields for Name, Service Mode, and Image Name.
  3. Select the Interface Types to use for the template, then for each interface type that might have a static route configured, click the check box under the Static Routes column to enable the static route option for that interface.

    The following figure shows a service template in which the left and right interfaces of service instances have the static routes option enabled. Now a user can configure a static route on a corresponding interface on a service instance that is based on the service template shown.

Configuring Static Routes on Service Instance Interfaces

To configure static routes on a service instance interface:

  1. Go to Configure > Services > Service Instances and click Create.
  2. At Create Service Instances, complete the fields for Instance Name and Services Template.
  3. Select the virtual network for each of the interfaces
  4. Click the Static Routes dropdown menu under each interface field for which the static routes option is enabled to open the Static Routes menu and configure the static routes in the fields provided.
    Note:

    If the Auto Configured option is selected, traffic destined to the static route subnet is load balanced across service instances.

The following figure shows a configuration to apply a service instance between VN1 (192.0.2.0/24) and VN2 (198.51.100.0/24). The left interface of the service instance is configured with VN1 and the right interface is configured to be VN2 (198.51.100.0/24). The static route 192.0.2.253 is configured on the left interface, so that all traffic from VN1 that is destined to VN2 reaches the left interface of the service instance.

The following figure shows static route 10.1.1.0/24 configured on the right interface, so that all traffic from VN2 that is destined to VN1 reaches the right interface of the service virtual machine.

When the static routes are configured for both the left and the right interfaces, all inter-virtual network traffic is forwarded through the service instance.

Configuring Static Routes as Host Routes

You can also use static routes for host routes for a virtual machine, by using the classless static routes option in the DHCP server response that is sent to the virtual machine.

The routes to be sent in the DHCP response to the virtual machine can be configured for each virtual network as it is created.

To configure static routes as host routes:

  1. Go to Configure > Network > Networks and click Create.
  2. At Create Network, click the Host Routes option and add the host routes to be sent to the virtual machines.

    An example is shown in the following figure.