Managing Virtual Routers

Virtual routers provide L3 services such as routing and Source Network Address Translation (SNAT) between virtual and physical networks, or different virtual networks:

  • A virtual router between virtual and physical networks provides access to public networks, such as the Internet, for VMs connected to this virtual network.
  • A virtual router between different virtual networks provides network communication for VMs connected to these virtual networks.

A virtual router has two types of ports:

  • An external gateway that is connected to a physical network.
  • An internal port that is connected to a virtual network.

With virtual routers, you can do the following:

  • Create virtual routers
  • Change external or internal router interfaces
  • Create, edit, and delete static routes
  • Change a router name
  • Delete a router

Limitations:

  • A router can only connect networks that have IP management enabled.
  • You can delete a virtual router if no floating IP addresses are associated with any network it is connected to.

Requirements:

  • Compute networks are created, as described in Managing Virtual Private Networks.
  • The compute networks that are to be connected to a router have a gateway specified.

To create a virtual router:

Click Create.to remove, and then click Delete.


Click Create.to remove, and then click Delete.

Navigate to the Routers screen and click + Add router.

In the Add virtual router window:

Specify the name of the virtual router.

On the Network dropdown menu, select an available public network through which public networks will be accessed.

Select the SNAT checkbox to allow VMs in the private network to communicate with the Internet.

In the Add Internal Interfaces section, select the created private network (refer to Creating Virtual Private Network) as an internal interface for the router.

Managing Router Interfaces

Requirements:

  • You have a virtual router created, as described in Managing Virtual Routers.

Adding External Router Interface

  1. If you already have an external gateway, remove the existing one first.
  2. On the Routers screen, click the router name to open the list of its interfaces.
  3. Click Add on the toolbar, or click Add interface if there are no interfaces to show.
  4. In the Add interface window, do the following:
    1. Select External Gateway. From the Network drop-down menu, select a physical network to connect to the router. The new interface will pick an unused IP address from the selected physical network. You can also provide a specific IP address from the selected physical network to assign to the interface in the IP address field.[Optional] Select or deselect the SNAT check box to enable or disable SNAT on the external gateway of the router. With SNAT enabled, the router replaces VM private IP addresses with the public IP address of its external gateway.


  5. Click Add.

Adding an Internal Router Interface

  1. On the Routers screen, click the router name to open the list of its interfaces.
  2. Click Add.
  3. In the Add interface window, select a network to connect to the router from the Network drop-down menu. The new interface will attempt to use the gateway IP address of the selected virtual network by default. If it is in use, specify an unused IP address from the selected virtual network to assign to the interface in the IP address field.



  4. Click Add.

Editing Router Interface Parameters

  1. Click the ellipsis icon next to the interface, and then click Edit.
  2. In the Edit interface window, change the IP address.
  3. For an external interface, enable or disable SNAT on it.
  4. Click Save to save your changes.

Removing Router Interface

  1. Select the interface you want to remove.
  2. Click the ellipsis icon next to it, and then click Delete.

Managing Static Routes

You can also configure static routes of a router by manually adding entries into its routing table. This can be useful, for example, if you do not need a mutual connection between two virtual networks and want only one virtual network to be accessible from the other.

Consider the following example:

  • The virtual machine VM1 is connected to the virtual network private1 via the network interface with IP address.
  • The virtual machine VM2 is connected to the virtual network private2 via the network interface with IP address.
  • The router router1 connects the network private1 to the physical network via the external gateway with the IP address.
  • The router router2 connects the network private2 to the physical network via the external gateway with the IP address.

To be able to access VM2 from VM1, you need to add a static route for router1, specifying the CIDR of private2, as the destination subnet and the external gateway IP address of router2,as the next hop IP address. In this case, when an IP packet of router1, it will be forwarded to router2 and then to VM2.

Requirements:

  • You have a virtual router created, as described in Managing Virtual Routers.

Creating Static Route for Router

  1. On the Routers screen, click the router name. Open the Static routes tab, and then click Add on the right pane. If there are no routes to show, click Add static route.
  2. In the Add static route window, specify the destination subnet range and mask in CIDR notation and the next hop’s IP address. The next hop’s IP address must belong to one of the networks that the router is connected to.


  3. Click Add.

Editing Static Route

  1. Click the ellipsis icon next to the required static route, and then click Edit.
  2. In the Edit static route window, change the desired parameters, and then click Save.

Removing Static Route

Click the ellipsis icon next to the static route you want to remove, and then click Delete.

Was this article helpful?

Related Articles