Link to home
Start Free TrialLog in
Avatar of JesNoFear
JesNoFearFlag for United States of America

asked on

Sendmail and Qpopper help - backup server config

I have sendmail and qpopper setup on my main box primary.mydomain.com and would like to setup secondary.mydomain.com to relay mail when primary is down, so I am guessing what needs to be done is to setup e-mail fwding on the second server to the first server. So in the end I want my mail to be sent to the main server, if main server down send to second server. Second server relays mail to main server once back up.
Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Nick Accad
Nick Accad
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JesNoFear

ASKER

I am having some issues with testing this out.
Once i disable the internet interface (ifconfig eth0 down) the e-mails are not going through the second server. One problem i am getting is that the e-mails are being put on hold till the server is back up, another issue i don't understand that only happned once was it went to my third servers ip, which is not in the list of NS's in the domain list. i have ns1 that goes to my primary server and ns2 that goes to my second server. i have configured mail.mydomain.com going to primary server and mail2.mydomain.com going to my secondary server.
In the MX Record it is listed as
A IN 10 mail.mydomain.com
A IN 11 mail2.mydomain.com

now i am not 100% sure the dns is configured on the second server correctly, i was up till 3 am this morning trying alot of diffrent things. so right now i have secondary setup to be the slave, and primary setup as master.

here is my /etc/named.conf on primary
acl ns { 127.0.0.1 ; xxx.xxx.xxx.xx4 ; xxx.xxx.xxx.xx5 ; } ;
options {
         directory "/var/named";
         query-source address * port 53;
         transfer-source * port 53;
         allow-transfer { ns ; } ;
};

### normal addin's for localhost
zone "mydomain.com" {
type master;
file "mydomain.com.zone" l
allow-update { none; }l
};

here is my /var/named/mydomain.com.zone
$TTL 86400
$ORIGIN mydomain.com.
1D IN SOA @ root (
42
3H
15M
3H
3H )
IN NS ns1.mydomain.com.
IN NS ns2.mydomain.com.
IN MX 10 mail.mydomain.com.
IN MX 11 mail2.mydomain.com.
IN A xxx.xxx.xxx.xx4
ns1 IN A xxx.xxx.xxx.xx4
ns2 IN A xxx.xxx.xxx.xx5
primary IN A xxx.xxx.xxx.xx4
secondary IN A xxx.xxx.xxx.xx5
mail IN A xxx.xxx.xxx.xx4
mail2 IN A xxx.xxx.xxx.xx5
www IN CNAME primary
pop3 IN CNAME primary
smtp IN CNAME primary

The /etc/named.conf on secondary is as fallows
acl ns { 127.0.0.1 ; xxx.xxx.xxx.xx4 ; xxx.xxx.xxx.xx5 ; } ;
options {
         directory "/var/named";
         query-source address * port 53;
         transfer-source * port 53;
         allow-transfer { ns ; } ;
};

### normal addin's for localhost
zone "secondary.mydomain.com" {
type slave;
file "shstars.com.zone" ;
masters {
xxx.xxx.xxx.xx4
};
};

And /var/named/shstars.com.zone is non-existant. It was there when I started and was removed when added slave.

Could you help me please. :o)
- JES
YES IT WORKS!
Some minor adjustments and TIME, and talking to a few people. i got it to work!
thanks!
- JES
Now I have an error. Server 2 (Secondary) is denying e-mails. why is this?
here is the error message i get.
Mar 12 22:40:48 primary sendmail[12252]: h2D3emQ12252: from=<email@workdomain.com>, size=1118, class=0, nrcpts=1, msgid=<004601c2e912$2ece4b70$0602a8c0@mycomputername>, proto=ESMTP, daemon=MTA, mech=LOGIN, relay=h-xxx-xxx-xxx-242.XXXXXXXX.isp.net [xxx.xxx.xxx.242]
Mar 12 22:40:48 primary sendmail[12254]: h2D3emQ12252: to=<email@mydomain.com>, ctladdr=<email@workdomain.com> (503/504), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=31118, relay=mail2.domainname.com. [xxx.xxx.xxx.245], dsn=4.0.0, stat=Deferred: Connection refused by mail2.domainname.com.
hmmm

