Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

smtproutes failover configuration

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


ylmzlist at gmail

Sep 3, 2009, 3:47 AM

Post #1 of 7 (1836 views)
Permalink
smtproutes failover configuration

Hi all, I have a problem regarding the failover of a domain name in
smtproutes file.
I have set up smtproutes file for a single domain name so that qmail will
ask DNS for MX records as I have read in qmail remote manual.
Here is the file smtproutes content

testdomain.com:
:192.168.1.1


DNS server for this domain tesdomain.com returns two MX records as such:

mx 10 smtp1.relayserver.com
mx 20 smtp2.relayserver.com

I have sent a test message from qmail to e.g sample [at] testdomain and the
message is delivered to smtp1.relayserver.com as expected.
I have shut down smtp1.relayserver.com and sent the same message again and
after that Qmail sent the message to smtp2.relayserver.com as I expected.
However, when I bring the first server up and shut down the second server,
presumably qmail should try smtp1.relayserver.com again but it isn't what
happens.
Qmail insists on sending the message to the unavailable server again and
again although the first server is back again. I don't know what I actually
miss on this
configuration or does it work like this?

thanks for your help in advance.


ar-djblists at acrconsulting

Sep 3, 2009, 4:36 AM

Post #2 of 7 (1747 views)
Permalink
Re: smtproutes failover configuration [In reply to]

On Thursday 03 September 2009, yilmaz wrote:
> Hi all, I have a problem regarding the failover of a domain name
> in smtproutes file.
> I have set up smtproutes file for a single domain name so that
> qmail will ask DNS for MX records as I have read in qmail remote
> manual. Here is the file smtproutes content
>
> testdomain.com:
> :192.168.1.1
>
> DNS server for this domain tesdomain.com returns two MX records as
> such:
>
> mx 10 smtp1.relayserver.com
> mx 20 smtp2.relayserver.com
>
> I have sent a test message from qmail to e.g sample [at] testdomain
> and the message is delivered to smtp1.relayserver.com as expected.
> I have shut down smtp1.relayserver.com and sent the same message
> again and after that Qmail sent the message to
> smtp2.relayserver.com as I expected. However, when I bring the
> first server up and shut down the second server, presumably qmail
> should try smtp1.relayserver.com again but it isn't what happens.
> Qmail insists on sending the message to the unavailable server
> again and again although the first server is back again. I don't
> know what I actually miss on this
> configuration or does it work like this?

