Atom feed of this document
  
 

 Create ports

  1. Create a port with specified IP address:

    $ neutron port-create net1 --fixed-ip ip_address=192.168.2.40
    Created a new port:
    +----------------------+-------------------------------------------------------------------------------------+
    | Field                | Value                                                                               |
    +----------------------+-------------------------------------------------------------------------------------+
    | admin_state_up       | True                                                                                |
    | binding:capabilities | {"port_filter": false}                                                              |
    | binding:vif_type     | ovs                                                                                 |
    | device_id            |                                                                                     |
    | device_owner         |                                                                                     |
    | fixed_ips            | {"subnet_id": "15a09f6c-87a5-4d14-b2cf-03d97cd4b456", "ip_address": "192.168.2.40"} |
    | id                   | f7a08fe4-e79e-4b67-bbb8-a5002455a493                                                |
    | mac_address          | fa:16:3e:97:e0:fc                                                                   |
    | name                 |                                                                                     |
    | network_id           | 2d627131-c841-4e3a-ace6-f2dd75773b6d                                                |
    | status               | DOWN                                                                                |
    | tenant_id            | 3671f46ec35e4bbca6ef92ab7975e463                                                    |
    +----------------------+-------------------------------------------------------------------------------------+

    In the previous command, net1 is the network name, which is a positional argument. --fixed-ip ip_address=192.168.2.40 is an option, which specifies the port's fixed IP address we wanted.

    [Note]Note

    When creating a port, you can specify any unallocated IP in the subnet even if the address is not in a pre-defined pool of allocated IP addresses (set by your cloud provider).

  2. Create a port without specified IP address:

    $ neutron port-create net1
    Created a new port:
    +----------------------+------------------------------------------------------------------------------------+
    | Field| Value                                                                                              |
    +----------------------+------------------------------------------------------------------------------------+
    | admin_state_up       | True                                                                               |
    | binding:capabilities | {"port_filter": false}                                                             |
    | binding:vif_type     | ovs                                                                                |
    | device_id            |                                                                                    |
    | device_owner         |                                                                                    |
    | fixed_ips            | {"subnet_id": "15a09f6c-87a5-4d14-b2cf-03d97cd4b456", "ip_address": "192.168.2.2"} |
    | id                   | baf13412-2641-4183-9533-de8f5b91444c                                               |
    | mac_address          | fa:16:3e:f6:ec:c7                                                                  |
    | name                 |                                                                                    |
    | network_id           | 2d627131-c841-4e3a-ace6-f2dd75773b6d                                               |
    | status               | DOWN                                                                               |
    | tenant_id            | 3671f46ec35e4bbca6ef92ab7975e463                                                   |
    +----------------------+------------------------------------------------------------------------------------+
    [Note]Note

    Note that the system allocates one IP address if you do not specify an IP address in the neutron port-create command.

  3. Query ports with specified fixed IP addresses:

    $ neutron port-list --fixed-ips ip_address=192.168.2.2 ip_address=192.168.2.40
    +--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
    | id                                   | name | mac_address       | fixed_ips                                                                           |
    +--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
    | baf13412-2641-4183-9533-de8f5b91444c |      | fa:16:3e:f6:ec:c7 | {"subnet_id": "15a09f6c-87a5-4d14-b2cf-03d97cd4b456", "ip_address": "192.168.2.2"}  |
    | f7a08fe4-e79e-4b67-bbb8-a5002455a493 |      | fa:16:3e:97:e0:fc | {"subnet_id": "15a09f6c-87a5-4d14-b2cf-03d97cd4b456", "ip_address": "192.168.2.40"} |
    +--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+                 

    --fixed-ips ip_address=192.168.2.2 ip_address=192.168.2.40 is one unknown option.

    How to find unknown options? The unknown options can be easily found by watching the output of create_xxx or show_xxx command. For example, in the port creation command, we see the fixed_ips fields, which can be used as an unknown option.

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...