How to create OpenStack port forwarding

21.08.2024
Complexity
2 min.
84

What is OpenStack port forwarding:

Port forwarding in OpenStack is a mechanism that allows you to redirect incoming traffic from a port to an internal address and port within your OpenStack infrastructure.

This is useful, for example, when you need to provide access to a web application running on a specific port within your infrastructure from the outside via a public IP address and port.


How to create OpenStack Port Forwarding.

To use port forwarding, your infrastructure must have a floating IP address and instances for which this service is being created.

Creating and configuring OpenStack port forwarding is only possible through the CLI.

Learn how to work with the OpenStack CLI here: Server creation via Openstack CLI (command line)


Creating OpenStack Port Forwarding

1. Select the required floating IP:

openstack floating ip list

2. Select the required servers on which port forwarding will be configured:

openstack server list
openstack port list --server vm1/vm2

 



Copy the ID (port identifier, as it will be needed)


3. Select the required interfaces:

vm1 - 192.168.99.120

vm2 - 192.168.99.123


4. Create the rule:

openstack floating ip port forwarding create --internal-ip-address $VM_IP --port $PORT_ID --internal-protocol-port $PORT --external-protocol-port $PORT2 --protocol tcp $FLOATING_IP


The rule is created. You can now check its settings.

5. Check the rule details:

openstack floating ip port forwarding list $FLOATING_IP

(openstack floating ip port forwarding list 94.103.11.84)

 

HTTP:
http:// $FLOATING_IP:8888 - VM1
http:// $FLOATING_IP:9999 - VM2
SSH: 
VM1  $FLOATING_IP 2222
VM2 $FLOATING_IP 2223


6. How to delete a rul:

openstack floating ip port forwarding delete $FLOATING_IP $ID_FORWARD


Was this information helpful?
Yes   No
0 
By continuing to use this website you will be agreeing to the website Acceptable Use Policy and the Use of Cookies while using the website and our services. Please also read our Privacy Policy under which, to the extent stated, you consent to the processing of your personal data.