Editing a Subnet

Edit the settings for a subnet in a Virtual Cloud Network (VCN).

You can change the following characteristics of a subnet:

  • Name
  • Size of the assigned CIDR block
  • Which set of DHCP options the subnet uses
  • Which route table the subnet uses
  • Which security lists the subnet uses

Be aware of the following considerations:

  • The CIDR block IP range that you specify must be within one of the VCN's CIDR block ranges.
  • The new range must use the same network address as the previous range. For example, the previous and new ranges could be 10.0.0.0/25 and 10.0.0.0/24.
  • If you're reducing the CIDR range, ensure that no IP addresses outside of the reduced range are in use.
  • The new CIDR range's broadcast address (last IP address of CIDR range) must not be an IP address in use in the previous CIDR range.
  • You can't create VNICs or private IP addresses for this subnet while a CIDR block update is in progress.
  • After the CIDR block update is complete, the DHCP lease for each host within the subnet must be renewed. Renewal happens automatically within 24 hours. To renew the lease immediately, see the applicable OS documentation for guidance on how to renew the lease manually.
  • Ensure that you adjust the secondary VNICs and secondary IP addresses as applicable to match the updated VCN configuration.
  • After you assign an IPv6 prefix to a subnet, it must always have at least one IPv6 prefix assigned to it.
    1. On the Virtual Cloud Networks list page, select the VCN that contains the subnet you want to work with. If you need help finding the list page or the VCN, see Listing VCNs.
    2. On the details page, perform one of the following actions depending on the option that you see:
      • Select the Subnets tab.
      • Scroll down to the table following the VCN details, which lists the subnets in the VCN.
    3. Find the subnet in the Subnets list, select the Actions menu Actions Menu for it, and then select Edit.
    4. Update the settings as needed. Avoid entering confidential information. For descriptions of the settings, see Creating a Subnet.
    5. Select Save changes.
    The changes take effect within a few seconds.
  • Use the network subnet update command and required parameters to edit a subnet:

    oci network subnet update --subnet-id ocid ... [OPTIONS]

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

  • Run the UpdateSubnet operation to edit the settings for a subnet.