Skip to content

Network service CLI reference

See https://docs.openstack.org/ocata/cli-reference/neutron.html.

These commands allow you to manage networks, subnets, ports, routers, and floating IPs in your OpenStack environment. The <network_id_or_name>, <subnet_id_or_name>, <port_id_or_name>, <router_id_or_name>, and <floating_ip_id_or_address> in the commands are placeholders that should be replaced with the actual IDs or names of the resources.

List networks

Bash
openstack network list

Show network details

Bash
openstack network show <network_id_or_name>

Create a network

Bash
openstack network create <network_name>

Delete a network

Bash
openstack network delete <network_id_or_name>

List subnets

Bash
openstack subnet list

Show subnet details

Bash
openstack subnet show <subnet_id_or_name>

Create a subnet

Bash
openstack subnet create --network <network_id_or_name> --subnet-range <CIDR> <subnet_name>
  • <CIDR>: The IP address range of the subnet in CIDR notation (e.g., 192.168.1.0/24).

Delete a subnet

Bash
openstack subnet delete <subnet_id_or_name>

List ports

Bash
openstack port list

Show port details

Bash
openstack port show <port_id_or_name>

Create a port

Bash
openstack port create --network <network_id_or_name> <port_name>

Delete a port

Bash
openstack port delete <port_id_or_name>

List routers

Bash
openstack router list

Show router details

Bash
openstack router show <router_id_or_name>

Create a router

Bash
openstack router create <router_name>

Delete a router

Bash
openstack router delete <router_id_or_name>

Add a router interface

Bash
openstack router add subnet <router_id_or_name> <subnet_id_or_name>

Remove a router interface

Bash
openstack router remove subnet <router_id_or_name> <subnet_id_or_name>

List floating IPs

Bash
openstack floating ip list

Create a floating IP

Bash
openstack floating ip create <public_network_id_or_name>

Associate a floating IP with a port

Bash
openstack floating ip set --port <port_id_or_name> <floating_ip_id_or_address>

Disassociate a floating IP

Bash
openstack floating ip unset <floating_ip_id_or_address>