openstack-subnet
Manage OpenStack network subnets
TLDR
List all subnets
Show details of a specific subnet
List subnets associated with a network
Create a subnet with subnet range 192.168.0.0/24 in a given network
Delete a subnet
Update a subnet with DNS 8.8.8.8 and set a new name
SYNOPSIS
The openstack subnet command operates as a subcommand of the openstack client. Its general syntax is:
openstack subnet
Common actions include create, list, show, set, and delete. For example:
openstack subnet create --network
openstack subnet list [--network
PARAMETERS
--network
Specifies the network (ID or name) to which the subnet belongs or to filter by.
--name
Assigns a name to the subnet during creation or specifies a subnet by name for other actions.
--ip-version {4|6}
Defines the IP version (4 for IPv4, 6 for IPv6) for the subnet.
--gateway
Sets the IP address of the gateway for the subnet.
--no-gateway
Indicates that the subnet should not have a gateway.
--disable-dhcp
Disables the DHCP service for the subnet, preventing automatic IP assignment.
--enable-dhcp
Enables the DHCP service for the subnet, allowing automatic IP assignment.
--allocation-pool
Defines a specific range of IP addresses within the subnet that can be allocated to instances. Can be specified multiple times.
--dns-nameserver
Specifies one or more IP addresses of DNS servers to be used by instances on this subnet. Can be specified multiple times.
--host-route
Adds a static host route to the subnet, specifying a destination CIDR and its next hop. Can be specified multiple times.
--long
Displays more detailed information when listing subnets, typically used with list action.
--project
Specifies the project (tenant) ID or name that owns or is associated with the subnet.
--share | --no-share
Allows (or disallows) the subnet to be shared across multiple projects.
--subnet-pool
Uses an existing subnet pool (ID or name) to automatically allocate the CIDR for the new subnet.
--prefix-length
Specifies the desired prefix length for the subnet when allocated from a subnet pool.
DESCRIPTION
The openstack subnet command is a crucial part of the unified OpenStack command-line client, enabling users and administrators to manage IP subnets within an OpenStack cloud environment. It provides a comprehensive interface to perform various actions, including creating new subnets, listing existing ones, viewing detailed properties, updating configurations, and deleting subnets. Subnets are fundamental networking components that define IP address ranges and are used to allocate IP addresses to virtual machines and other cloud resources. This command allows for the precise configuration of subnet properties such as CIDR (Classless Inter-Domain Routing), IP version (IPv4 or IPv6), default gateway, DNS servers, DHCP settings, and specific IP allocation pools. It is indispensable for setting up and maintaining network connectivity for instances and other services in OpenStack.
CAVEATS
Using the openstack subnet command requires an active OpenStack cloud environment. Users must be properly authenticated and possess the necessary permissions within OpenStack to perform subnet operations. A foundational understanding of networking concepts, including CIDR notation, DHCP, and routing, is highly recommended for effective use. Ensure the OpenStack Neutron (networking) service is operational.
ACTION-SPECIFIC HELP
For detailed information and specific options pertaining to a particular openstack subnet action, users can invoke the help command: openstack help subnet
SUBNET IDENTIFIERS
While subnets can often be identified by their name, using their unique ID is generally more reliable and is recommended for scripting purposes to avoid ambiguity, especially if multiple subnets share the same name.
HISTORY
OpenStack, an open-source cloud computing platform, was first released in 2010. The openstackclient is the unified command-line interface, designed to consolidate and replace earlier service-specific CLI tools (like the separate Neutron client). The capabilities for managing subnets were integrated into openstackclient as part of its evolution, providing a consistent and streamlined way to interact with the Neutron networking service. This integration simplified cloud resource management for users and administrators by offering a single tool to interact with various OpenStack services.
SEE ALSO
openstack network, openstack port, openstack router, openstack security group