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?)

chsalviaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
INTRODUCING: WatchGuard's New MFA Solution

WatchGuard is proud to announce the launch of AuthPoint, a powerful, yet simple, Cloud-based MFA service designed to eliminate the vulnerabilities that put your data, systems, and users at risk.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.