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 select Compute. Under Compute, select Instances.
    2. Under List scope, select the compartment that contains the instance you want to add a private IP address to.
    3. Select the name of the instance to open its details page.
    4. Under Resources, select Attached VNICs.
    5. Select the VNIC that you're interested in.
    6. Under Resources, select IPv4 Addresses.
    7. Select 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 checkbox 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.
      • Route Table: (Optional) Assign a custom route table to use with traffic sent from this IP address. See Associating a Route Table with a VNIC or VNIC IP addresses for more details. If you use this option, remember that traffic from this IP address doesn't use the default VCN or subnet route tables.
    8. Select Assign.
  • Use the network 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-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.