Ask Your Question

Revision history [back]

map VM floating IP to outside IP, to access VM instance.

  • I have the following single host Openstack RDO and everything works fine.
  • I can connect from any host in the network to both CLI and Horizon.
  • Created a VM inside Openstack and assigned a floating IP, which works as expected.

    image description

    openstack server list

+--------------------------------------+---------+--------+-------------------------------+------------+ | ID
| Name | Status | Networks
| Image Name | +--------------------------------------+---------+--------+-------------------------------+------------+ | 0b1f4d14-3a20-4585-9614-3c7fc96005ca | cirros1 | ACTIVE | net11=, | cirros | +--------------------------------------+---------+--------+-------------------------------+------------+

I can access the VM from withing Openstack using the floating IP, but because the "public" IP is from is not accessible from the outside network

I added a couple of IP tables to map the VM floating IP (port 22) to the another IP from the outside network ( port 2222)

iptables -A FORWARD -i eno16777736 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -o br-ex -s -j SNAT --to-source
iptables -t nat -A PREROUTING -i eno16777736 -d -p tcp --dport 2222 -j DNAT --to-destination

It dosn't work !

I suspect the iptables, any help?

IP inf.

image description