LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-26-2003, 01:20 PM   #1
sdbaroni
LQ Newbie
 
Registered: Aug 2003
Location: San Diego, CA USA
Posts: 4

Rep: Reputation: 0
iptables & dnat how to pass original src ip/domain info


hello,

I have setup iptables to dnat smtp traffic to my local mail server, but I lose the original ip/domain info in the process. Since sendmail is setup to reject all other traffic except that that is trusted, the nat traffic appears to come from a trusted source and it seems I'm presently an open relay.

How can I nat the traffic w/o losing the orginal source info?

Here's my iptables rules for smtp

$IPTABLES -t nat -A OUTPUT --dst $INET_IP -p tcp --dport 25 -j DNAT \
--to-destination $MAIL_SERVER

$IPTABLES -A FORWARD -i $INET_IFACE -p tcp \
-d $MAIL_SERVER --dport 25 -m state --state NEW -j ACCEPT

thanks!
 
Old 08-26-2003, 03:22 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Do you really need to NAT? Is it possible to use only forwarding?
 
Old 08-26-2003, 04:31 PM   #3
sdbaroni
LQ Newbie
 
Registered: Aug 2003
Location: San Diego, CA USA
Posts: 4

Original Poster
Rep: Reputation: 0
I am still learning iptables after my 2 day crash study of iptables and I found an initial problem. I had an SNAT policy too that was unneeded. I deleted the below policy and my relay problem went away.

$IPTABLES -t nat -A POSTROUTING -p tcp --dst $MAIL_SERVER --dport 25 -j SNAT \
--to-source $LAN_IP

If I were to just forward any traffic coming into port 25 would my policy command change to look like this?

$IPTABLES -A FORWARD -i $INET_IFACE -p tcp --dport 25 \
-d $MAIL_SERVER --dport 25 -m state --state NEW -j ACCEPT
 
  


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
why does iptables DNAT fail? eantoranz Linux - Security 12 08-25-2006 01:11 PM
iptables DNAT pshepperd Linux - Security 1 05-22-2004 03:56 PM
problem about iptables DNAT. zufeng Linux - Security 3 06-19-2003 09:29 AM
DNAT question (Iptables) wilsonmau Linux - Networking 1 06-06-2003 06:50 AM
iptables DNAT bentz Linux - Networking 15 05-19-2003 01:17 PM

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

All times are GMT -5. The time now is 11:24 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