openstack vm can’t access interest (solved)

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 (

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 instead
  2. if you restart nova-network, please flush all the iptables rule by “iptables -F” and “iptables -F -t nat”

read count : 1186