Changes

Jump to: navigation, search

Using NAT for container with private IPs

295 bytes added, 17:04, 27 March 2010
How to provide access for container to Internet
# iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to ip_address
</pre>
 
{{Note|For a Debian O.S v4 or v5 Hardware Node, you may need to allow a forward rule. The table still being the default table (filter) but the chain is FORWARD :
 
<pre>
# /sbin/iptables -A FORWARD -s 172.16.150.0/24 -j ACCEPT
# /sbin/iptables -A FORWARD -d 172.16.150.0/24 -j ACCEPT
</pre>}}
 
If you are using an iptables firewall (for example the default RedHat/CentOS firewall), don't forget to allow outgoing connections from your containers. For example if you are using the subnet 172.16.150.0/24 for your VMs, you should do the following:
# /sbin/service iptables restart
</pre>
 
{{Note|If the above is not working then check if one of the following solutions does the trick.}}
Anonymous user

Navigation menu