Last Updated: February 25, 2016
· Lorin Hochstein

Manually configure a VM for OpenStack floating IP

Sometimes I need to manually launch a virtual machine but give it a floating IP as if it was handed out by OpenStack (using nova-network). This is for quick and dirty testing only.

Assume you have a virtual machine that has the IP address, and you want it to have the IP address This is what you would do on the controller, assuming your public interface is eth3:

ip addr add dev eth3
iptables -t nat -A nova-network-OUTPUT -d -j DNAT --to-destination
iptables -t nat -A nova-network-PREROUTING -d -j DNAT --to-destination
iptables -t nat -A nova-network-float-snat -s -o eth3 -j SNAT --to-source

Note: Since OpenStack doesn't know you've handed out this IP, it may hand it out to another instance.