Virtual IP for service instances

You can configure a virtual IP (VIP) address for a service so that each service instance is assigned a separate VIP, which prevents service instances from sharing IP addresses.

A VIP is an IP address that is assigned to multiple applications that reside on a single server, multiple domain names, or multiple servers, rather than being assigned to a specific single server or network interface card (NIC). Incoming data packets are sent to the VIP address and routed to actual network interfaces.

With VIP configured, each service instance has a separate VIP, and the number of the VIPs is determined by the maximal number of the service instances that the service could have. Since there is one base VIP, the VIPs for one service are continuous, which means that discontinued VIP settings are not supported. All service instances must be started within the same subnet, so that the host physical IPs (at least in one network interface) and VIPs are in the same subnet.

To support VIP for a service, the VIP address is applied to the target host where the service instance is going to run. If you start one service that has VIP address configured, each running service instance has one specified VIP address.

Important: To configure this feature, you must make sure that the following conditions are met:
  • All of the hosts that the service might run on are in the same subnet (at least one network interface), and that the VIPs used to configure are also in the subnet.
  • VIPs that are configured to services are reserved.
  • IP addresses are accessible if there is a firewall inside the subnet. To prevent IP conflicts, the ServiceFailoverFencing parameter needs to be configured. For information, see Service profile reference.

The following environment variable is configured for this feature: EGOSC_INSTANCE_VIP.

You can configure this feature in the application template using the following parameters and attributes in the resources section. For example:
serviceA_vip:
        type: IBM::ASC::VirtualIP
        properties:
            basevirtualip: { get_param: basevipA }
            netmask: 255.255.255.0
  • basevirtualip, which specifies the basic virtual IP address for high availability. Each service instance has a unique virtual IP address. The virtual IP address for the specified service instance is BaseVirtualIP + service instance sequence number - 1. The virtual IP address must be IPv4 and in the x.x.x.x format.
  • netmask, which specifies the network mask for base virtual IP. Since all VIPs are in the same subnet, the netmask values are unique. If the net mask is not set, the default value would be the default net mask of the network class that could be derived from the address of the VIP, such as Class A: 255.0.0.0; Class B: 255.255.0.0; and Class C: 255.255.255.0.

After you define the VIP settings for a service in the application template, if you want to update the VIP settings in the service profile, you have to restart the service.

You can also configure this feature by adding the following parameters in the service profile. For example:
<sc:NetworkPolicy> 
           <sc:VirtualIPSettings>
             <sc:BaseVirtualIP >192.168.1.10</sc:BaseVirtualIP >
             <sc:Netmask >255.255.255.0</sc:Netmask >
           </sc:VirtualIPSettings >
          </sc:NetworkPolicy>

Once VIP is configured to a service and you have started or restarted the service, you can see the configured VIP settings and the VIP assigned to each service instance in the Platform Management Console (PMC).

To view the virtual IP address and the netmask for a service in the PMC, navigate to the Service tab on the Application Instance page, click Options and select Basic Virtual IP and Netmask columns, and click Apply.

To view the virtual IP address for service instances in the PMC, navigate to the Service Instances tab on the Application Instance page, click Options and select Virtual IP and Netmask columns, and click Apply.