Port Forwarding
The following How-To describes how you can configure PORT forwarding in the OpenStack Portal. Please note the Disclaimer and that the following is an example configuration.
Prerequisites
For PORT forwarding, you need:
- a router and
- a free Floating IP address (Public IP)
Example 1: PORT Forwarding of a PORT
Scenario Description:
- PORT forwarding of PORT (2222) to an Instance (VM) on PORT 22
To do this, perform the following steps:
- On the left in the navigation bar, click "Network" => "Floating IPs"
- If you do not have a free Floating IP address yet, click the button (1) "Allocate IP To Project"
- Then click the drop-down list (2) and select "Configure floating IP port forwarding rules"
- On the next page, click "+Add floating IP port forwarding rule" (1)
- Now enter the desired information (2) in the input mask and click "Add" (3)
Tip
Please note the description of the input fields
:::
- Subsequently, the PF rule is created and listed.
Note
You can create any number of additional PF rules for this Floating IP, edit the created rule with button (A), or delete it (C). For the forwarding to work, the PORTS (Ingress) must, of course, also be enabled in the applied Security Group.
Example 2: PORT Forwarding of a PORT Range
Scenario Description:
- PORT forwarding of the PORT range (7010-7020) to an Instance (VM) on the PORT range 710-720
Note
The external and internal PORT ranges must be the same size.
To do this, perform the following steps:
- On the left in the navigation bar, click "Network" => "Floating IPs"
- If you do not have a free Floating IP address yet, click the button (1) "Allocate IP To Project"
- Then click the drop-down list (2) and select "Configure floating IP port forwarding rules"
- On the next page, click "+Add floating IP port forwarding rule" (1)
- Now enter the desired information (2) in the input mask and click "Add" (3)
Tip
Please note the description of the input fields :::
- Subsequently, the PF rule is created and listed.
Note
You can create any number of additional PF rules for this Floating IP, edit the created rule with button (A), or delete it (C). For the forwarding to work, the PORTS (Ingress) must, of course, also be enabled in the applied Security Group.
List of all Port Forwarding Rules for all Floating IPs
To get an overview of all Port Forwarding Rules created for this project for all Floating IPs, please perform the following steps:
- On the left in the navigation bar, click "Network" => "Floating IPs"
- Then click the button (1) "List all floating IP port forwarding rules"
- Now all rules are listed
Note
You can sort the list by columns (A), edit the created rules (B), or delete them (C). To delete, first select the rule to be deleted (D).
Example 3: Create PORT Forwarding Rule via CLI
To configure Port Forwarding via the OpenStack Command Line, you will find an example below:
# 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 217.71.95.21
Note
Further help can be obtained with the following command (see example below).
``` console
openstack floating ip port forwarding create --help
usage: openstack floating ip port forwarding create [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN]
[--prefix PREFIX]
[--max-width
Create floating IP port forwarding
positional arguments:
optional arguments:
-h, --help show this help message and exit
--internal-ip-address
output formatters: output formatter options
-f {json,shell,table,value,yaml}, --format {json,shell,table,value,yaml} the output format, defaults to table -c COLUMN, --column COLUMN specify the column(s) to include, can be repeated
shell formatter: a format a UNIX shell can parse (variable="value")
--prefix PREFIX add a prefix to all variable names
table formatter:
--max-width
json formatter: --noindent whether to disable indenting the JSON