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).
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:
Configuring Static Routes on Service Instance Interfaces
To configure static routes on a service instance interface:
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: