I am trying to setup a simple port forwarding on an OpenVZ container that is running CentOS 5.5. When I run a command I get errors.

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables v1.3.5: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

The same command works fine on hardware node or any other physical server. I know that I can setup port forwarding for that particular container on hardware node, but thats not a solution.


It looks like your OpenVZ host node does not have netfilter support enabled for the VM guests. If you are the admin of the OpenVZ host, then I refer you to the section entitled "Setting up a firewall that allows per-container configuration" on this page of OpenVZ wiki.

  • After reading the wiki (again). I decided to add iptable_nat into list of strings in IPTABLES parameter mentioned in the wiki. And it worked. Thanks for the push in the right direction. – xsaero00 Nov 13 '10 at 0:56
modprobe ip_tables
modprobe ip_conntrack
modprobe iptable_filter
modprobe ipt_state

Try any of these..

i would guess iptable_filter..

And run the command again..

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Did it work?

  • No this did not work. Thansk for the answer anyways. – xsaero00 Nov 13 '10 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.