Creating a Subnet
To create a subnet using the OCI Console:
1. Go to the OCI Console.
2. Click Networking > Virtual Cloud Networks.
3. Click the name of the VCN in which you want to create the subnet.
4. Click Subnets.
5. Click Create Subnet.
6. Enter the required information, such as the subnet name, CIDR block, and route table.
7. Click Create Subnet.
To create a subnet using the OCI CLI:
1. Run the following command:
oci subnet create --name <subnet_name> --cidr-block <cidr_block> --vcn-id <vcn_id> --route-table-id <route_table_id>
Managing Subnets
Once you have created a subnet, you can manage it using the OCI Console or the OCI CLI.
Using the OCI Console:
1. Go to the OCI Console.
2. Click Networking > Virtual Cloud Networks.
3. Click the name of the VCN in which the subnet is located.
4. Click Subnets.
5. Click the name of the subnet that you want to manage.
6. Click Edit.
7. Make the desired changes to the subnet, such as the subnet name, CIDR block, or route table.
8. Click Save Changes.
Using the OCI CLI:
To manage a subnet using the OCI CLI, you can use the following commands:
Get subnet information:
oci subnet get --id <subnet_id>
Update subnet information:
oci subnet update --id <subnet_id> --name <subnet_name> --cidr-block <cidr_block> --route-table-id <route_table_id>
Delete subnet:
oci subnet delete --id <subnet_id>
OCI CLI Examples
Here are some examples of using the OCI CLI to create and manage subnets:
# Create a subnet
oci subnet create --name my-subnet --cidr-block 10.0.0.0/24 --vcn-id ocid1.vcn.oc1.iad.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Get subnet information
oci subnet get --id ocid1.subnet.oc1.iad.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Update subnet information
oci subnet update --id ocid1.subnet.oc1.iad.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --name new-subnet --cidr-block 10.0.1.0/24
# Delete subnet
oci subnet delete --id ocid1.subnet.oc1.iad.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Creating and managing subnets is an important part of administering a VCN in OCI. You can use the OCI Console or the OCI CLI to create and manage subnets.
No comments:
Post a Comment