LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-21-2004, 05:50 PM   #1
gstarrett
LQ Newbie
 
Registered: Mar 2003
Distribution: RedHat 9
Posts: 11

Rep: Reputation: 0
Question Simple iptables forwarding 8080 -> 80


I am running RH9 on an internal network with the "no firewall" setting (iptables is running but all set to ACCEPT). I want to run an app (DVArchive) as a non-root user that needs to be served as a web server on port 80 (so that my ReplayTV will see it). I need to configure my system to redirect any incoming traffic on port 80 to the internal port 8080.

[DVArchive, listening on 8080] <-- [iptables?] <-- [outside world talking to port 80]

I've been reading the man pages and some web sources but am getting confused.

1) How would I configure iptables to allow this port redirection?

2) Do I need to do anything special to get it to maintain this configuration on a full restart? I see iptables-save will output a script for me, but do I need to arrainge for that script to be run on startup?

Here's my current config:
Code:
# Generated by iptables-save v1.2.8 on Sat Feb 21 16:48:21 2004
*nat
:PREROUTING ACCEPT [69:13797]
:POSTROUTING ACCEPT [126:11110]
:OUTPUT ACCEPT [126:11110]
COMMIT
# Completed on Sat Feb 21 16:48:21 2004
# Generated by iptables-save v1.2.8 on Sat Feb 21 16:48:21 2004
*filter
:INPUT ACCEPT [27746319:27592651327]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [24155831:26802970577]
COMMIT
# Completed on Sat Feb 21 16:48:21 2004
Thanks in advance!
 
Old 02-25-2004, 04:22 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080

To store it for rebooting,
service iptables save
 
Old 02-25-2004, 09:14 PM   #3
gstarrett
LQ Newbie
 
Registered: Mar 2003
Distribution: RedHat 9
Posts: 11

Original Poster
Rep: Reputation: 0
Talking Thanks!

Thanks--I'll try that when I get back (I'm out of town ATM). I assume from the answer that there's nothing special I need to do for the default "accept" level, correct? (I wasn't sure if I needed to change default to "deny" then apply my rule then accept whatever is left).

Thanks again,
 
Old 03-17-2004, 12:52 PM   #4
gstarrett
LQ Newbie
 
Registered: Mar 2003
Distribution: RedHat 9
Posts: 11

Original Poster
Rep: Reputation: 0
Talking Thanks again

That worked exactly as I had hoped it would. Thanks again!

...iptables are sweet...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables on router: simple port forwarding not working hamish Linux - Networking 1 10-27-2005 06:06 AM
How can I forward all traffic to 10.10.0.10:80 to 10.10.0.20:8080 using IPtables? abefroman Linux - Networking 1 10-06-2005 03:19 PM
port forwarding apache from 80 to 8080 chess Linux - General 11 09-27-2005 02:21 PM
Allowing connections to port 8080 in iptables apache363 Linux - Software 1 10-12-2004 02:14 PM
Simple enough...iptables..port forwarding pembo13 Linux - Networking 4 07-19-2003 02:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration