If you are a system engineer managing shared networks and deploying virtual machines with CloudStack, you should be aware that currently there is no option to assign a specific IP address for the Virtual Router. The router is assigned the first free IP address. For many engineers, this might be annoying, as you are not able to make the selection by yourself. Moreover, you would prefer to hold the inventory under control and select the IP address to be assigned by yourself.
In this article, we present a new feature in CloudStack, which make the management of shared networks easier. The new capability will be available in Q3 2021 LTS release of CloudStack and will enable users to specify VR IP in shared networks.
A shared network is a network that can be accessed by virtual machines (VMs) belonging to many different accounts, and can only be created by administrators. Currently, during the creation of a shared network, the network’s DHCP service provides the range of IP addresses (IPv4 / v6), gateway, and netmask. When the first VM is deployed in this network, the Virtual Router (VR) created for the shared network is assigned the first free IP address, and this IP is persistent for the lifetime of the network.
This feature makes it possible to specify an IP address for the VR.
To make this possible, the createNetwork API has been extended to take routerIP and routerIPv6 as optional inputs:
- routerip: (string) IPv4 address to be assigned to a router
- routeripv6: (string) IPv6 address to be assigned to a router
If the router IP is not explicitly provided, then the VR is assigned the first free IP available in the network range as usual. An IP address specified also ensures persistence of a VR’s IP address after various lifecycle tasks post-creation of a network (such as a restarting network with clean up).
The following is checked when the VR’s IP is passed. If any of these checks fail then it will not be possible to specify an IP for the router:
- IP address is valid
- IP address is within the network range
- The network offering provides at least one service that requires a VR
Creation of shared network specifying a VR IP via API can be done as follows:
$ create network name=SharedNet displaytext=”Shared Network” vlan=99 gateway=184.108.40.206 netmask=255.255.255.0 startip=220.127.116.11 endip=18.104.22.168 routerip=22.214.171.124 zoneid=<zone_id> networkofferingid=<network offering providing at least one service requiring a VR>
UI Support for the VR IP fields:
This feature will be available in the Q3 2021 LTS release of CloudStack.