Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iptables all port forward? 2

Status
Not open for further replies.

rninja

Technical User
Apr 11, 2001
381
US
How can I get every inside or outside IP forwarded on any port to port 80 on a local server through iptables?

Essentialy, I want to be able to have users login through a webpage and I want every port to forward to port 80 for that.

What code do I need to use to properly config this in Iptables?

Thanks in advance!

Rninja

smlogo.gif

 
It sound like you're trying to build a PPPoE Auth server?

You can route your firewall's external IP:ports to a specific IP:port interally. This is a function of "SNAT"/"DNAT", I forget what it's literally called.

The internal bit is a little sticky since you're probably going to have to force the internal hosts through a proxy.

In fact, commercial and open-source solutions for this sort of auth ("NoCat", and "Microtik") use an internal facing proxy to force the local hosts to login and be auth'd.

Good luck.

"Surfinbox Shares" - A fundraising program that builds revenue from dialup Internet users.
 
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1:65535 -j REDIRECT --to-port 80

You will also need to setup an input to chain to allow everything in from specific ip addresses, or all ip addresses with an (of course change these to meet your network needs):

iptables -A INPUT -i eth0 -p tcp -s 0/0 -j ACCEPT



John D. Saucier
jsauce@magicguild.com
Certified Technician
Network Administrator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top