server2 is not denying emails, the connection is refused
meaning that there is nothing listening on port 25 on the
external interface of that box.

either sendmail is not running or it is not bound to the
right interface.

in your sendmail.cf look for a line that looks like this

O DaemonPortOptions=Port=smtp, Name=MTA, Address=127.0.0.1

that line should either NOT have the Address=127.0.0.1
or you should have multiple lines easch with Address=
every ip address you want to recive emails.

tc
-nick
ok, sendmail problem fix, now error with usernames,
----- The following addresses had permanent fatal errors -----
<jesnofeaer@mydomain.com>
    (reason: 550 5.1.1 <jesnofear@mydomain.com>... User unknown)
do the user account halfto exits on each server?

- JES
NO
a backup mailserver should only RELAY emails to the primary.

hmmm
on the backup server do this:

sendmail -bt
> 3,0 jesnofear@mydomain.com


it SHOULD give you an output saying that it will send it
via smtp to the primany server

give it a try and tell me what goes

tc
-nick
> 3,0 jesnofear@mydomain.com
canonify           input: jesnofear @ mydomain . com
Canonify2          input: jesnofear < @ mydomain . com >
Canonify2        returns: jesnofear < @ mydomain . com . >
canonify         returns: jesnofear < @  mydomain . com . >
parse              input: jesnofear < @ mydomain . com . >
Parse0             input: jesnofear < @ mydomain . com . >
Parse0           returns: jesnofear < @ mydomain . com . >
ParseLocal         input: jesnofear < @ mydomain . com . >
ParseLocal       returns: jesnofear < @ mydomain . com . >
Parse1             input: jesnofear < @ mydomain . com . >
Parse1           returns: $# local $: jesnofear
parse            returns: $# local $: jesnofear

This all ment nouthing to me. and E-mails are still being denyed.
that means that sendmail is not reading the mailertable
or that you put "mydomain.com" in the local-host-names
files.

can you check those files?

your domain name should not be in local-host-names because
this is not the last hop for that domain, i.e. it is not
"local" to this machine

make sure there is that line in mailertable

mydomain.com    smtp:[primary.mydomain.com]

and the recreate the mailertable db as i mentioned in my
very 1st post.

another test to see if the mailertable is working:

sendmail -bt
> /map mailertable mydomain.com

it should return

map_lookup: mailertable (mydomain.com) returns smtp:[primary.domain.com] (0)

tc
-nick


> /map mailertable mydomain.com
map_lookup: mailertable (mydomain.com) returns smtp:primary.mydomain.com (0)

That returned as you sayed.
I removed mydomain.com from local-host-names and rebuilt the mailertable db as instructed from your first post.
E-mails are still bouncing back saying user unknown.
here is the e-mail i get back.
The original message was received at Thu, 13 Mar 2003 10:22:36 -0500
from xx.xxxxxx.client.atlantech.net [xxx.xxx.xxx.xxx]

   ----- The following addresses had permanent fatal errors -----
<jesnofear@mydomain.com>
    (reason: 550 5.1.1 <jesnofear@mydomain.com>... User unknown)

   ----- Transcript of session follows -----
... while talking to mail2.mydomain.com.:
>>> RCPT To:<jesnofear@mydomain.com>
<<< 550 5.1.1 <jesnofear@mydomain.com>... User unknown
550 5.1.1 <jesnofear@mydomain.com>... User unknown
ok, just to clear this off my chest

the brackets in the mailertable "[" are important, if you
just didnt type them in the post its ok. if they are not in
mailertable put them there.

im really at loss as what to say, i have this exact setup
working on 3 diff ISPs (i set them up personally, so I know
it works)

email me off EE to discuss this further.

tc
-nick