Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Feb 2007 14:26:30 +0100
From:      "Daan Vreeken [PA4DAN]" <Danovitsch@vitsch.net>
To:        Frank Bonnet <f.bonnet@esiee.fr>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Transparent redirect to another interface ?
Message-ID:  <200702221426.30370.Danovitsch@vitsch.net>
In-Reply-To: <45DD84C1.70308@esiee.fr>
References:  <45DD84C1.70308@esiee.fr>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Hi Frank,

On Thursday 22 February 2007 12:55, Frank Bonnet wrote:
> Hello
>
> I have a new mailhub with two ethernet gigabit interfaces, and I would like
> to transparently redirect IMAP or POP3 requests to the second interface
> which have a different IP address, to let the first interface drive the
> SMTP traffic only.
>
> Is it possible ? This will avoid thousands of email clients
> re-configuration to let users grab their incomming emails.

"natd" can be used to do this.

The following example assumes your external interface is called "sk0" and the 
seconde interface, connecting to the second server, is called "sk1" :

# Start natd and tell it to forward pop3 traffic to the second server
natd -n sk0 -redirect_port tcp ip_of_second_server_here:110 110

# Add ipfw rule to send incoming pop3 traffic through natd
ipfw add 1000 divert natd tcp from any to me 110 via sk0
# Add ipfw rule to send responses from second server through natd
ipfw add 1010 divert natd tcp from ip_of_second_server_here 110 to any via
   sk0

# or just use one ipfw rule :
ipfw add 1000 divert natd all from any to any via sk0

But this will send ALL traffic through natd, only sending traffic that needs 
to be redirect through it is far more efficient.

Hope this helps,
-- 
Daan



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?200702221426.30370.Danovitsch>