List floatin IPs
openstack floating ip list +--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+ | ID | Floating IP Address | Fixed IP Address | Port | Floating Network | Project | +--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+ | dc049c28-6562-4c37-834b-d3a612d4b580 | 1.2.3.4 | None | None | 39583230-154f-4b56-a56e-2fd83c9986ce | 1eede1bdc28344f3acf6b48b232e406f | +--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+
List VMs
openstack server list +--------------------------------------+---------------------------------------------------+--------+---------------------------------+-----------------------------------+-----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+---------------------------------------------------+--------+---------------------------------+-----------------------------------+-----------+ | d278cb52-d258-491b-8787-25aaab75f84c | dev-u1910 | ACTIVE | dev-net=10.0.1.9 | Ubuntu 19.10 minimal | m1.micro | | 1da2e275-e680-4c69-be00-93871274ceb3 | dev-u1804 | ACTIVE | dev-net=10.0.1.12 | Ubuntu 18.04 | m1.micro | +--------------------------------------+---------------------------------------------------+--------+---------------------------------+-----------------------------------+-----------+
Get port IDs for server
openstack port list --server ${SERVER_ID} -c id -f value 4f20d5a9-bdc6-4046-b1bc-291c4d4bf86d openstack port list --server ${SERVER_ID} -c id -f value 9e583adb-618f-42ba-96ee-1a7b89a377b3
Create port forward to HTTP
openstack floating ip port forwarding create --internal-ip-address 10.0.1.9 --port 4f20d5a9-bdc6-4046-b1bc-291c4d4bf86d --internal-protocol-port 80 --external-protocol-port 80 --protocol tcp 1.2.3.4 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | description | None | | external_port | 80 | | id | d4fb36ba-c04e-44f1-b8c5-27d49646fe2f | | internal_ip_address | 10.0.1.9 | | internal_port | 80 | | internal_port_id | 4f20d5a9-bdc6-4046-b1bc-291c4d4bf86d | | name | None | | project_id | | | protocol | tcp | +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Create port forward to SSH
openstack floating ip port forwarding create --internal-ip-address 10.0.1.12 --port 9e583adb-618f-42ba-96ee-1a7b89a377b3 --internal-protocol-port 22 --external-protocol-port 222 --protocol tcp 1.2.3.4 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | description | None | | external_port | 222 | | id | d7418d81-fbc3-48b8-948b-5f27d951b7e2 | | internal_ip_address | 10.0.1.12 | | internal_port | 22 | | internal_port_id | 9e583adb-618f-42ba-96ee-1a7b89a377b3 | | name | None | | project_id | | | protocol | tcp | +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
List port forwards
openstack floating ip port forwarding list 1.2.3.4 +--------------------------------------+--------------------------------------+---------------------+---------------+---------------+----------+-------------+ | ID | Internal Port ID | Internal IP Address | Internal Port | External Port | Protocol | Description | +--------------------------------------+--------------------------------------+---------------------+---------------+---------------+----------+-------------+ | d4fb36ba-c04e-44f1-b8c5-27d49646fe2f | 4f20d5a9-bdc6-4046-b1bc-291c4d4bf86d | 10.0.1.9 | 80 | 80 | tcp | None | | d7418d81-fbc3-48b8-948b-5f27d951b7e2 | 9e583adb-618f-42ba-96ee-1a7b89a377b3 | 10.0.1.12 | 22 | 222 | tcp | None | +--------------------------------------+--------------------------------------+---------------------+---------------+---------------+----------+-------------+
Ensure access to internal port is allowed by security roles
openstack port show ${PORT_ID} -c security_group_ids openstack security group rule create --protocol tcp --dst-port 22 --remote-ip 0.0.0.0/0 ${SECURITY_GROUP_ID}
Delete floating IP port forwarding role
openstack floating ip port forwarding delete 1.2.3.4 0aa9905d-7bfd-47b6-8674-6bbe4f9d43a8