Creating ports

Ports in OpenStack can be created using the openstack port create command. Ports are automatically created by OpenStack upon server creation or can be created and attached to instances at a later time. Users may also create ports as a method of reserving IP addresses for later use or to avoid certain addresses from being allocated by OpenStack at all.

Getting ready

You will need the following details, at a minimum, for the port:

  • Network name or ID
  • Port name

For our example, the following will be used:

  • Network name: COOKBOOK_TENANT_NET_1
  • Port name: COOKBOOK_TEST_PORT_1

How to do it…

With the OpenStack client installed on our system, we are now able to create a port with the following command:

openstack port create COOKBOOK_TEST_PORT_1 \

Get OpenStack Cloud Computing Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.