Operating System - Linux
1827842 Members
1277 Online
109969 Solutions
New Discussion

Re: Two sendmail servers, same domain trouble

 
Norman Schmidt Jr
New Member

Two sendmail servers, same domain trouble

I have a separate server for some hosted domains. Im trying to set up a second sendmail server on this machine, to serve SMTP and POP3 only to that hosted domains. This machine is on the same domain as my main mail server (which serves my main domain only). The problem: All people using the second SMTP server can send emails to anywhere (outside world or to any locally hosted domain) BUT NOT to accounts which are on the main server, under the main domain. This second server tries to deliver the messages directed to the main domain locally, at itself (since it is using the same domain as the main server).
The MX record of the main domain is pointing at the FQDN of the main server, the MX records of the hosted domains points to the FQDN of the second server.
But the second server still gives a "User unknown" when trying to deliver emails for the main domain (which by the MX record must be delivered to the main server, but sendmail tries to deliver locally on the second server, and the account really doesnt exists there)
How can I solve this?
3 REPLIES 3
Tom Maloy
Respected Contributor

Re: Two sendmail servers, same domain trouble

First, check the alias resolution:

/usr/lib/sendmail ???bv yourUserName # to check alias resolution

And then check the mail log file for details.

HTH

Tom
Carpe diem!
Norman Schmidt Jr
New Member

Re: Two sendmail servers, same domain trouble

sendmail -bv returns "user unknown" on the second server and "deliverable" on the main server. The point is that Im trying to use the second server to send emails to accounts on the main server.

I will try to clarify my setup:
Two servers running sendmail:

smtp1.mydomain.com
smtp2.mydomain.com

The DNS setup of machine smtp1 points ONLY to smtp1.mydomain.com as the MX for the domain mydomain.com.

The machine smtp2 does NOT run named, it uses smtp1 to resolve DNS.

If I try to send emails to something@mydomain.com using smtp2 as smtp server, it ignores the DNS MX record for the domain, which points to smtp1 and try to deliver the message locally (in smtp2).

The idea here is to keep all accounts for @mydomain.com in the smtp1 machine, and use the smtp2 server to only server smtp and pop to hosted domains, *NOT* for the mydomain.com domain.

Everything works fine, except that I cant send an email to an xxx@mydomain.com thru the smtp2 server, because it tries to deliver locally, on smtp2.

Any help?
Jonathan Sharp_1
New Member

Re: Two sendmail servers, same domain trouble

Is smtp2 acting as a secondary server for mydomain.com? I've never messed around with sendmail much, qmail is more secure. If I remember correctly, you will need to set mydomain.com as an accepted relay domain for sendmail which will accept messages for mydomain.com but try and deliver them to smtp1.domain.com. Make sure that smtp1.mydomain.com has a lower MX priority than smtp2.mydomain.com does.

If you're looking at doing clustered mail at all, I would look into qmail + vpopmail + mysql extension (http://cr.yp.to/qmail.html). This stores all mail in a mysql db for n number of domains & users.

Or look at a way of nfs mounting a users mail file and syncing your account files (/etc/passwd etc...).

But I would seriously consider qmail+vpopmail. It allows for mail accounts on a box without giving them an entry in /etc/passwd or cradentials to the box at all which is more secure. It's worth the small time it takes to set it up and there is great documentation for it. Also as your business grows, you can move the mysql db off to a dedicated box and add more 'drone' boxes on the i'net side to handle connections. One more thing, if you do set it up with mysql as the storage method, add in an iptables rule to only allow mysql connections from your secondary box (smtp2) and have smtp2 point to smpt1's fqdn to use mysql services on it.