Create a subnet:
$ neutron subnet-create net1 192.168.2.0/24 --name subnet1
Created a new subnet: +------------------+--------------------------------------------------+ | Field | Value | +------------------+--------------------------------------------------+ | allocation_pools | {"start": "192.168.2.2", "end": "192.168.2.254"} | | cidr | 192.168.2.0/24 | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | 192.168.2.1 | | host_routes | | | id | 15a09f6c-87a5-4d14-b2cf-03d97cd4b456 | | ip_version | 4 | | name | subnet1 | | network_id | 2d627131-c841-4e3a-ace6-f2dd75773b6d | | tenant_id | 3671f46ec35e4bbca6ef92ab7975e463 | +------------------+--------------------------------------------------+
The subnet-create command has the following positional and optional parameters:
The name or ID of the network to which the subnet belongs.
In this example,
net1
is a positional argument that specifies the network name.The CIDR of the subnet.
In this example,
192.168.2.0/24
is a positional argument that specifies the CIDR.The subnet name, which is optional.
In this example,
--name subnet1
specifies the name of the subnet.