Managing Public IP Addresses

About Public IP Addresses

If you want to enable access to your instance over the public Internet, you must associate a public IP address with your instance. You can associate either a temporary or a persistent public IP address with an instance when you create the instance.

Temporary public IP addresses are assigned dynamically from a pool of public IP addresses. When you associate a temporary public IP address with an instance, if the instance is restarted or is deleted and created again later, its public IP address might change. If you want to assign a persistent public IP address to your instance, you must first create an IP reservation, and then associate the IP reservation with the instance.

To find out the public IP address of your instance, view the information on the Instances page. See Listing Instances.

About Private IP Addresses

When you create an instance, you can specify whether the instance should be added to the shared network, to IP networks, or to both. When you add an instance to the shared network, it is automatically assigned a private IP address from an Oracle-defined pool of addresses. This private IP address might change when the instance is restarted.

When you add an instance to one or more IP networks, each network interface is assigned an IP address in the subnet of the specified IP network. You can specify a fixed IP address from the specified IP network while creating the instance. If no IP address is specified, an IP address is allocated dynamically. This dynamically assigned IP address might change when the instance is restarted. To understand how to set up and use IP networks, see About IP Networks.

To find out the private IP addresses of your instance, view the information on the Instances page. See Listing Instances.

Reserving a Public IP Address

An IP reservation is a public IP address that you can attach to a Compute Classic instance that requires access to or from the Internet. You can create an IP reservation and associate it with an instance to enable access to the instance from the public Internet.

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

  1. Sign in to the Compute Classic console.
  2. (Optional) If your domain spans multiple sites, then check that the site you’ve selected has sufficient capacity to create the required resources. Click Site near the top of the page to view the aggregate resource usage by all tenants on the currently selected site. If resource usage on the selected site is close to maximum, pick another site.

    If you’re using the REST API to create resources, note the API end point of the site that you want to use.

  3. Click the Network tab.
  4. In the Network drop-down list, expand Shared Network, and then click the IP Reservations.
  5. Click Create IP Reservation.
  6. Enter a name for the IP reservation.
  7. In the For Instance field, you can select the instance that you want to attach the IP address to.

    Note:

    When you attach an IP reservation to a running instance, then if you delete and re-create or shut down and restart the instance, the IP reservation reverts to whatever was specified while creating the instance and any updates made to the IP reservation are lost. You must update the IP reservation again.

    Alternatively, you can create the IP reservation now without attaching it to any instance, and attach it later. See Attaching a Public IP Address to an Instance.

  8. Click Create.

To create an IP reservation using the CLI, use the opc compute ip-reservation add command. For help with that command, run the command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To create an IP reservation using the API, use the POST /ip/reservation/ method. See REST API for Oracle Cloud Infrastructure Compute Classic.

You can also create an IP reservation by using an orchestration. See Orchestration v1 Attributes Specific to Each Object Type or Orchestration v2 Attributes Specific to Each Object Type.

Updating an IP Reservation

You can change the status of an IP reservation or attach it to an instance by updating the IP reservation.

  • If you’ve created an instance without a public IP address, then updating an IP reservation allows you to attach a public IP address to an instance.

  • If you’ve created an instance with a temporary public IP address, then updating an IP reservation allows you to change its status to permanent.

Prerequisites

  • To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Note:

You should always use your orchestrations to manage resources that you’ve created using orchestrations. Don’t, for example, use the web console or the CLI or REST API to update an object that you created using an orchestration. This could cause your orchestration to either attempt to re-create the object and associated resources, or to go into an error state. See Workflows for Updating Orchestrations v2.

  1. Sign in to the Compute Classic console. If your domain spans multiple sites, select the appropriate site. To change the site, click the Site menu near the top of the page.
  2. Click the Network tab.
  3. In the Network drop-down list, expand Shared Network, and then click the IP Reservations.
  4. Identify the IP reservation that you want to update. From the menu icon menu, select Update.
    • If the selected IP reservation isn’t attached to an instance, then you can attach it now.

      Note:

      When you attach an IP reservation to a running instance, then if you delete and re-create or shut down and restart the instance, the IP reservation reverts to whatever was specified while creating the instance and any updates made to the IP reservation are lost. You must update the IP reservation again.

    • If the IP reservation is attached to an instance, then you can change its status to Temporary or Permanent.

To change the status of an IP reservation using the CLI, use the opc compute ip-reservation update command. For help with that command, run the command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To change the status of an IP reservation using the API, use the PUT /ip/reservation/name method. See REST API for Oracle Cloud Infrastructure Compute Classic.

Attaching a Public IP Address to an Instance

You can attach an IP reservation to an instance either while creating the instance or when the instance is already running, by updating the IP reservation or by updating the instance.

