Iptables – OpenVZ container can’t reach the internet

iptablesopenvz

I installed OpenVZ on my Debian 6 server which has only 1 IP.
So I tried to follow this guide on the OpenVZ wiki, but alas only with partial luck.
I succesfully forwarded port 8090 of the Host server to the port 80 of a container.
But I still can't connect to the internet from inside the container.
My NAT iptable looks like this:

Chain PREROUTING (policy ACCEPT 43M packets, 26G bytes)
 pkts bytes target     prot opt in     out     source               destination
   21  1008 DNAT       tcp  --  *      *       0.0.0.0/0            IP_ADDRESS          tcp dpt:8090 to:192.168.1.100:80

Chain POSTROUTING (policy ACCEPT 34571 packets, 6317K bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 SNAT       all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           to:IP_ADDRESS

IP_ADDRESS being the hosts/servers ip address, 192.168.1.100 being the containers ip address and eth0 being the physical network interface.
IP forwarding is enabled (cat /proc/sys/net/ipv4/ip_forward == 1).

Why can I still not connect to the internet from inside a container?

Best Answer

I finally found what the problem was.
After rechecking all the configurations again and again I finally found a little typo in my containers resolv.conf.
After adjusting it to the right nameserver, it finally works now.