Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
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?

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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