openstack Verified current stable Not installed? Networking

Openstack / Create Port On Network

Create Port On Network

Create a new port on a specified network in OpenStack.

$
Terminal
openstack port create --network <network_id_or_name> <port_name>

When To Use

When provisioning a new instance that requires networking resources.

Pro Tip

If the specified network is down, the port creation will fail; ensure network availability beforehand.

Anatomy of Output

Understanding the result

+--------------------------------------+------+----------+-------------------+-----------+ Output Header

Displays the ID, name, and status of the newly created port.

| ID | Name | Network ID | MAC Address | Status | Column Details

Details of the created port showing its identity and state.

| 23456789-abcd-ef00-2222-334455667788 | new-port | 87654321-dcba-9876-5432-abcdef012345 | 02:42:ac:11:00:03 | ACTIVE | Port Entry

The output reflects the created port's details.

Troubleshooting

Common pitfalls

Network not found (HTTP 404)

Solution: Ensure that the network ID or name exists before creating a port.

Invalid port name (HTTP 400)

Solution: Port name must not contain special characters; use alphanumeric only.

Conflict (HTTP 409)

Solution: A port with that name already exists; use a unique name.

Command Breakdown

What each part is doing

openstack
Base Command
The executable that performs this operation. Here it runs Openstack before the shell applies any redirect operators.
<network_id_or_name>
network id or name
The value supplied for network id or name.
<port_name>
port name
The port value supplied to this command.
--network
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative networking tools for the same job.