Has qmail marked smtp1... as unreachable - try running qmail-tcpto to
see if it's listed there. If so you can reset this with qmail-tcpok
(see the man pages for both commands to see what's happening).

cheers,

Andrew.
--
====================================================================
* Custom email solutions * Systems Administration * Networking
http://www.acrconsulting.co.uk/email/qmail.html
====================================================================


ylmzlist at gmail

Sep 3, 2009, 5:37 AM

Post #3 of 7 (1719 views)
Permalink
Re: smtproutes failover configuration [In reply to]

On Thu, Sep 3, 2009 at 1:36 PM, Andrew Richards <
ar-djblists [at] acrconsulting> wrote:

> On Thursday 03 September 2009, yilmaz wrote:
> > Hi all, I have a problem regarding the failover of a domain name
> > in smtproutes file.
> > I have set up smtproutes file for a single domain name so that
> > qmail will ask DNS for MX records as I have read in qmail remote
> > manual. Here is the file smtproutes content
> >
> > testdomain.com:
> > :192.168.1.1
> >
> > DNS server for this domain tesdomain.com returns two MX records as
> > such:
> >
> > mx 10 smtp1.relayserver.com
> > mx 20 smtp2.relayserver.com
> >
> > I have sent a test message from qmail to e.g sample [at] testdomain
> > and the message is delivered to smtp1.relayserver.com as expected.
> > I have shut down smtp1.relayserver.com and sent the same message
> > again and after that Qmail sent the message to
> > smtp2.relayserver.com as I expected. However, when I bring the
> > first server up and shut down the second server, presumably qmail
> > should try smtp1.relayserver.com again but it isn't what happens.
> > Qmail insists on sending the message to the unavailable server
> > again and again although the first server is back again. I don't
> > know what I actually miss on this
> > configuration or does it work like this?
>
> Has qmail marked smtp1... as unreachable - try running qmail-tcpto to
> see if it's listed there. If so you can reset this with qmail-tcpok
> (see the man pages for both commands to see what's happening).
>
> cheers,
>
> Andrew.
> --
> ====================================================================
> * Custom email solutions * Systems Administration * Networking
> http://www.acrconsulting.co.uk/email/qmail.html
> ====================================================================
>

Thank you Andrew. I have repeated the test and I have seen that qmail marks
unreachable hosts
after 2 timeouts which takes around 2 mins for each host. Once I clear the
timeout table, qmail starts trying the host again.
but what I have realized is qmail marks the host unreachable only when there
is no network layer connectivity.
If the remote machine has still the IP but no smtp service is being
listened, qmail receives TCP reset packet sent from the remote host
and keeps trying without marking it unreachable.
This is what I have discovered if I am not mistaken.

thank you for your help, it has helped a lot.

Regards,


ar-djblists at acrconsulting

Sep 3, 2009, 8:26 AM

Post #4 of 7 (1715 views)
Permalink
Re: smtproutes failover configuration [In reply to]

On Thursday 03 September 2009, yilmaz wrote:
> On Thu, Sep 3, 2009 at 1:36 PM, Andrew Richards
> <ar-djblists [at] acrconsulting> wrote:
> > On Thursday 03 September 2009, yilmaz wrote:
> > > Hi all, I have a problem regarding the failover of a domain
> > > name in smtproutes file.
> > > I have set up smtproutes file for a single domain name so that
> > > qmail will ask DNS for MX records as I have read in qmail
> > > remote manual. Here is the file smtproutes content
> > >
> > > testdomain.com:
> > > :192.168.1.1
> > >
> > > DNS server for this domain tesdomain.com returns two MX records
> > > as such:
> > >
> > > mx 10 smtp1.relayserver.com
> > > mx 20 smtp2.relayserver.com
> > >
> > > I have sent a test message from qmail to e.g
> > > sample [at] testdomain and the message is delivered to
> > > smtp1.relayserver.com as expected. I have shut down
> > > smtp1.relayserver.com and sent the same message again and after
> > > that Qmail sent the message to
> > > smtp2.relayserver.com as I expected. However, when I bring the
> > > first server up and shut down the second server, presumably
> > > qmail should try smtp1.relayserver.com again but it isn't what
> > > happens. Qmail insists on sending the message to the
> > > unavailable server again and again although the first server is
> > > back again. I don't know what I actually miss on this
> > > configuration or does it work like this?
> >
> > Has qmail marked smtp1... as unreachable - try running
> > qmail-tcpto to see if it's listed there. If so you can reset this
> > with qmail-tcpok (see the man pages for both commands to see
> > what's happening).

> Thank you Andrew. I have repeated the test and I have seen that
> qmail marks unreachable hosts
> after 2 timeouts which takes around 2 mins for each host. Once I
> clear the timeout table, qmail starts trying the host again.
> but what I have realized is qmail marks the host unreachable only
> when there is no network layer connectivity.
> If the remote machine has still the IP but no smtp service is being
> listened, qmail receives TCP reset packet sent from the remote host
> and keeps trying without marking it unreachable.
> This is what I have discovered if I am not mistaken.

I like your stretching the use of smtproutes for failover/failback; as
you're finding the tcpto timeout is getting in the way, given its
design goal was to deal with something else - but you could adjust the
code to address your particular issue, it looks fairly
straightforward.

cheers,

Andrew.

--
====================================================================
* Custom email solutions * Systems Administration * Networking
http://www.acrconsulting.co.uk/email/qmail.html
====================================================================


mbhangui at gmail

Sep 3, 2009, 9:12 AM

Post #5 of 7 (1712 views)
Permalink
Re: smtproutes failover configuration [In reply to]

On Thu, 2009-09-03 at 14:37 +0200, yilmaz wrote:

>
> Thank you Andrew. I have repeated the test and I have seen that qmail
> marks unreachable hosts
> after 2 timeouts which takes around 2 mins for each host. Once I clear
> the timeout table, qmail starts trying the host again.
> but what I have realized is qmail marks the host unreachable only when
> there is no network layer connectivity.
> If the remote machine has still the IP but no smtp service is being
> listened, qmail receives TCP reset packet sent from the remote host
> and keeps trying without marking it unreachable.
> This is what I have discovered if I am not mistaken.

You are right about this.
on line 422 of qmail-remote.c one has
tcpto_err(&ip.ix[i].ip, errno == error_timeout);

which can be changed to
tcpto_err(&ip.ix[i].ip, errno == error_timeout || errno ==
error_connrefused || errno == error_hostdown || errno ==
error_netunreach || errno == error_hostunreach);

which is what I do :)


jvaldes at intercom

Sep 3, 2009, 10:13 AM

Post #6 of 7 (1728 views)
Permalink
Re: smtproutes failover configuration [In reply to]

Manvendra Bhangui wrote:
> On Thu, 2009-09-03 at 14:37 +0200, yilmaz wrote:
>
>> Thank you Andrew. I have repeated the test and I have seen that qmail
>> marks unreachable hosts
>> after 2 timeouts which takes around 2 mins for each host. Once I clear
>> the timeout table, qmail starts trying the host again.
>> but what I have realized is qmail marks the host unreachable only when
>> there is no network layer connectivity.
>> If the remote machine has still the IP but no smtp service is being
>> listened, qmail receives TCP reset packet sent from the remote host
>> and keeps trying without marking it unreachable.
>> This is what I have discovered if I am not mistaken.
>
> You are right about this.
> on line 422 of qmail-remote.c one has
> tcpto_err(&ip.ix[i].ip, errno == error_timeout);
>
> which can be changed to
> tcpto_err(&ip.ix[i].ip, errno == error_timeout || errno ==
> error_connrefused || errno == error_hostdown || errno ==
> error_netunreach || errno == error_hostunreach);
>
> which is what I do :)
>
>
>

Where are these error_connfrefused, error_hostdown, error_notunreach and
error_hostunreach defined?



--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Jorge Valdes - jvaldes [at] intercom
Intercom El Salvador
- Transformando sus telecomunicaciones
voz: ++(503) 2278-5068
fax: ++(503) 2265-7025


mbhangui at gmail

Sep 3, 2009, 7:41 PM

Post #7 of 7 (1700 views)
Permalink
Re: smtproutes failover configuration [In reply to]

On Thu, Sep 3, 2009 at 10:43 PM, Jorge Valdes<jvaldes [at] intercom> wrote:
> Where are these error_connfrefused, error_hostdown, error_notunreach and
> error_hostunreach defined?
>

Some of those have to be added to error.c. Attaching error.c which I use.

--
Regards Manvendra - http://www.indimail.org
Sent from Chennai, TN, India
Attachments: error.c.gz (0.72 KB)

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.