openstack vm can’t access interest (solved)

openstack vm can’t access interest (solved)

2014/01/08 Openstack Titan 0

Here is my home openstack lab, if you follow the openstack official guide┬áto try openstack, your environment will be pretty similar than mine. I met a trouble: my openstack vm can’t access internet. Here is how to solve it:

My environment is:

My home openstack environment

My home openstack environment

1) I got a broadband line, connected to the gateway server, the gateway server got two network cards, one for the broadband and one connected to the switch.

2) the openstack server is connected to the switch and the gateway is set to that gateway server (192.168.100.10).

3) VMs are running in that openstack server, dhcp and flat network.

Here is how i solve this issue:

We need to forward all the packet come in br100 to the outside world, here are the commands:

iptables --table nat --append POSTROUTING --out-interface  br100  -j MASQUERADE
iptables --append FORWARD --in-interface br100 -j ACCEPT

Something need to be carefully :

  1. do not point your vm’s gateway to your real gateway server, point it to 10.0.0.1 instead
  2. if you restart nova-network, please flush all the iptables rule by “iptables -F” and “iptables -F -t nat”