OpenStack | Ports
ports get created when we add subnets to the router, one port for each subnet
#to view the list of all ports
cumulus@server01:~$ openstack port list
+--------------------------------------+------+-------------------+------------------------------------
------------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses
| Status |
+--------------------------------------+------+-------------------+------------------------------------
------------------------------------------+--------+
| 04fa2fd3-7c55-4042-9831-b9159d3f68b6 | | fa:16:3e:46:74:c6 | ip_address='192.168.0.100', subnet_id='c679c440-8286-4eeb-8025-19e0c0895aef' | ACTIVE || 45fb02cf-c6ce-4406-a4cf-8846ad9b6784 | | fa:16:3e:8f:59:59 | ip_address='192.168.1.1', subnet_id='6ebf3ecb-caac-4c24-80aa-953a04bc23a8' | ACTIVE || 81a509eb-ca8d-4f05-8188-5ba7e320ba8a | | fa:16:3e:c3:fd:df | ip_address='192.168.1.2', subnet_id='6ebf3ecb-caac-4c24-80aa-953a04bc23a8' | ACTIVE || 938eeb78-86be-4db0-abaa-d23469cc1a20 | | fa:16:3e:93:ec:10 | ip_address='192.168.2.1', subnet_id='eff1b2c9-7169-4f41-8d68-8d40cca3d3d3' | ACTIVE |
+--------------------------------------+------+-------------------+------------------------------------
------------------------------------------+--------+
#to check the port list for a particular router, ex. firstRouter
cumulus@server01:~$ openstack port list --router firstRouter
+--------------------------------------+------+-------------------+------------------------------------
----------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses
| Status |
+--------------------------------------+------+-------------------+------------------------------------
----------------------------------------+--------+
| 45fb02cf-c6ce-4406-a4cf-8846ad9b6784 | | fa:16:3e:8f:59:59 | ip_address='192.168.1.1', subnet_id
='6ebf3ecb-caac-4c24-80aa-953a04bc23a8' | ACTIVE |
| 938eeb78-86be-4db0-abaa-d23469cc1a20 | | fa:16:3e:93:ec:10 | ip_address='192.168.2.1', subnet_id
='eff1b2c9-7169-4f41-8d68-8d40cca3d3d3' | ACTIVE |
+--------------------------------------+------+-------------------+------------------------------------
----------------------------------------+--------+
#to create a port, to refer to a static IP, this can be used to assign a static IP to an instance
cumulus@server01:~$ openstack port create --network firstNetwork --fixed-ip subnet=firstSubnet,ip-address=192.168.1.10 firstServerPort
+-----------------------+-----------------------------------------------------------------------------+
| Field | Value |
+-----------------------+-----------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | |
| binding_profile | |
| binding_vif_details | |
| binding_vif_type | unbound |
| binding_vnic_type | normal |
| created_at | 2018-07-10T12:59:53Z |
| data_plane_status | None |
| description | |
| device_id | |
| device_owner | |
| dns_assignment | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='192.168.1.10', subnet_id='6ebf3ecb-caac-4c24-80aa-953a04bc23a8' |
| id | 5aea7944-f9fd-4ea7-95c5-643b528acdbf |
| ip_address | None |
| mac_address | fa:16:3e:fa:40:83 |
| name | firstServerPort |
| network_id | dfb787e9-25e6-4e0d-996f-4619ba3b360d |
| option_name | None |
| option_value | None |
| port_security_enabled | True |
| project_id | 6d9cb60806744bbc9618963e77bda3cd |
| qos_policy_id | None |
| revision_number | 3 |
| security_group_ids | d01afa75-8581-44ab-993d-3a781e5e7a02 |
| status | DOWN |
| subnet_id | None |
| tags | |
| trunk_details | None |
| updated_at | 2018-07-10T12:59:53Z |
+-----------------------+-----------------------------------------------------------------------------+
cumulus@server01:~$
#let's assign the static IP to a new server, this has to be assigned while it's created/booted.
cumulus@server01:~$ openstack server create --flavor m1.nano --image cirros firstServer --port firstServerPort
+-------------------------------------+-----------------------------------------------+
| Field | Value |
+-------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | |
| OS-EXT-STS:power_state | NOSTATE |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | None |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | |
| adminPass | kkoGGv45KWgC |
| config_drive | |
| created | 2018-07-10T13:15:22Z |
| flavor | m1.nano (0) |
| hostId | |
| id | 528b162f-6b69-4320-99d3-5fca3cc0d36b |
| image | cirros (0b16d59f-71f4-48a6-9aef-add8f535bc7d) |
| key_name | None |
| name | firstServer |
| progress | 0 |
| project_id | 6d9cb60806744bbc9618963e77bda3cd |
| properties | |
| security_groups | name='default' |
| status | BUILD |
| updated | 2018-07-10T13:15:22Z |
| user_id | d85316e4978a4454836d21cbde99322d |
| volumes_attached | |
+-------------------------------------+-----------------------------------------------+
#let's check the port list associated with firstServer
cumulus@server01:~$ openstack port list --server firstServer
+--------------------------------------+-----------------+-------------------+-------------------------
----------------------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses
| Status |
+--------------------------------------+-----------------+-------------------+-------------------------
----------------------------------------------------+--------+
| 5aea7944-f9fd-4ea7-95c5-643b528acdbf | firstServerPort | fa:16:3e:fa:40:83 | ip_address='192.168.1.10
', subnet_id='6ebf3ecb-caac-4c24-80aa-953a04bc23a8' | DOWN |
+--------------------------------------+-----------------+-------------------+-------------------------
----------------------------------------------------+--------+
--end-of-post--