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 (192.168.128.0/24) via the network interface with IP address 192.168.128.10.
- The virtual machine VM2 is connected to the virtual network private2 (192.168.30.0/24) via the network interface with IP address 192.168.30.10.
- The router router1 connects the network private1 to the physical network via the external gateway with the IP address 10.94.129.73.
- The router router2 connects the network private2 to the physical network via the external gateway with the IP address 10.94.129.74.
To be able to access VM2 from VM1, you need to add a static route for router1, specifying the CIDR of private2, that is 192.168.30.0/24, as the destination subnet and the external gateway IP address of router2, that is 10.94.129.74, as the next hop IP address. In this case, when an IP packet for 192.168.30.10 reaches router1, it will be forwarded to router2 and then to VM2.
- You have a virtual router created, as described in Managing virtual routers.
To create a static route for a router
- 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.
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.
To edit a static route
- Click the ellipsis icon next to the required static route, and then click Edit.
- In the Edit static route window, change the desired parameters, and then click Save.
To remove a static route
Click the ellipsis icon next to the static route you want to remove, and then click Delete.