All Products
Search
Document Center

Server Load Balancer:Specify private IP addresses when you create an NLB instance by using OpenAPI Explorer

Last Updated:Jan 11, 2024

Alibaba Cloud OpenAPI Explorer allows you to manage IP addresses and specify private IP addresses for a Network Load Balancer (NLB) instance. When you create an Internet-facing or internal-facing NLB instance, you can use Alibaba Cloud OpenAPI Explorer to specify an IPv4 address in the CIDR block of each vSwitch to which the NLB instance belongs as the private IP address.

Usage notes

  • You can specify private IPv4 addresses for IPv4 or dual-stack NLB instances. You cannot specify private IPv6 addresses for dual-stack NLB instances.

  • Before you create an NLB instance, make sure that the vSwitches in the zones where you want to create the NLB instance provide sufficient IP addresses. To create an NLB instance, make sure that at least five IP addresses are available in each vSwitch, including four IP addresses for health checks and one virtual IP address. If the number of IP addresses is insufficient, an error occurs and you cannot purchase an NLB instance.

    Note

    To ensure the scalability of an NLB instance, we recommend that you reserve at least eight IP addresses in each vSwitch of the NLB instance.

    • You can call the DescribeZones operation to query the most recent zone list.

    • You can call the DescribeVSwitches operation to query vSwitches and CIDR blocks.

Procedure

  1. Log on to OpenAPI Explorer.

  2. On the CreateLoadBalancer page, specify the request parameters that are used to create the NLB instance. In this example, Region is set to China (Hangzhou).

    The following table describes only the parameters that are relevant to this topic. For more information about how to specify the other parameters, see CreateLoadBalancer.

    Parameter

    Description

    Example

    LoadBalancerType

    The type of the Server Load Balancer (SLB) instance. Set the value to network, which specifies NLB.

    network

    LoadBalancerName

    The name of the NLB instance.

    NLB-test01

    AddressType

    The type of IPv4 address of the NLB instance.

    • Internet: The NLB instance uses a public IP address. The domain name of the NLB instance is resolved to the public IP address. In this case, the NLB instance can be accessed over the Internet.

    • Intranet: The NLB instance uses a private IP address. The domain name of the NLB instance is resolved to the private IP address. In this case, the NLB instance can be accessed over the virtual private cloud (VPC) in which the NLB instance is deployed.

    You can specify Internet or Intranet based on your business requirements.

    Intranet

    AddressIpVersion

    The protocol version. Valid values:

    • ipv4 (default): IPv4

    • DualStack: dual stack

    In this example, only ipv4 is supported.

    ipv4

    VpcId

    The ID of the VPC in which the NLB instance is deployed.

    You can log on to the VPC console. In the top navigation bar, select the China (Hangzhou) region. On the VPCs page, find and view the ID of the VPC.

    vpc-bp18jb3fqfklxde2z****

    ZoneMappings

    The mappings between zones and vSwitches. You must specify at least two zones.

    • VSwitchId: the ID of the vSwitch in the zone.

    • ZoneId: the ID of the zone.

      You can call the DescribeZones operation to query zone IDs.

    • PrivateIPv4Address: the private IP address.

      Important

      When you specify a private IP address for the NLB instance, make sure that the IP address belongs to the destination CIDR block of the vSwitch and is not in use.

    • AllocationId: the ID of the elastic IP address (EIP) that is associated with the Internet-facing NLB instance.

    You can log on to the VPC console. In the top navigation bar, select the China (Hangzhou) region. On the VPCs page, click the ID of the VPC that you want to manage. On the Resources tab, click the number of vSwitches to view the IDs and CIDR blocks of the vSwitches.

    In this example, Zone J and Zone K are specified. You can specify zones based on the number of available zones.

    Configuration of Zone J:

    • ZoneMappings.1.VSwitchId: vsw-bp1gw3z8urk2a7n8j****

    • ZoneMappings.1.ZoneId: cn-hangzhou-j

    • ZoneMappings.1.PrivateIPv4Address: 10.0.3.243

    Configuration of Zone K:

    • ZoneMappings.0.VSwitchId: vsw-bp1af7hb3d7j6lv5f****

    • ZoneMappings.0.ZoneId: cn-hangzhou-k

    • ZoneMappings.0.PrivateIPv4Address: 10.0.2.25

  3. Click Initiate Call.

    The following result is returned. If the returned HTTP status code is 200, the NLB instance is created. If another HTTP status code is returned, refer to the returned message or Troubleshoot HTTP 5xx errors for troubleshooting.

    {
      "RequestId": "22260859-BB7C-5102-8046-87953CAF920C",
      "HttpStatusCode": 200,
      "LoadbalancerId": "nlb-f1j2qxsnip8wzo****",
      "OrderId": 22208577321****,
      "Success": true
    }

    After the call is successful, you can call the GetLoadBalancerAttribute operation to view the parameters of the NLB instance.

  4. Optional:After the call is successful, you can log on to the NLB console to view the parameters of the NLB instance whose private IP addresses are 10.0.3.243 and 10.0.2.25.

    1. In the top navigation bar, select the China (Hangzhou) region.

    2. On the Instances page, find the instance and click its ID.

    3. On the Instance Details tab, view the private IP addresses of the instance.

      As shown in the following figure, the NLB instance created by using OpenAPI Explorer is available and uses the specified private IP addresses.实例

References