OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Domain forwarding

From: Noel Jones (njonesmegan.vbhcs.org)
Date: Thu Aug 19 2010 - 15:21:03 CDT


On 8/19/2010 2:58 PM, Ronan Lucio wrote:
> Hi All,
>
> I need to re-install a new mail server.
> So I have the actual server running on and ordered a new one
> where I'm installing and configuring newer softwares.
>
> It's done and I need to move all domains and it's accounts to
> the newer server.
> Once there are so many gigabytes to move, I'll need to move
> domain-by-domain, the will take weeks to move it all.
>
> My problem is the DNS propagation.
> Our server are configure with a 2 hours TTL
>
> So after I move a domain and it's accounts, the next 2 hours
> both servers (old one and new one) will receive messages (due
> to DNS time propagation).
>
> What I want to is configure the old server to relay mails sent
> to that moved domain, to the new server.
> How can I do that?

Easy way:
Rather than forwarding mail, defer all mail for the moved
domain. When the sender retries, they will eventually get the
new server. This may delay some deliveries during the
migration, but few people will notice. You can minimize the
delays by changing your DNS TTL to a shorter value; 10~30
minutes is probably a good compromise.

This example config assumes the default
smtpd_delay_reject=yes. We do this in
smtpd_sender_restrictions so that a mistake doesn't make you
an open relay.
# main.cf
smtpd_sender_restrictions =
   check_recipient_access hash:/etc/postfix/moved_domains
   ... any exiting checks go below here ...

# moved domains
example.com DEFER server maintenance
example.org DEFER server maintenance

Hard way:
When postfix accepts mail for a domain but final delivery is
on a different server, it's called a relay domain.
The domain name must be added to the relay_domains parameter,
and valid recipients must be listed in relay_recipient_maps.
It's important that the domain name is removed from all other
*_domains parameters so the domain doesn't belong to multiple
address classes.
http://www.postfix.org/ADDRESS_CLASS_README.html

If postfix can't find the new MX for the domain using a normal
DNS lookup, add a transport_maps entry pointing to the correct
server.
# main.cf
transport_maps = hash:/etc/postfix/transport

# transport
example.com relay:[10.1.10.100]

http://www.postfix.org/postconf.5.html#transport_maps
http://www.postfix.org/transport.5.html

   -- Noel Jones