For information about creating instances, see Creating an Instance from the Instances Page. For information about attaching a public IP address to an instance while updating an instance, see Attaching a Public IP Address to an Instance on the Shared Network. For information about updating an IP reservation, see Updating an IP Reservation.

Note:

When you attach an IP reservation to a running instance, then if you delete and re-create or shut down and restart the instance, the IP reservation reverts to whatever was specified while creating the instance and any updates made to the IP reservation are lost. You must update the IP reservation again.

You can also associate an IP reservation with an instance when you create instances using an orchestration. See Orchestration v1 Attributes Specific to Each Object Type.

Internally, an IP reservation is associated with an instance through the instance’s vcable. A vcable provides an attachment point to a specific network interface on an instance. The vcable of an instance is created automatically when the instance is launched and is deleted when the instance is deleted.

The process of adding a virtual link between an instance and an IP reservation is also referred to as IP association.

To find out the vcable ID of your instance using the CLI, use the opc compute instance get command. To associate an IP reservation with an instance using the CLI, use the opc compute ip-association add command and specify the vcable ID. For help with these commands, run each command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To find out the vcable ID of your instance using the API, use the GET /instance/name method. To associate an IP reservation with an instance using the API, use the POST /ip/association/ method. See REST API for Oracle Cloud Infrastructure Compute Classic.

Removing a Public IP Address from an Instance

If you want to change the public IP address of an instance, or if you no longer need a public IP address for the instance, then you can remove the IP reservation from the instance.

Note:

If you associate a persistent public IP address with an instance while creating the instance, and later on you remove the public IP address from the instance, then if you delete and re-create or shut down and restart the instance, the public IP address reverts to whatever was specified while creating the instance. You must remove the public IP address from the instance again.

Note:

You can’t remove a temporary IP address from an instance. You can only remove a persistent IP address. If you created an instance with an autogenerated IP address or if you changed the status of the IP address associated with an instance to temporary, then to remove that IP address from the instance, first update it to change its status to permanent. See Updating an IP Reservation.

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

  1. Sign in to the Compute Classic console. If your domain spans multiple sites, select the appropriate site. To change the site, click the Site menu near the top of the page.
  2. Click the Network tab.
  3. In the Network drop-down list, expand Shared Network, and then click the IP Reservations.
  4. Identify the IP reservation that you want to detach. From the menu icon menu, select Remove Instance.

Internally, an IP reservation is associated with an instance by using a vcable. A vcable provides an attachment point to a specific network interface on an instance. A vcable is created automatically when an instance is launched and is deleted when the instance is deleted.

The process of adding a virtual link between an instance and an IP reservation is also referred to as IP association.

To find out the vcable ID of your instance using the CLI, use the opc compute instance get command. To remove an IP reservation from an instance using the CLI, use the opc compute ip-association delete command. For help with these commands, run each command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To find out the vcable ID of your instance using the API, use the GET /instance/name method. To remove an IP reservation from an instance using the API, use the DELETE /ip/association/name method. See REST API for Oracle Cloud Infrastructure Compute Classic.

If you specified an IP reservation to be associated with an instance in an orchestration v1, then, when you stop the orchestration, the IP reservation is detached, and the instance is deleted. See Terminating an Orchestration v1.

Deleting an IP Reservation

When you no longer need an IP reservation, you can delete it.

Prerequisites

  • To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

  • Ensure that no instance is using the IP reservation that you want to delete.

    Caution:

    If a persistent public IP address is associated with an instance during instance creation, then if required, you can remove that IP address from the instance later on. Ensure, however, that you don’t delete this IP reservation. If you delete and re-create the instance, the IP reservation will be required again. If you’ve deleted the IP reservation, you won’t be able to re-create the instance.

Note:

You should always use your orchestrations to manage resources that you’ve created using orchestrations. Don’t, for example, use the web console or the CLI or REST API to delete an object that you created using an orchestration. This could cause your orchestration to either attempt to re-create the object and associated resources, or to go into an error state.

If you created the object using orchestration v1, then you can delete the object by terminating the orchestration. See Terminating an Orchestration v1.

If you created the object using an orchestration v2, then you can delete the object by suspending, terminating, or updating the orchestration. See Suspending an Orchestration v2, Terminating an Orchestration v2, or Updating an Orchestration v2.

Procedure

  1. Sign in to the Compute Classic console. If your domain spans multiple sites, select the appropriate site. To change the site, click the Site menu near the top of the page.
  2. Click the Network tab.
  3. In the Network drop-down list, expand Shared Network, and then click the IP Reservations.
  4. Identify the IP reservation that you want to delete. From the menu icon menu, select Delete.

To delete an IP reservation using the CLI, use the opc compute ip-reservation delete command. For help with that command, run the command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To delete an IP reservation using the API, use the DELETE /ip/reservation/name method. See REST API for Oracle Cloud Infrastructure Compute Classic.