Assigning a New Secondary Private IP to a VNIC

Assign a new secondary private IP address to a VNIC.

You can add a secondary private IP to an instance after it's created. You can add it to either the primary VNIC or a secondary VNIC on the instance. The secondary private IP address must come from the CIDR of the VNIC's subnet. You can move a secondary private IP from a VNIC on one instance to a VNIC on another instance if both VNICs belong to the same subnet.

For more information see Private IP Addresses.

    1. Open the navigation menu and click Compute. Under Compute, click Instances.
    2. Under List scope, select the compartment that contains the instance you want to add a private IP address to.
    3. Click the name of the instance to open its details page.
    4. Under Resources, click Attached VNICs.
    5. Click the VNIC that you're interested in.
    6. Under Resources, click IPv4 Addresses.
    7. Click Assign Secondary Private IP Address and then enter the private IP address information:
      • Private IP Address: (Optional) An available private IP address from the subnet's CIDR (otherwise the private IP address is automatically assigned).
      • Unassign if already assigned to another VNIC: Select this check box to force reassignment of the IP address if it's already assigned to another VNIC in the subnet. Only relevant if you specify a private IP address in the preceding field.
      • Hostname: (Optional) A hostname to use for DNS within the cloud network. Only available if both the VCN and subnet have DNS labels. See DNS in Your Virtual Cloud Network.
      • Public IP Type: (Optional) Only available if the VNIC is in a public subnet. See Public IP Addresses.
    8. Click Assign.
  • Use the vnic assign-private-ip command and required parameters to assign a secondary private IP to a VNIC:

    oci network vnic assign-private-ip --ip-address IP_address --unassign-if-already-assigned VNIC_OCID
    --vnic-ip-id destination_VNIC_OCID ... [OPTIONS]

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the CreatePrivateIp operation to assign a new secondary private IP to a VNIC.