Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 01-13-2005, 03:13 PM   #1
LQ Newbie
Registered: Jan 2005
Posts: 2

Rep: Reputation: 0
IPtables Forward 1 Port to another on the same IP

I'm 95% sure this can be done with IP tables.

I'd like to forward all requests at port 80 to a server that's actually listening at port 5580. How could I do this?

Old 01-13-2005, 10:17 PM   #2
LQ Guru
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
If its on the same server:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 5580

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to <server>:5580

If there are http requests which come from the same LAN as the server than you need to do SNAT in addition to DNAT.
Old 01-13-2005, 10:56 PM   #3
LQ Newbie
Registered: Jan 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for your help. I should have clarified that it was on the same server.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 port Forward abhijeetudas Linux - Networking 1 12-02-2005 04:00 AM
iptables forward one port on same IP baetmaen Linux - Networking 2 01-27-2005 08:47 AM
How to port forward with IPTABLES... Scrag Linux - Security 6 12-13-2004 04:57 AM
IPTABLES port forward wanaka Linux - Security 3 09-28-2004 07:07 PM
Port Forward with iptables nymig94 Linux - Networking 5 12-02-2001 09:22 PM

All times are GMT -5. The time now is 09:20 AM.

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