Managing Public IP Addresses

Reserving a Public IP Address for IP Networks

When an instance has an interface on an IP network, you can specify a public IP address to be associated with that interface. An IP reservation allows you to reserve a public IP address from a specified IP pool. When you create an IP reservation, you can associate the public IP address with a specified vNIC on an instance.

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 IP Network, and then click IP Reservations.
  4. Click Create IP Reservation.
  5. Select or enter the required information:
    • Name: Enter a name for the IP reservation.
    • IP Pool: Select the required IP pool.

      If you select public-ippool, then your instance can communicate with external hosts over the public Internet.

      If you select cloud-ippool, then your instance can communicate with other Oracle Cloud services, such as the REST endpoint of an Oracle Cloud Infrastructure Object Storage Classic account in the same region, without sending traffic over the public Internet. You can use this IP address to connect your instance only to service endpoints. You can't connect your instance to another instance using this IP address.

    • For Instance: Select the instance that you want to associate this IP reservation with. An IP address is associated with a vNIC on an instance. After you select the instance, you must also select the vNIC on that instance, that you want to associate this IP reservation with.
    • vNIC: Select the vNIC that you want to associate this IP reservation with. If you haven’t selected an instance, this list shows all available vNICs. If you’ve selected an instance, this field shows available vNICs on the specified instance. If you don’t select a vNIC, the IP reservation isn’t associated with any vNIC. You can associate the IP reservation with a vNIC later, by updating the IP reservation.
    • Description: Enter a meaningful description for the IP reservation.
    • Tags: Enter one or more tags to help you identify the IP reservation.
  6. Click Create.
    The IP reservation is created.

    Note:

    You can view the public IP addresses associated with each interface of an instance on the instance details page.

To reserve a public IP address using the CLI, use the opc compute ip—address—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 reserve a public IP address using the API, use the POST /network/v1/ipreservation/ 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.

After reserving a public IP address:

Listing IP Reservations for IP Networks

After creating IP reservations for IP networks, you can view a list of IP reservations along with information about each IP reservation such as the public IP address and the vNIC it is associated with, if any.

To complete this task, you must have the Compute_Monitor or 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 IP Network, and then click IP Reservations.
The IP Reservations page displays a list of IP reservations, along with information about each IP reservation.

To list IP reservations using the CLI, use the opc compute ip—address—reservation list 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 list IP reservations using the API, use the GET /network/v1/ipreservation/container/ method. See REST API for Oracle Cloud Infrastructure Compute Classic.

After listing IP reservations:

Updating an IP Reservation for IP Networks

After creating an IP reservation, if required, you can add, remove, or change the vNIC associated with the public IP address. You can also modify the description of the IP reservation.

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 IP Network, and then click IP Reservations.
  4. Go to the IP reservation that you want to update, and from the menu icon menu, select Update.
  5. Update the information, as required:
    • IP Pool: Modify the IP pool that you’ve used for the IP reservation, if required. If you select public-ippool, then your instance can communicate with external hosts over the public Internet. If you select cloud-ippool , then your instance can communicate with other Oracle Cloud services, such as the REST endpoint of an Oracle Cloud Infrastructure Object Storage Classic account in the same region, without sending traffic over the public Internet.

      Note:

      If you modify the IP pool, the IP address associated with this IP reservation will change.

    • For Instance: Select the instance that you want to associate this IP reservation with. An IP address is associated with a vNIC on an instance. After you select the instance, you must also select the vNIC on that instance, that you want to associate this IP reservation with. If the IP reservation is already associated with an instance, you can remove the instance or select another instance to associate this IP reservation with.
    • vNIC: Select the vNIC that you want to associate this IP reservation with. If you haven’t selected an instance, this list shows all available vNICs. If you’ve selected an instance, this field shows available vNICs on the specified instance. If you want to remove the IP reservation from an instance, remove the vNIC that the IP reservation is associated with.
    • Description: Update the description, if required.
    • Tags: Update the tags, if required.

To update an IP reservation using the CLI, use the opc compute ip—address—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 update an IP reservation using the API, use the PUT /network/v1/ipreservation/name method. See REST API for Oracle Cloud Infrastructure Compute Classic.

Associating a Public IP Address with a vNIC

You can associate a public IP address with a vNIC of an instance either while creating the instance or when an instance is already running.

  • When you create an IP reservation using the web console, you can associate the IP reservation with a vNIC on an existing instance. See Reserving a Public IP Address for IP Networks.

  • If you’ve already created an IP reservation, then you can associate this IP reservation with an instance while creating the instance. This ensures that the vNIC is associated with the specified IP reservation whenever the instance is created or re-created. See Creating Instances.

  • If you’ve already created an IP reservation and you want to associate it with a vNIC on a running instance, you can update the IP reservation using the web console and select the required instance vNIC. See Updating an IP Reservation for IP Networks.

    To associate an IP reservation with a vNIC using the CLI, use the opc compute ip—address—association 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 associate an IP reservation with a vNIC using the API, use the POST /network/v1/ipassociation/ method. See REST API for Oracle Cloud Infrastructure Compute Classic.

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.

Removing an IP Reservation from a vNIC

If you associate an IP reservation with a vNIC while creating or updating the IP reservation, then you can remove the IP reservation from the vNIC by updating the IP reservation.

Note:

However, if you associate an IP reservation with an instance while creating the instance, then to remove the IP reservation, update the instance orchestration. Otherwise, whenever your instance orchestration is stopped and restarted, the IP reservation will again be associated with the vNIC.

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 IP Network, and then click IP Reservations.
  4. Go to the IP reservation that you want to remove, and from the menu icon menu, select Remove vNIC Association.

To remove an IP reservation from a vNIC using the CLI, use the opc compute ip—address—association 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 remove an IP reservation from a vNIC using the API, use the DELETE /network/v1/ipassociation/name method. See REST API for Oracle Cloud Infrastructure Compute Classic.

Deleting an IP Reservation for IP Networks

If you no longer need a public IP address that you’ve reserved, you can delete the IP reservation.

Prerequisites

  • Ensure that the IP reservation that you want to delete isn’t associated with a vNIC.

  • 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 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 IP Network, and then click IP Reservations.
  4. Go to the IP reservation that you want to delete, and from the menu icon menu, select Delete.

To delete an IP reservation using the CLI, use the opc compute ip—address—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 /network/v1/ipreservation/name method. See REST API for Oracle Cloud Infrastructure Compute Classic.