Skip to content

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"

image

  • 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

:::

image

  • Subsequently, the PF rule is created and listed.

image

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"

image

  • 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 :::

image

  • Subsequently, the PF rule is created and listed.

image

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"

image

  • Now all rules are listed

image

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 ] [--fit-width] [--print-empty] [--noindent] --internal-ip-address --port --internal-protocol-port --external-protocol-port --protocol [--description ]

Create floating IP port forwarding

positional arguments: Floating IP that the port forwarding belongs to (IP address or ID)

optional arguments: -h, --help show this help message and exit --internal-ip-address The fixed IPv4 address of the network port associated to the floating IP port forwarding --port The name or ID of the network port associated to the floating IP port forwarding --internal-protocol-port The protocol port number of the network port fixed IPv4 address associated to the floating IP port forwarding --external-protocol-port The protocol port number of the port forwarding's floating IP address --protocol The protocol used in the floating IP port forwarding, for instance: TCP, UDP --description A description that helps other users to know the reason why this rule is being created

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 Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence. --fit-width Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable --print-empty Print empty table if there is no data to show.

json formatter: --noindent whether to disable indenting the JSON