Moving a Secondary Private IP Address to a Different VNIC

Move a secondary private IP address to another VNIC in the same subnet.

Note

Using the CLI or API, you can also move more than one secondary private IP to a VNIC in the same subnet with a single command.
    1. Open the navigation menu  and select Compute. Under Compute, select Instances.
    2. Select the name of the instance to open its details page.
    3. On the Networking tab, go to the Attached VNICs section and select the VNIC that you're interested in.
    4. On the IP administration tab,
      • For IPv4 addresses, select Assign secondary private IP address and then enter the following private IP address information:
        • Subnet IPv4 CIDR block: Select an IPv4 CIDR block to automatically assign the prefix to allocate the private IP object. The available choices depend on the other selections.
        • Manually assign IPv4 addresses: Select this option to re-assign an existing private IP to this VNIC.
        • IPv4 address assignment: Manually assign IPv4 addresses to enter a specific IPv4 address from a CIDR block assigned to this subnet.
        • Private IP address: Enter the secondary private IP address to move.
        • CIDR prefix length: (Optional) Enter a netmask value if you want to assign an IP CIDR address. If you leave this field blank, the system uses 32 to assign a single private IP address. You can't reassign a private IP address if it's part of an IP CIDR address, but you can reassign an IP CIDR address itself.
        • Unassign if already assigned to another VNIC: Select this option to move the secondary IP address from the current VNIC.
        • Hostname: (Optional) Enter the hostname to use for DNS in the cloud network. This field is available only if the VCN and subnet both have DNS labels. For more information, see DNS in a Virtual Cloud Network. This field isn't available if the CIDR prefix length used isn't a host mask (/32).
        • Public IP type: (Optional) This field is available only if the VNIC is in a public subnet. For more information, see Public IP Addresses. This field isn't available if the CIDR length used isn't a host mask (/32).
      • For IPv6 addresses, Select Assign IPv6 address and then enter the following private IP address information:
        • Subnet IPv6 Prefix: Select an IPv6 prefix to automatically assign the prefix to allocate the private IP object. The available choices depend on the other selections.
        • Manually assign IPv6 addresses: Select this option to re-assign an existing private IP to this VNIC.
        • IPv6 address assignment: Manually assign IPv4 addresses to enter a specific IPv4 address from a CIDR block assigned to this subnet.
        • Private IP address: Enter the secondary private IP address to move.
        • CIDR prefix length: (Optional) Enter a netmask value if you want to assign an IP prefix address. If you leave this field blank, the system uses 128 to assign a single private IP address. You can't reassign a private IP address if it's part of an IP prefix address, but you can reassign an IP prefix address itself.
        • Unassign if already assigned to another VNIC: Select this option to move the secondary IP address from the current VNIC.
        • Hostname: (Optional) Enter the hostname to use for DNS in the cloud network. This field is available only if the VCN and subnet both have DNS labels. For more information, see DNS in a Virtual Cloud Network. This field isn't available if the CIDR prefix length used isn't a host mask (/128).
      • Route Table: (Optional) Assign a custom route table to handle traffic from this IP address. For more information, see Per-resource Routing. If you assign a custom route table, traffic from this IP address doesn't use the default VCN or subnet route tables.

    5. To assign more IP objects to the instance VNIC, select Another IPv4 address/+ Another subnet prefix. However, the objects must come from the same subnet.
    6. Select Assign.
  • Use the network vnic assign-private-ip command and required parameters to move a secondary private IP address from one VNIC to another:

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

    Optionally, use the network private-ip bulk-update command and required parameters to move more than one secondary private IP address from one VNIC to another:

    oci network private-ip bulk-update --unassign-if-already-assigned --from-json file://
     ... [OPTIONS]

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

  • Run the UpdatePrivateIp operation to move a private IP address from one VNIC to another.

    Optionally, run the BulkUpdatePrivateIps operation to move more than one private IP address from one VNIC to another within a single API call.