3

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.

xsaero00
  • 255
  • 3
  • 10

2 Answers2

2

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.

Steven Monday
  • 13,599
  • 4
  • 36
  • 45
  • 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 00:56
0
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?

Arenstar
  • 3,602
  • 2
  • 25
  • 34