Redirecting mail

Ilo Lorusso sneak at
Fri Apr 8 13:43:45 CEST 2005

this is strange...

Ive got another mailserver ..
now if I put that rule in

 iptables -t nat -A OUTPUT -p tcp -m multiport --dports smtp  -j 
DNAT --to-destination

and if I try telnet to any mail server on the internet , i connect to (Which should happen on

[root at poscpt0h01 root]# telnet 25
Connected to
Escape character is '^]'.
220 ESMTP Sendmail 8.12.8/8.12.8; Fri, 8 Apr 2005 
17:30:45 +0200

is there noway to make it connect directly to, but using as a gateway

----- Original Message ----- 
From: "Rob Sterenborg" <rob at>
To: <netfilter at>
Sent: Friday, April 08, 2005 12:58 PM
Subject: RE: Redirecting mail

>> Now what i would like to know is there a way I could route
>> all out going mail from to using
>> iptables DNAT.
>> First of all, is it possible to do what I want to do? and
> The networks seem to be connected, so can't you just configure a
> smtp-forwarder in your MTA configuration ? That would be easier I think.
>> would I use iptables or iptables with something else?
> No, just iptables would be enough.
>> This is what ive tried...
>> on (Red Hat Linux release 7.3)
>> i issue the command  :
>> iptables -t nat -A OUTPUT -p tcp -m multiport --dports smtp
>> -j DNAT --to-destination
> There is no need to use multiport because you only DNAT 1 port : smtp.
> But that should not be a problem.
> iptables -t nat -A OUTPUT -p tcp --dports smtp \
> -j DNAT --to-destination
>> now when im on (Red Hat Linux release 9 (Shrike) )
>> and do a tcpdump greping for smtp I see connections from
>> but not exactly sure what its doing.. but what i know, from
>> I cant make smtp connections out to the internet..
> A few obvious tests :
> Do you see mail coming in from into the queue of
> ?
> Is mail from "for the internet" being delivered ?
> If it's not working, do you have other iptables rules that prohibit this
> from working ?
> Gr,
> Rob
> ********* DISCLAIMER *********
> De informatie in dit E-mail bericht is uitsluitend bestemd voor de 
> geadresseerde. Verstrekking aan en gebruik door anderen is niet 
> toegestaan.
> Door de elektronische verzending van het bericht kunnen er geen rechten 
> worden ontleend aan de informatie. TTP staat niet in voor de juiste en 
> volledige overbrenging van de inhoud van een verzonden E-mail, noch voor 
> tijdige ontvangst daarvan.

More information about the netfilter mailing list