PDA

View Full Version : Mailserver - 2nd MX (Backup) relay


drees
03-21-2004, 06:08 AM
Hello everyone.

I have the following problem. I installed Qmail successful. The server is a backup Email server (2nd MX Entry).

Normally clients have to setup two accounts in there mail client. One entry for the 1st MX and one for the 2nd MX entry.

Now I want to provide (ONLY for ONE DOMAIN, NOT for the REST) the following service. If mails are stored at the 2nd MX Server they should be automatically relayed to the 1st MX Server. This should only take place for one Domain. The Rest should be a "normal" Email server.

Could anyone help me?

Cheers
Chris

Bookworm
03-21-2004, 02:35 PM
The domains you WANT forwarded should be in /var/qmail/control/smtproutes

The domains you want stored locally should NOT be in smtproutes.

BW

drees
03-21-2004, 02:41 PM
Hallo!

can u give the syntax so that the server knows where to relay the mail to?

Cheers
Christian

Bookworm
03-21-2004, 02:55 PM
This is pulled straight from the FAQ included in /var/qmail/doc

Specifically - local domains should be in /var/qmail/control/locals. Domains to be forwarded should be in /var/qmail/control/rcpthosts, but not in locals.
/var/qmail/control/smtproutes should contain the name or IP address of the machine to which to forward.

It's a good idea to leave at least a munged up address in your locals, so you can forward error messages to that, rather than to the forwarder. (munged up like 'greenpeace.<domainname>.net' which is different from 'mail.<domainname>.net' - that way you can forward admin stuff to postmaster@greenpeace.<domainname>.net - and check it through the web on the local machine. )

BW

2. Routing outgoing messages


2.1. How do I send local messages to another host? All the mail for
af.mil should be delivered to our disk server, pokey.af.mil. I've set up
an MX from af.mil to pokey.af.mil, but when a user on the af.mil host
sends a message to boss@af.mil, af.mil tries to deliver it locally. How
do I stop that?

Answer: Remove af.mil from /var/qmail/control/locals. If qmail-send is
running, give it a HUP. Make sure the MX is set up properly before you
do this. Also make sure that pokey can receive mail for af.mil---see
question 3.1.


2.2. How do I set up a null client? I'd like zippy.af.mil to
send all mail to bigbang.af.mil.

Answer: echo :bigbang.af.mil > /var/qmail/control/smtproutes;
chmod 644 /var/qmail/control/smtproutes. Disable local delivery as in
question 2.1. Turn off qmail-smtpd in /etc/inetd.conf.

drees
03-21-2004, 03:44 PM
pls correct me if i got the wrong msg. the think i have to is to add the the servername the mails should be send to into the var/qmail/control/smtproutes but in my file var/qmail/control/rcpthosts there is not only one domain. so how is only mail for a certian domain delivered to the forward server and the rest stored onto disk?

Cheers

Chris

Bookworm
03-21-2004, 03:51 PM
/var/qmail/control/rcpthosts stores all of the domains the machine will accept.
/var/qmail/control/locals stores all of the domains that are supposed to be ON the machine
/var/qmail/control/locals says what to do with any domains that aren't stored in locals.

If you're really having a lot of problems here, you should go read through Life With Qmail, and the qmail docs.

BW

drees
03-21-2004, 04:31 PM
Hi,

i check the file /var/qmail/control/rcpthosts and there are all domians listet which should be handelld by the server.

Afterward i looked into the file /var/qmail/control/locals and it is empty.

I am using a file calld virtualdomains to define the domains there

currently there is no file called var/qmail/control/smtproutes in the control dir. should i setup a file and add the following syntax to it

testdomain.com:mailserverwithMX1.com


then it should work ?

cheers
Chris

PS i looked into the links u provided (faq) but there was nothing about the szenario with empty locals file

Bookworm
03-21-2004, 05:58 PM
Okay - syntax for /var/qmail/control/smtproutes

domainname.com:address.to.which.the.mail.goes

:address.to.which.the.mail.goes

The first example is a single second level domain. If you have mail going to bob.domain.com as well as domain.com - you'd need to add bob.domainname.com:address

'address' can be a name address, or a direct IP address.

/var/qmail/control/locals is for domains that are considered to be on the LOCAL box. If you have ONE domain on the local box, and fifty million being forwarded, it doesn't make much sense to try to add every single forward domain to the smtproutes file.

_however_, until you're more familiar with how vpopmail and such work, do just that.

Put eight lines in smtproutes that specify the domains, and the address to which they should be sent. Leave the ninth domain out, which means it'll be stored locally.

Now - one caveat. you don't have to actually USE vpopmail for this configuration. Since those domains are being routed directly out again, they ONLY need to be in your rcpthosts file, and nothing else.

Understand now?

BW