Setup correct IP mailserver multiple IP on server

Anne

Verified User
Joined
Dec 3, 2015
Messages
71
Hi,

I hope you can help me out. I have a server wilt multiple IP addresses attached to it. One domain has it's own IP. But when I send an email, it comes from the main IP of the server.

I found this feature: https://www.directadmin.com/features.php?id=1692

Now I'm not a super DA professional, so I think I'm just missing something. Can you help me figure it out?

What I did:

1. Update Exim to 4.92
2. Add add_domain_to_domainips=1 into directadmin.conf file.
3. Restart Direct Admin via Service monitor.

But the sent emails still come from the main IP.

What else do I need to do?
 
What else do I need to do?
The rest of what the documentation says you should do,.

You did enable the option in directadmin, but forgot about creating the /etc/virtual/domainips and /etc/virtual/helo_data files and put the correct content in them.
Read the feature again carefully, it also contains examples.
 
Hi Richard,

I see. I was in the understanding that the add_domain_to_domainips=1 would activate all this.

So I checked the other parts. I only need to execute 3. via shell, correct?

1. exim.conf I can skip these, because I already have 4.92 : NOTE: current exim.conf 4.4.x already have these sections, so no need to edit your exim.conf.
2. LAN setup part, I don't got all of it, but I think I can just skip this too
3. Task.queue. Not sure which command I should pick, could it harm anything? Else I go for:
same as above, but will start from an empty domainips file, handy if everything is out of sync, start over: echo "action=rewrite&value=domainips&empty=yes" >> /usr/local/directadmin/data/task.queue
4. Sample /etc/virtual/helo_data: ok this is just a check I guess.
5. Manual control no need for.
 
I'll answer in points like you did, makes it more clear maybe.

1.) Yes. As the feature said, this can be skipped since you have a new exim.conf version.

2.) You're not on a LAN normally, so you can indeed skip that one too.

3.) If you do the wrong command, all ip's will get in there and that should not be the case.
So I would only use the one for the domain with the seperate ip like this:
Code:
echo "action=rewrite&value=domainips&domain=domain.com" >> /usr/local/directadmin/data/task.queue
where domain.com is the domain with you want to have seperate helo for.

4.) No, the doc says you have to create it:
Code:
echo "action=rewrite&value=helo_data&ip=1.2.3.4" >> /usr/local/directadmin/data/task.queue
where ip 1.2.3.4 should be the ip for that domain. Create domainips first.

5.) Correct.
 
Remember to have the mail.domain.com A record point to the correct ip for that seperate domain in DNS.
Also remember to create an rDNS record for that ip with your hoster/datacenter.
 
Hi Richard,

Thanks for walking me through. I know it's not so much fun to help the noobs ;)
I can handle a lot with directadmin and did some custom stuff along the way to make it run perfect, but these things are not my daily stuff to do and I'm always a little afraid to mess something up. So for your elaboration I'm grateful.

It works perfect now, thanks! ?

One question about this:

Remember to have the mail.domain.com A record point to the correct ip for that seperate domain in DNS.

Not sure why I need to add an A record, but I did. I already have a wildcard *.domain.com A record btw. But I've added it in the domain DNS server, not in DirectAdmin, is this correct? Or should I also/instead add it via DNS administration -> domain.com in DirectAdmin too?
 
I know it's not so much fun to help the noobs ;)
Well, I don't mind, it's my hobby to help people who are new at this. Everybody had to learn and I was also thankfull for help when I had a question or issue in the beginning (and even now). So why not share the help? ;)
And this is indeed not daily stuff.

Glad to read it works now as it should be, you're welcome.

Not sure why I need to add an A record, but I did. I already have a wildcard *.domain.com A record btw.
Ah... I didn't know that, because a wildcard *.domain.com is not default in Directadmin, hence I advised the mail A record which is normally created by default in Directadmin. So in this specific case you did not have to add it.

When using an external DNS sometimes there are also indeed wildcard domain records with some dns providers. However, for others reading this and wanting to try this with the default method without wildcard domain record, they now know the correct A record must exist in that case.

If you're using an external DNS you normally would not have to put this in DNS administration for DA.
Just to be sure if you want to use internal nameservers sometime, you might put it there anyway, it won't do harm and maybe if there is some local lookup for anything (normally not) then it's correct in there.

You did create the rDNS record, correct?
 
Well, I don't mind, it's my hobby to help people who are new at this. Everybody had to learn and I was also thankfull for help when I had a question or issue in the beginning (and even now). So why not share the help? ;)
And this is indeed not daily stuff.
Thanks a lot, I do appreciate it a lot.

About the DNS, I think I confused you a bit, sorry. I mean the wildcard in the external DNS indeed. The mail record was indeed there in Directadmin DNS, but I added it into the external DNS, I thought that was what you ment. I never use the internal DNS, so never look into it much to be honest.

So for others to read this, they can ignore and stick to what Richard says.

Yes the rDNS (hostname linked to the ip correct?) was created by the network manager on my request and this works perfectly indeed. Also the other domains just keep working like they should. For others a small note, I got this external DNS TXT record for SPF and this work fine in combination with all i've done above: "v=spf1 a mx ~all".
 
Yes the rDNS (hostname linked to the ip correct?)
Yes, you should have 2 now because you're using 2 ip's for sending mailservers. Both ip's can be pointing to the same hostname.
The SPF records you showd is just a default record without restrictions. So that should work.

Just to be sure you might want to send a test mail via mail-tester.com to see if from both ip's you get a 10/10 score.
 
Yes correct.

I did indeed with mail-tester.com. I love that tool, highly recommended to anyone that want to test his email and see what can be improved! Free for up to 3 emails a day, but you can support them buying a few more.
 
Back
Top