• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1057
  • Last Modified:

Port redirect using iptables

I'm trying to redirect port 80 to port 8080 using iptables.  I'm running Debian 4.

So, I type:

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

But I get the following error:

modprobe: Can't open dependencies file /lib/modules/2.6.18-028stab051.2-ent/modules.dep (No such file or directory)
iptables v1.3.6: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

0
chsalvia
Asked:
chsalvia
  • 4
1 Solution
 
Gabriel OrozcoSolution ArchitectCommented:
as root you need to run depmod -a
also check you have at least these modules loaded (with lsmod)
iptable_nat
nf_nat
nf_conntrack
ip_tables

all this run by root.

you may lack the kernel-modules package, or have compiled a kernel on your own without have done make modules_install

0
 
ravenplCommented:
> modprobe: Can't open dependencies file /lib/modules/2.6.18-028stab051.2-ent/modules.dep (No such file or directory)
run: depmod -a
0
 
Gabriel OrozcoSolution ArchitectCommented:
ok.. I mean after running depmod -a, check you have the other modules loaded. if you can't, then you need to install the kernel package with all modules.
0
SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

 
favorettiCommented:
Could you show us the ls output in /lib/modules? and /lib/modules/2.6.18-028stab051.2-ent?

I have the feeling that they are missing.
0
 
Gabriel OrozcoSolution ArchitectCommented:
Hi

Everyone of us see the same but with different words.

Any luck looking at our propositions?

G.
0
 
Gabriel OrozcoSolution ArchitectCommented:
Thanks
0

Featured Post

SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now