Multiple domains in Mail-in-a-Box / with the domains being hosted elsewhere?

I’m not sure that I quite understand being able to add multiple domains to the mail-in-a-box server.

Is the following kind of setup possible using Mail-in-a-Box?

Using DigitalOcean, 4 droplets:

mailserver.com (IP: 188.22.10.10 - dedicated mail-in-a-box server)
hello@mailserver.com
hello@domain1.com
hello@domain2.com
hello@domain3.com

domain1.com (IP: 138.52.11.33 - Ecommerce website with it’s own SSL)
→ hosted website 1

domain2.com (IP: 138.54.98.101 - Wordpress website)
→ hosted website 2

domain3.com (IP: 165.71.144.54 - Some other website)
→ hosted website 3

Yes, but you’ll have to use the box’s DNS API at the end to set different “A” records for the three other domains. (They default to the box’s IP address.)

So…

  1. All domains must have the nameservers of mailserver.com
  2. mailserver.com has 3 A records that map the hostnames of each of the other three domains to their corresponding IP address (in order to serve websites for those domains).
  3. Mail accounts for each domain are created mailserver.com
  4. Done

Does this cover everything?

That should do it…

What do you mean by using the box’s DNS API? I currently have NS1 and NS2 pointing to my server’s IP and having Mail-in-a-box host DNS. I would like to add a CNAME record to send WWW traffic to a separate web host.

Please see the Custom DNS section in the box’s control panel (/admin).

Cool. Easy enough. I added the CNAME under Set Custom DNS Records. Is there a manual refresh/restart required? How long until the changes take effect?

It’s been a few hours and I’m not getting redirection to the CNAME of the external host. Advice?

The box starts serving the change immediately. DNS is frequently cached at all sorts of intermediate DNS servers between clients and the box, but those caches typically clear within a few hours.

whois is showing my nameservers as:
Name Server: NS1.mydomain.net
Name Server: NS2.mydomain.net

While the Mail-in-a-box /admin system check indicates the nameserver glue records are correct:
ns1/ns2.box.mydomain.net

Is there something wrong here?

Yup, I screwed up. It is fixed now. :smile:

OK, although I fixed my NS glue records, my CNAME configuration still isn’t being served. It’s been over 20 hours. Either I will have to wait even more time for DNS caches to flush or something still isn’t configured correctly. Is there anything else I can verify in my MIAB? Thank you in advance.

To verify- 1) It should be listed in the External DNS tab. 2) You can query from the command line:

dig @box.yourdomain.com cname something.yourdomain.com

The @-parameter is the name or IP address of a DNS server to query, in this case you are checking that the box itself is serving the correct info. And something.yourdomain.com is the domain/subdomain that you set the CNAME record for.

Hey Josh - I just performed this before seeing your response. Great timing. :smile:

My Custom DNS is: “www.thesheehans.net CNAME thesheehans.nfshost.com” which matches the External DNS information tab.

Here’s the output from dig on my box:

root@box:~# dig @ns1.box.thesheehans.net www.thesheehans.net all

; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> @ns1.box.thesheehans.net www.thesheehans.net all
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38282
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.thesheehans.net.           IN      A

;; ANSWER SECTION:
www.thesheehans.net.    1800    IN      A       104.236.128.107

;; AUTHORITY SECTION:
thesheehans.net.        1800    IN      NS      ns1.box.thesheehans.net.
thesheehans.net.        1800    IN      NS      ns2.box.thesheehans.net.

;; ADDITIONAL SECTION:
ns1.box.thesheehans.net. 1800   IN      A       104.236.128.107
ns2.box.thesheehans.net. 1800   IN      A       104.236.128.107

;; Query time: 2 msec
;; SERVER: 104.236.128.107#53(104.236.128.107)
;; WHEN: Fri Jan 16 11:35:24 EST 2015
;; MSG SIZE  rcvd: 136

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 5375
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;all.                           IN      A

;; Query time: 0 msec
;; SERVER: 104.236.128.107#53(104.236.128.107)
;; WHEN: Fri Jan 16 11:35:24 EST 2015
;; MSG SIZE  rcvd: 32

And querying an external NS:

root@box:~# dig @8.8.8.8 www.thesheehans.net all

; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> @8.8.8.8 www.thesheehans.net all
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3544
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.thesheehans.net.           IN      A

;; ANSWER SECTION:
www.thesheehans.net.    1759    IN      A       104.236.128.107

;; Query time: 23 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Jan 16 11:39:52 EST 2015
;; MSG SIZE  rcvd: 64

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 62316
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;all.                           IN      A

;; AUTHORITY SECTION:
.                       1282    IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2015011600 1800 900 604800 86400

;; Query time: 24 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Jan 16 11:39:52 EST 2015
;; MSG SIZE  rcvd: 107

Ah, I bet the default A record for www is preventing the CNAME record from being used.

Mail-in-a-Box would need to be modified to not create default A records if a CNAME record is used.

I’m happy to help debug. Can this be fixed?

I attempted to use the DNS API to delete the A record for www:

curl -d " " --user me@mydomain.com:###### https://box.thesheehans.net/admin/dns/set/www.thesheehans.net/a/__delete__

I receive an OK response, but the External DNS admin page and dig @ns1.box.thesheehans.net www.thesheehans.net all still see the A record for www. :frowning:

1 Like

Yeah, you can’t delete records that you didn’t create.

This will be fixed in the next update. Thanks.

1 Like

Gday, did this issue ever get resolved? I seem to have the same scenario I have A records and CNAME records for the www subdomains, but the subdomains never resolve correctly.

Any advice much appreciated.
Cheers!
Dig:
dave@webserver:~$ dig @ns1.box.gotany.email www.happygoanna.com.au all
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> @ns1.box.gotany.email www.happygoanna.com.au all
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 25382
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.happygoanna.com.au. IN A

;; ANSWER SECTION:
www.happygoanna.com.au. 1800 IN CNAME 188.166.238.213.happygoanna.com.au.

;; AUTHORITY SECTION:
happygoanna.com.au. 1800 IN SOA ns1.box.gotany.email. hostmaster.box.gotany.email. 2016051700 7200 1800 1209600 1800

;; Query time: 2 msec
;; SERVER: 128.199.224.255#53(128.199.224.255)
;; WHEN: Tue May 17 18:01:02 EDT 2016
;; MSG SIZE rcvd: 148

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 40621
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;all. IN A

;; Query time: 0 msec
;; SERVER: 128.199.224.255#53(128.199.224.255)
;; WHEN: Tue May 17 18:01:02 EDT 2016
;; MSG SIZE rcvd: 32

Am i right in saying there is still no good guide to setting up a new domain that doesnt involve directing the domains nameserver settings to the box?

I have been successfull with adding multiple domains to my box while hosting the websites for them else by changing the DNS, however it doesnt aways work and it would be great to get a concrete solution to e.g.:

  1. I have my main domain [mysite.com] and i set up my mailinabox with that domain.
  2. want to add name@anotherdomain.com to my mailinabox setup, what are the steps?!