Ports CLI reference
See the OpenStack CLI port reference for the full list of openstack port subcommands.
These commands create, list, show, update, and delete ports. Replace the PORT_ID_OR_NAME, NETWORK_ID_OR_NAME, and SECURITY_GROUP_ID_OR_NAME placeholders with the IDs or names of your ports, networks, and security groups.
List ports#
openstack port listShow port details#
openstack port show PORT_ID_OR_NAMECreate a port#
openstack port create --network NETWORK_ID_OR_NAME PORT_NAME- Additional options assign specific attributes, such as
--fixed-ip ip-address=IP_ADDRESSto assign a specific IP address.
Update a port#
openstack port set --fixed-ip ip-address=NEW_IP_ADDRESS PORT_ID_OR_NAMEopenstack port set --fixed-ip adds a fixed IP to the port; it does not replace the existing fixed IPs. After the command above, the port carries both its original IP and NEW_IP_ADDRESS.
To replace every fixed IP, clear the list and reassign in one command:
openstack port set --no-fixed-ip --fixed-ip subnet=SUBNET,ip-address=NEW_IP_ADDRESS PORT_ID_OR_NAMETo remove a single fixed IP, unset it by address:
openstack port unset --fixed-ip ip-address=OLD_IP_ADDRESS PORT_ID_OR_NAME- Other options update security groups, device owner, or other port attributes.
Delete a port#
openstack port delete PORT_ID_OR_NAMEAdd a security group to a port#
openstack port set --security-group SECURITY_GROUP_ID_OR_NAME PORT_ID_OR_NAMERemove a security group from a port#
openstack port unset --security-group SECURITY_GROUP_ID_OR_NAME PORT_ID_OR_NAMEBind a port to a host#
openstack port set --host HOST_ID PORT_ID_OR_NAME- The admin-only binding fields are
binding:host_id,binding:profile, andbinding:vnic_type. Forbinding:vnic_type,normalis the only value a project user can set.
Output columns#
Select specific columns with --column COL1 --column COL2 or change the output format with -f json, -f csv, or -f table (default).
openstack port list#
| Column | Description |
|---|---|
| ID | Port UUID |
| Name | Port name |
| MAC Address | Layer 2 hardware address |
| Fixed IP Addresses | Assigned IP addresses and subnet IDs |
| Status | Current state (ACTIVE, DOWN, BUILD) |