Assigning Secondary Private IPs to a NIC

You can assign one or more secondary private IPs to a specified network interface card (NIC). This enables you to have multiple IPs for a virtual machine (VM) in a Net.

When a NIC is attached to a VM, the maximum number of secondary private IPs is limited by the VM type. For more information, see VM Types.

Linking Secondary Private IPs to a NIC Using Cockpit v2

  1. In the NICs dashboard, click the IconView details icon of the NIC you want to link a secondary private IP to.
    The NIC details panel appears.

  2. On the Private IPs tab, click IconLink Link.
    The LINK PRIVATE IP dialog box appears.

  3. In the Private IP field, type the secondary private IP you want to link the NIC to.

  4. Click Link.
    The secondary private IP is linked to the NIC.

Linking Secondary Private IPs to a NIC Using OSC CLI

The LinkPrivateIps command assigns one or more secondary private IPs to a specified network interface card (NIC). This action is only available in a Net. The private IPs to be assigned can be added individually using the PrivateIps parameter, or you can specify the number of private IPs to be automatically chosen within the Subnet range using the SecondaryPrivateIpCount parameter. You can specify only one of these two parameters. If none of these parameters are specified, a private IP is chosen within the Subnet range.

Request sample: Linking specific secondary private IPs to a NIC
$ osc-cli api LinkPrivateIps --profile "default" \
    --NicId "eni-12345678" \
    --PrivateIps '["10.0.0.6", "10.0.0.7"]'
Request sample: Linking a number of random secondary private IPs to a NIC
$ osc-cli api LinkPrivateIps --profile "default" \
    --NicId "eni-12345678" \
    --SecondaryPrivateIpCount 3

This command contains the following attributes that you need to specify:

  • AllowRelink: (optional) If true, allows an IP that is already assigned to another NIC in the same Subnet to be assigned to the NIC you specified.

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • NicId: The ID of the NIC.

  • PrivateIps: (optional) The secondary private IP or IPs you want to assign to the NIC within the IP range of the Subnet.

  • SecondaryPrivateIpCount: (optional) The number of secondary private IPs to assign to the NIC.

The LinkPrivateIps command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Linking Secondary Private IPs to a NIC Using oapi-cli

The LinkPrivateIps command assigns one or more secondary private IPs to a specified network interface card (NIC). This action is only available in a Net. The private IPs to be assigned can be added individually using the PrivateIps parameter, or you can specify the number of private IPs to be automatically chosen within the Subnet range using the SecondaryPrivateIpCount parameter. You can specify only one of these two parameters. If none of these parameters are specified, a private IP is chosen within the Subnet range.

Request sample: Linking specific secondary private IPs to a NIC
$ oapi-cli --profile "default" LinkPrivateIps \
    --NicId "eni-12345678" \
    --PrivateIps '["10.0.0.6", "10.0.0.7"]'
Request sample: Linking a number of random secondary private IPs to a NIC
$ oapi-cli --profile "default" LinkPrivateIps \
    --NicId "eni-12345678" \
    --SecondaryPrivateIpCount 3

This command contains the following attributes that you need to specify:

  • AllowRelink: (optional) If true, allows an IP that is already assigned to another NIC in the same Subnet to be assigned to the NIC you specified.

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • NicId: The ID of the NIC.

  • PrivateIps: (optional) The secondary private IP or IPs you want to assign to the NIC within the IP range of the Subnet.

  • SecondaryPrivateIpCount: (optional) The number of secondary private IPs to assign to the NIC.

The LinkPrivateIps command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Assigning Secondary Private IPs to an FNI Using AWS CLI

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI.

To assign one or more secondary private IPs to an FNI, use the assign-private-ip-addresses command following this syntax:

Request sample
$ aws ec2 assign-private-ip-addresses \
  --profile YOUR_PROFILE \
  --network-interface-id eni-12345678 \
  --private-ip-addresses 10.0.0.4 \
  --secondary-private-ip-address-count NOT_SPECIFIED \
  --allow-reassignment \
  --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • network-interface-id: The ID of the FNI.

  • (optional) private-ip-addresses: One or more secondary private IPs to assign to the FNI within the IP range of the subnet.

  • (optional) secondary-private-ip-address-count: A number of secondary private IPs to assign to the FNI.

    You need to specify either the private-ip-addresses or the secondary-private-ip-address-count attributes.

  • (optional) allow-reassignment | no-allow-reassignment: If set to allow-reassignment, allows a private IP already assigned to another FNI in the same subnet to be reassigned to the specified FNI.

  • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

The secondary IPs are assigned to the FNI.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.