LinuxQuestions.org
Visit Jeremy's Blog.
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
 
LinkBack Search this Thread
Old 01-27-2005, 06:01 AM   #1
baetmaen
LQ Newbie
 
Registered: Aug 2004
Location: Germany, HE
Posts: 12

Rep: Reputation: 0
iptables forward one port on same IP


Hi,

I have a root server with one interface and one static IP.

How would the command (iptables) look to forward one port from the extranl interface (eth0) to another port on localhost:

xxx.xxx.xxx.xxx:25 ---> 127.0.0.1:26

I thought this would work:
Code:
$IPT -A tcp_inbound -p TCP -i eth0  --dport 25 -j FORWARD -d 127.0.0.1 --to-ports 26
but it isn't (where $IPT contains the full path to iptables).

My main problem is: I run a Domino Server on this box and I don'T want him to use 25 since postfix is running there to send me notifications from my cron scripts and so on. So I switched domino's port to 26 and now I want to forward incoming connections on port 25 to localhost port 26 ;(

How should the line look like ? To be honest, I created that script with an iptables script generator and added this line on my own. But I canÄt find the error here (The parameters like --dport --to-port and -d are from the man page)

Joerg
 
Old 01-27-2005, 06:56 AM   #2
zsoltrenyi
Member
 
Registered: May 2004
Distribution: redhat, trustix, debian
Posts: 103

Rep: Reputation: 15
the port forwarding is made with -j DNAT in the prerouting chain
so the rule should look like this:
iptables -A PREROUTING -p tcp -i eth0 --dport 25 -j DNAT --to-destination 127.0.0.1:26
 
Old 01-27-2005, 08:47 AM   #3
baetmaen
LQ Newbie
 
Registered: Aug 2004
Location: Germany, HE
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by zsoltrenyi
the port forwarding is made with -j DNAT in the prerouting chain
so the rule should look like this:
iptables -A PREROUTING -p tcp -i eth0 --dport 25 -j DNAT --to-destination 127.0.0.1:26
For some reason this is not helping ;(

I can still see a dropped message in the syslog. But for further help you might also need more information, right ?

joerg
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 1 Port to another on the same IP KevinB Linux - Networking 2 01-13-2005 10:56 PM
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 04:34 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration