Re: Transport: Multiple routes to internal domain

2012-02-07 Thread Andreas Berton



On Tue, 7 Feb 2012, Lorens Kockum wrote:


On Tue, Feb 07, 2012 at 11:42:37AM +1100, Greg Wilson wrote:

I use this
technique, DNS round robin to evenly spread rdp connections to our
terminal servers. My understanding is that a device does a DNS lookup and
the server hands out each different IP address sequentially. Each device
uses (caches) the first IP address it recieves until it's rebooted.


That might be true for rdp connections to your terminal servers,
but (luckily!) it's a bit more complicated.

The DNS server sends a reply containing all the IP
addresses. The order varies. If the code asking the question
only wants one address, then it takes only one, and the next
time it asks the question it might get another answer.  Postfix,
however, understands that there are multiple addresses and
tries them all, one after the other in a random order until
one replies or until it has tried them all and decides to wait
before trying again. After waiting Postfix will make another DNS
lookup.

The response to that lookup may be cached since the previous
lookup, but the cache is valid only until the record's time to
live (TTL) expires. The TTL is set in the DNS server. It can
be anything from zero (do not cache) to a week or more. A
common default value is 24 hours. Of course, in the case of
a long-lived TCP connection you may have the impression that
the IP address is used until the device is restarted, and you
might even be correct (for an RDP client running on Windows, for
example), but that is not the case when sending mails.


Is it possible to setup multiple transport records wth different
costs to a domain? This may be a solution.


You can do unequal load balancing by creating multiple records
with the same IP.  That could work using /etc/hosts, you'd have
to test.

You can do priorities (first try X and if it doesn't work try
Y then Z) by using different-priority MX records. This needs
access to your DNS server, and cannot be done with /etc/hosts.

Hope this helps.




As an alternative, it guess it would suffice to put an MX with lower 
priority in your dns to the backup server, so if mastern in your cluster 
is down postfix would then try next one. But what Loren wrote before 
creating loadbalancing with round-robin is probably what you want.




Re: Transport: Multiple routes to internal domain

2012-02-07 Thread /dev/rob0
On Tue, Feb 07, 2012 at 04:32:14PM +1100, Greg Wilson wrote:
 I've been testing Postifx for some solutions...
 
 One attempt was to make 2 entries with the same host name
 in /etc/hosts
 
 e.g
 10.222.100.1 exchange.mydomain.local exchange
 10.333.200.2 exchange.mydomain.local exchange

IPv5? I haven't seen many of those quads255. :)

 Then changed the transport map to
 
 mydomain.local smtp:[exchange.mydomain.local]
 
 My info is that the square brackets stop Postifix doing mx
 record lookups.

And instead, do a DNS A lookup. To use hosts(5) resolution
specify smtp_host_lookup to include native:
http://www.postfix.org/postconf.5.html#smtp_host_lookup

 This didn't work and I don't know why. It works fine with
 an IP address in the square brackets and the Linux box can
 resolve exchange.mydoamin.local to an IP.

By default smtp_host_lookup is dns only.

 Any suggestions?

Also, please don't top-post your replies. Your MUA badly mangled
quoting in the rest of the thread so I didn't bother to try to fix 
that. Thanks.
-- 
  http://rob0.nodns4.us/ -- system administration and consulting
  Offlist GMX mail is seen only if /dev/rob0 is in the Subject:


Re: Transport: Multiple routes to internal domain

2012-02-07 Thread Wietse Venema
Greg Wilson:
 One attempt
 was to make 2 entries with the same host name in /etc/hosts
 
 e.g
 10.222.100.1 exchange.mydomain.local exchange
 10.333.200.2
 exchange.mydomain.local exchange
 
 Then changed the transport map
 to
 
 mydomain.local smtp:[exchange.mydomain.local]
 
 My
 info is that the square brackets stop Postifix doing mx record lookups.
 
 
 This didn't work and I don't know why. It works fine with an

That 's because LINUX does not support multiple /etc/hosts records
per name.

Use a better OS, use DNS, or use my smtp_fallback_relay solution.

Wietse


RE: Transport: Multiple routes to internal domain

2012-02-07 Thread James Day
-Original Message-
From: owner-postfix-us...@postfix.org [mailto:owner-postfix-us...@postfix.org] 
On Behalf Of Wietse Venema
Sent: 07 February 2012 13:33
To: Greg Wilson
Cc: Postfix users
Subject: Re: Transport: Multiple routes to internal domain

Greg Wilson:
 One attempt
 was to make 2 entries with the same host name in /etc/hosts
 
 e.g
 10.222.100.1 exchange.mydomain.local exchange
 10.333.200.2
 exchange.mydomain.local exchange
 
 Then changed the transport map
 to
 
 mydomain.local smtp:[exchange.mydomain.local]
 
 My
 info is that the square brackets stop Postifix doing mx record lookups.
 
 
 This didn't work and I don't know why. It works fine with an

That 's because LINUX does not support multiple /etc/hosts records per name.

Use a better OS, use DNS, or use my smtp_fallback_relay solution.

Wietse

Hi Wietse,

When you say a better OS, I'd be interested to know what your preference is.

Kind regards,

James Day
(IT Engineer)


Re: Transport: Multiple routes to internal domain

2012-02-07 Thread Jose Ildefonso Camargo Tolosa
On Tue, Feb 7, 2012 at 9:03 AM, Wietse Venema wie...@porcupine.org wrote:
 Greg Wilson:
 One attempt
 was to make 2 entries with the same host name in /etc/hosts

 e.g
 10.222.100.1 exchange.mydomain.local exchange
 10.333.200.2
 exchange.mydomain.local exchange

 Then changed the transport map
 to

 mydomain.local smtp:[exchange.mydomain.local]

 My
 info is that the square brackets stop Postifix doing mx record lookups.


 This didn't work and I don't know why. It works fine with an

 That 's because LINUX does not support multiple /etc/hosts records
 per name.

 Use a better OS, use DNS, or use my smtp_fallback_relay solution.

        Wietse

Eh, Linux *does* support that, from man host.conf  (/etc/host.conf):

   multi  Valid values are on and off.  If set to on, the resolv+
library will return all valid addresses for a host that  appears  in
the  /etc/hosts  file, instead of only the first.  This is off by
default, as it may cause a substantial performance loss at sites with
large hosts files.


Re: Transport: Multiple routes to internal domain

2012-02-07 Thread Greg Wilson


Lorens,

Thank you for the detailed reply. I'm interested to
hear that some of the DNS smarts reside in postfix itself.

As I
had no luck with multiple records in the /etc/hosts file, I've gone to the
DNS option and setup multiple A records for exchange.xxx.local, using that
name in the Postfix's transport file. I can now see that mail is coming in
via our backup MS Exchange server, which is fine.

As long as
Postfix is smart enough to send email to the other IP address for this
record if one of the Exchange servers is down, all is well.

Thanks again,

Greg.

 On Tue, Feb 07, 2012 at
11:42:37AM +1100, Greg Wilson wrote:
 I use this
 technique, DNS round robin to evenly spread rdp connections to
our
 terminal servers. My understanding is that a device does
a DNS lookup
 and
 the server hands out each
different IP address sequentially. Each device
 uses (caches)
the first IP address it recieves until it's rebooted.
 

That might be true for rdp connections to your terminal servers,

but (luckily!) it's a bit more complicated.
 
 The DNS
server sends a reply containing all the IP
 addresses. The order
varies. If the code asking the question
 only wants one address,
then it takes only one, and the next
 time it asks the question
it might get another answer.  Postfix,
 however, understands that
there are multiple addresses and
 tries them all, one after the
other in a random order until
 one replies or until it has tried
them all and decides to wait
 before trying again. After waiting
Postfix will make another DNS
 lookup.
 
 The
response to that lookup may be cached since the previous
 lookup,
but the cache is valid only until the record's time to
 live
(TTL) expires. The TTL is set in the DNS server. It can
 be
anything from zero (do not cache) to a week or more. A
 common default value is 24 hours. Of course, in the case of
 a long-lived TCP connection you may have the impression that
 the IP address is used until the device is restarted, and you
 might even be correct (for an RDP client running on Windows, for
 example), but that is not the case when sending mails.


 Is it possible to setup multiple transport records wth
different
 costs to a domain? This may be a solution.
 
 You can do unequal load balancing by creating multiple
records
 with the same IP.  That could work using /etc/hosts,
you'd have
 to test.
 
 You can do priorities
(first try X and if it doesn't work try
 Y then Z) by using
different-priority MX records. This needs
 access to your DNS
server, and cannot be done with /etc/hosts.
 
 Hope this
helps.



Transport: Multiple routes to internal domain

2012-02-06 Thread Greg Wilson


I'm using Postfix\Amavis\Spamassassin\Clamav to scan incoming emails
for
virus and spam and forward to our internal MS Exchange email
system.
Postifx shares the Internet domain with MS Exchange, 
each
forwarding messages to unknown  accounts to the other
system.

MS Exchange uses clustering to duplicate it's mailbox
databases to
2 different servers. How do I setup Postfix to
automatically forward
messages to one of the MS Exchange servers if
the other one  goes
offline?

I currently use an IP
number in square brackets in
Postfix's transport map to route to one
of the MS exchange servers.

Thanks,

Greg.
I'm using Postfix\Amavis\Spamassassin\Clamav to scan incoming emails for
virus and spam and forward to our internal MS Exchange email system.Postifx shares the Internet domain with MS Exchange, each
forwarding messages to unknown accounts to the other system.MS Exchange uses clustering to duplicate it's mailbox databases to
2 different servers. How do I setup Postfix to automatically forward
messages to one of the MS Exchange servers if the other one goes
offline?I currently use an IP number in square brackets in
Postfix's transport map to route to one of the MS exchange servers.Thanks,Greg.

Re: Transport: Multiple routes to internal domain

2012-02-06 Thread Jose Ildefonso Camargo Tolosa
Hi!

I would answer you with another question:

In the event of a server failure, how are users directed to the other server?

I mean, there are several ways of doing that, and knowing your current
one would be helpful.

Sincerely,

Ildefonso Camargo.

On Mon, Feb 6, 2012 at 6:57 PM, Greg Wilson gr...@actionforms.com.au wrote:
 I'm using Postfix\Amavis\Spamassassin\Clamav to scan incoming emails for
 virus and spam and forward to our internal MS Exchange email system.
 Postifx shares the Internet domain with MS Exchange,  each
 forwarding messages to unknown  accounts to the other system.

 MS Exchange uses clustering to duplicate it's mailbox databases to
 2 different servers. How do I setup Postfix to automatically forward
 messages to one of the MS Exchange servers if the other one  goes
 offline?

 I currently use an IP number in square brackets in
 Postfix's transport map to route to one of the MS exchange servers.

 Thanks,

 Greg.


Re: Transport: Multiple routes to internal domain

2012-02-06 Thread Wietse Venema
Greg Wilson:
 2 different servers. How do I setup Postfix to
 automatically forward
 messages to one of the MS Exchange servers if
 the other one? goes
 offline?

Two options:

A) Assuming that you use the relay transport in master.cf
(which you should if relaying mail from outside):

/etc/postfix/master.cf:
relay unix  -   -   n   -   -   smtp
-o smtp_fallback_relay=[1.2.3.4]

B) In the transport map, specify a hostname that resolves to TWO
IP addresses. Make up your own DNS or /etc/hosts entry if you
need to.

Wietse


Re: Transport: Multiple routes to internal domain

2012-02-06 Thread Greg Wilson


Thanks for the advice.

I don't use relay maps for the domain as
the Internet doamin is shared betweent he MS Exchange server and the
Postfix server. i.e I use MySql address lookups onthe Postfix server so
it's easy to create addresses to forward email to different or multiple
accounts. e.g sa...@xxx.com

I don't think that multiple DNS
records will work. (Although I may be wrong.)

I use this
technique, DNS round robin to evenly spread rdp connections to our
terminal servers. My understanding is that a device does a DNS lookup and
the server hands out each different IP address sequentially. Each device
uses (caches) the first IP address it recieves until it's rebooted. 

i.e When the primary MS Exchange server went offline, Postifx
wouldn't necessarally do another DNS looup and find the second record.

Is it possible to setup multiple transport records wth different
costs to a domain? This may be a solution.

Cheers,

Greg.



 Greg Wilson:
 2 different
servers. How do I setup Postfix to
 automatically forward
 messages to one of the MS Exchange servers if
 the
other one  goes
 offline?
 
 Two
options:
 
 A) Assuming that you use the
relay transport in master.cf
 (which you should if
relaying mail from outside):
 

/etc/postfix/master.cf:
 relay unix  -   -   n   
   -   -   smtp
   -o smtp_fallback_relay=[1.2.3.4]
 
 B) In the transport map, specify a hostname that
resolves to TWO
 IP addresses. Make up your own DNS or /etc/hosts
entry if you
 need to.
 
   Wietse



Re: Transport: Multiple routes to internal domain

2012-02-06 Thread Greg Wilson


I've been testing Postifx for some solutions...

One attempt
was to make 2 entries with the same host name in /etc/hosts

e.g
10.222.100.1 exchange.mydomain.local exchange
10.333.200.2
exchange.mydomain.local exchange

Then changed the transport map
to

mydomain.local smtp:[exchange.mydomain.local]

My
info is that the square brackets stop Postifix doing mx record lookups.


This didn't work and I don't know why. It works fine with an
IP address inthe square brackets and the Linux box can resolve
exchange.mydoamin.local to an IP.

Any suggestions?




 
 
 Thanks for the advice.
 
 I don't use relay maps for the domain as
 the
Internet doamin is shared betweent he MS Exchange server and the

Postfix server. i.e I use MySql address lookups onthe Postfix server so
 it's easy to create addresses to forward email to different or
multiple
 accounts. e.g sa...@xxx.com
 
 I
don't think that multiple DNS
 records will work. (Although I may
be wrong.)
 
 I use this
 technique, DNS round
robin to evenly spread rdp connections to our
 terminal servers.
My understanding is that a device does a DNS lookup and
 the
server hands out each different IP address sequentially. Each device
 uses (caches) the first IP address it recieves until it's
rebooted.
 
 i.e When the primary MS Exchange server
went offline, Postifx
 wouldn't necessarally do another DNS looup
and find the second record.
 
 Is it possible to setup
multiple transport records wth different
 costs to a domain? This
may be a solution.
 
 Cheers,
 

Greg.
 
 
 
 Greg Wilson:
 2 different
 servers. How do I setup Postfix to
 automatically forward
 messages to one of
the MS Exchange servers if
 the
 other one 
goes
 offline?

 Two

options:

 A) Assuming that you use the
 relay transport in master.cf
 (which you
should if
 relaying mail from outside):


 /etc/postfix/master.cf:
 relay
unix  -   -   n
-   -   smtp

-o smtp_fallback_relay=[1.2.3.4]

 B) In the
transport map, specify a hostname that
 resolves to TWO
 IP addresses. Make up your own DNS or /etc/hosts

entry if you
 need to.

  Wietse




Re: Transport: Multiple routes to internal domain

2012-02-06 Thread Lorens Kockum
On Tue, Feb 07, 2012 at 11:42:37AM +1100, Greg Wilson wrote:
 I use this
 technique, DNS round robin to evenly spread rdp connections to our
 terminal servers. My understanding is that a device does a DNS lookup and
 the server hands out each different IP address sequentially. Each device
 uses (caches) the first IP address it recieves until it's rebooted. 

That might be true for rdp connections to your terminal servers,
but (luckily!) it's a bit more complicated.

The DNS server sends a reply containing all the IP
addresses. The order varies. If the code asking the question
only wants one address, then it takes only one, and the next
time it asks the question it might get another answer.  Postfix,
however, understands that there are multiple addresses and
tries them all, one after the other in a random order until
one replies or until it has tried them all and decides to wait
before trying again. After waiting Postfix will make another DNS
lookup.

The response to that lookup may be cached since the previous
lookup, but the cache is valid only until the record's time to
live (TTL) expires. The TTL is set in the DNS server. It can
be anything from zero (do not cache) to a week or more. A
common default value is 24 hours. Of course, in the case of
a long-lived TCP connection you may have the impression that
the IP address is used until the device is restarted, and you
might even be correct (for an RDP client running on Windows, for
example), but that is not the case when sending mails.

 Is it possible to setup multiple transport records wth different
 costs to a domain? This may be a solution.

You can do unequal load balancing by creating multiple records
with the same IP.  That could work using /etc/hosts, you'd have
to test.

You can do priorities (first try X and if it doesn't work try
Y then Z) by using different-priority MX records. This needs
access to your DNS server, and cannot be done with /etc/hosts.

Hope this helps.