Redirecting mail

Ilo Lorusso sneak at
Sat Apr 9 17:59:10 CEST 2005

I would just like to confirm with you, if machine is to on the 
same switch but 3 hops away will the method you describe still work?

----- Original Message ----- 
From: "Taylor, Grant" <gtaylor at>
To: "Ilo Lorusso" <sneak at>; <netfilter at>
Sent: Friday, April 08, 2005 9:29 PM
Subject: Re: Redirecting mail

> This mail server in question (, is it just used for sending
> email from your internal network out to the world or are you expecting 
> email
> from the world to come inbound to it too?  Are you wanting this mail 
> server
> to continue using the internet connection that it has for all traffic 
> except
> SMTP or are you wanting all outbound traffic to pass through 
> I would be tempted to use a combination of IPTables and IP routing rules.
> Namely I'd do something like the following on the mail server
> (
> iptables -t nat -A OUTPUT -p tcp --sport 25 -j MARK --set-mark $SMTP_Mark
> ip route add table $IPRoute2_SMTP_Table dev
> $DEV_of_internal_network src $IP_of_DEV_of_internal_network
> ip route add table $IPRoute2_SMTP_Table default via
> ip rule add fwmark $SMTP_Mark table $IPRoute2_SMTP_Table
> Where:
> $SMTP_Mark is the value you want to use to mark the packets that need to 
> use
> the alternant route.
> $IPRoute2_SMTP_Table is the name as it appears in /etc/iproute2/rt_tables 
> or
> the number of the table that you want to use.
> $DEV_of_internal_network is the device name of your internal network
> interface.
> $IP_of_DEV_of_internal_network is the IP address of the device name of 
> your
> internal network interface.
> This should cause any traffic that leaves the mail server in question to
> pass through the alternent route out to the internet.  If you have any
> questions or need more help let me know and I'll see what I can do.
> Grant. . . .

More information about the netfilter mailing list