# Manually Adding A Domain By Setting Up DNS Records At Cloudflare

**URL:** <https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468>\
**Category:** Help with Setup/Upgrade\
**Created:** [May 21, 2023, 6:04am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468 "2023-05-21T06:04:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 21, 2023, 6:04am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/1 "2023-05-21T06:04:51Z")

</div>

Greetings Mail-in-a-Box world!

I am brand new to Mail-in-a-Box.

Most of my domains are registered at Cloudflare.

Cloudflare does not allow you to change your nameservers like many other registrars do.

I want to add a couple of additional domains to my Mail-in-a-Box setup, but I cannot use the option of setting the nameservers and letting Mail-in-a-Box do the DNS setup.

Basically, I will need to add all of the necessary dns records manually inside of Cloudflare.

Everything I searched for in this group only told me about the change-the-nameserver method.

Is there a tutorial or document anywhere that shows every dns record that I would need to add manually to make this work?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![sugumaranv](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sugumaranv](https://discourse.mailinabox.email/u/sugumaranv)\
**Post date:** [May 21, 2023, 7:27am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/2 "2023-05-21T07:27:09Z")

</div>

JonD, I am happy you chose Mail In A Box to self host your mail server.

Like you, I too have my domains registered on Cloudflare. I would like to advice you that Cloudflare allows you to delegate a sub domain to name servers hosted by Mail In A Box using the “NS” record.

Let me say my domain name is “[EXAMPLE.COM](http://EXAMPLE.COM)” and so, I create “[qwerty.example.com](http://qwerty.example.com)” in CloudFlare dashboard and add two “NS” records and point them to “[ns1.box.qwerty.example.com](http://ns1.box.qwerty.example.com)” and “[ns2.box.qwerty.example.com](http://ns2.box.qwerty.example.com)”.

Now, I make a stub “[ns1.box.qwerty.example.com](http://ns1.box.qwerty.example.com)” with an A and AAAA record to the appropriate IP address. Likewise for “[ns2.box.qwerty.example.com](http://ns2.box.qwerty.example.com)”.

Now, I run the Mail In A Box setup and my box is setup and I will have a personal email address [me@qwerty.example.com](mailto:me@qwerty.example.com).

I am using sub domain “[qwerty.example.com](http://qwerty.example.com)” and if I want to allow mail for the root domain, “[example.com](http://example.com)”, I can setup Email forwarding with CloudFlare to forward all email to @example.com to the Mail In A Box account, [me@qwerty.example.com](mailto:me@qwerty.example.com).

If you have more than one domain in CloudFlare just create a sub domain name for each domain that you want to setup Mail In A Box on and delegate it to two name servers that will host your Mail In A Box.

This works not only on CloudFlare DNS but also NameCheap DNS. Both registrars allow free email forwarding.

Its very easy 🙂

JonD, I hope you can understand but if you still do not please tell me what you do not understand so I can try to help you.

---

<div class="post-metadata">

**Author:** ![eXTric](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/e/bb73d2/32.png) [@eXTric](https://discourse.mailinabox.email/u/eXTric)\
**Post date:** [May 21, 2023, 7:42am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/3 "2023-05-21T07:42:07Z")

</div>

How to setup miab with Cloudflare is discussed here. You need to use the external dns option and manually copy the values that miab suggests to Cloudflare

> [@How to setup with cloudflare and digital ocean](https://discourse.mailinabox.email/t/how-to-setup-with-cloudflare-and-digital-ocean/9409/13):
>
> I recommend considering using a domain that is dedicated to your MaiB server, and nothing else. It gives MiaB the freedom to do what the developers want it to do, which is to provide a very reliable standards compliant mail server.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 21, 2023, 7:44am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/4 "2023-05-21T07:44:09Z")

</div>

Thanks @sugumaranv .

I didn’t know you could do that at Cloudflare.

Although, it is a bummer that you would need that subdomain in the email address.

I actually went through and manually added a bunch of DNS records in Cloudflare and successfully added another domain to my MailInABox setup!

Although it was onerous to have to add all of those.

Also, I am not a DNS expert, so there was some scary guesswork, but apparently I guessed right.

It would be nice if there was a way inside MailInABox to “add a domain” and then get a list of the precise DNS records you need to add to your domain.

Or a good tutorial haha.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 21, 2023, 7:53am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/5 "2023-05-21T07:53:30Z")

</div>

@eXTric

Thanks for chiming in!

> [@eXTric](#):
>
> manually copy the values that miab suggests to Cloudflare

Are you talking about the glue records?

Or is there a place where MIAB lists suggested DNS records somewhere?

P.S. I am NOT talking about the MAIN domain for the MIAB setup, just additional domains.

---

<div class="post-metadata">

**Author:** ![eXTric](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/e/bb73d2/32.png) [@eXTric](https://discourse.mailinabox.email/u/eXTric)\
**Post date:** [May 21, 2023, 8:09am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/6 "2023-05-21T08:09:48Z")

</div>

You go to system \> external DNS.  
MiaB creates a zone file for every domain you created an email for (which is how you add a domain)  
The zone file can not be imported to Cloudflare so you need manually copy the values.  
When i was warming up my IP and testing miab I had two domain at Cloudflare and you need to do the procedure for each domain.

---

<div class="post-metadata">

**Author:** ![sugumaranv](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sugumaranv](https://discourse.mailinabox.email/u/sugumaranv)\
**Post date:** [May 21, 2023, 8:23am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/7 "2023-05-21T08:23:20Z")

</div>

This is tedious process to add every record manually.

I use CloudFlare as my registrar, and I create a sub domain, [miab.example.com](http://miab.example.com) with two NS records:  
[ns1.box.miab.example.com](http://ns1.box.miab.example.com)  
[ns2.box.miab.example.com](http://ns2.box.miab.example.com)

Then, I setup a glue record for both ns1 and ns2 to the appropriate IP number.

Finally, I run the MIAB setup and the system installs itself.

Of course, I will like all email to @example.com be forward to [me@miab.example.com](mailto:me@miab.example.com), and CloudFlare gives free email routing.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 21, 2023, 11:24am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/8 "2023-05-21T11:24:16Z")

</div>

@eXTric

Do you do all the optional DNS Records?

---

<div class="post-metadata">

**Author:** ![eXTric](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/e/bb73d2/32.png) [@eXTric](https://discourse.mailinabox.email/u/eXTric)\
**Post date:** [May 21, 2023, 11:49am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/9 "2023-05-21T11:49:57Z")

</div>

Yes i did. Just make sure you have a way to keep track of what you already copied.  
It is a pain but if you do it right you only need to invest time in it once.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 21, 2023, 12:42pm UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/10 "2023-05-21T12:42:42Z")

</div>

@eXTric

I’ve had success with two additional domains now and all seems good.

I did notice that on the external DNS instructions inside MailInABox there were a couple of these type situations:

[autoconfig.myaddondomain.com](http://autoconfig.myaddondomain.com) MX 0

Only Cloudflare required a mail server, so I put in my [box.myfirstdomain.com](http://box.myfirstdomain.com) address because the MailInABox instructions seemed to want to leave the mail server BLANK.

I am curious, did you handle that differently, or did you do the same thing?

---

<div class="post-metadata">

**Author:** ![alento](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/alento/32/1371_2.png) [@alento](https://discourse.mailinabox.email/u/alento)\
**Post date:** [May 21, 2023, 8:43pm UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/11 "2023-05-21T20:43:39Z")

</div>

> [@sugumaranv](#):
>
> I am using sub domain “[qwerty.example.com](http://qwerty.example.com)” and if I want to allow mail for the root domain, “[example.com](http://example.com)”, I can setup Email forwarding with CloudFlare to forward all email to @example.com to the Mail In A Box account, [me@qwerty.example.com](mailto:me@qwerty.example.com).

This seems awfully convoluted. I would not do it this way. However, that said, I would still point the NS for the MiaB subdomain to the MiaB itself, but all of the domains that are hosted on the box, I would manually enter the required DNS records to CF. Then there is no need to do this convoluted forwarding regimen.

---

<div class="post-metadata">

**Author:** ![alento](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/alento/32/1371_2.png) [@alento](https://discourse.mailinabox.email/u/alento)\
**Post date:** [May 21, 2023, 8:47pm UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/12 "2023-05-21T20:47:18Z")

</div>

> [@JonD](#):
>
> [autoconfig.myaddondomain.com](http://autoconfig.myaddondomain.com) MX 0

Did you miss the period in the value field? There is a period there that you enter. This tells DNS that there is no mail server for the (sub)domain.

![image](https://discourse.mailinabox.email/uploads/default/original/2X/e/e96bb7f4f8beb00e6b6f13072f62015db0e175cf.png)

---

<div class="post-metadata">

**Author:** ![alento](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/alento/32/1371_2.png) [@alento](https://discourse.mailinabox.email/u/alento)\
**Post date:** [May 21, 2023, 8:51pm UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/13 "2023-05-21T20:51:54Z")

</div>

> [@JonD](#):
>
> It would be nice if there was a way inside MailInABox to “add a domain” and then get a list of the precise DNS records you need to add to your domain.

There is … on the External DNS page you can download a copy of the zone file.

![image](https://discourse.mailinabox.email/uploads/default/original/2X/5/5cde0855d3678b3bc3fd51cef903fb9069736866.png)

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 22, 2023, 5:22am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/14 "2023-05-22T05:22:51Z")

</div>

@alento

Oh! I had no idea that is what the “.” meant.

I’ll have to go and try that out.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 22, 2023, 5:23am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/15 "2023-05-22T05:23:56Z")

</div>

@alento

> [@alento](#):
>
> on the External DNS page you can download a copy of the zone file.

I tried that.

When I tried to upload it to Cloudflare there was some kind of error and nothing imported.

I tried several times and then just reverted to manually doing it.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 22, 2023, 7:20am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/16 "2023-05-22T07:20:46Z")

</div>

@eXTric @alento @sugumaranv

How do y’all handle dnssec ?

I see that when a domain is registered at Cloudflare, when you click on the button to activate dnssec, Cloudfare automatically sets it up on their end with their own dnssec settings.

So, of course, those don’t match what MailInABox requires.

Do you just leave dnssec off?

Or maybe there is something I am missing?

This is officially my first project where I am dealing with dnssec at all on my own.

---

<div class="post-metadata">

**Author:** ![sugumaranv](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sugumaranv](https://discourse.mailinabox.email/u/sugumaranv)\
**Post date:** [May 22, 2023, 9:12am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/17 "2023-05-22T09:12:20Z")

</div>

JonD, as I use a sub domain that I delegate exclusively to MIAB name servers, so, DNSSEC works perfectly for me.

My email address will be [me@miab.example.com](mailto:me@miab.example.com). As I mentioned earlier, I use CloudFlare Email Routing that forwards every email to \*@example.com to [me@miab.example.com](mailto:me@miab.example.com).

There is always a workaround.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 22, 2023, 9:39am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/18 "2023-05-22T09:39:54Z")

</div>

@sugumaranv

I haven’t decided about that route yet, although I am glad to know about it.

I did have a follow up question about what you said earlier on that.

> [@sugumaranv](#):
>
> Now, I make a stub “[ns1.box.qwerty.example.com](http://ns1.box.qwerty.example.com)” with an A and AAAA record to the appropriate IP address. Likewise for “[ns2.box.qwerty.example.com](http://ns2.box.qwerty.example.com)”.

What does it mean to “make a stub” in this context?

I am not familiar with that phrase (although I am reading about it having googled it).

Also, the example you gave is of an add on domain, right? Not the main MAIB domain?

Why do you need to add the “box.” in that case (being only an addon domain)?

---

<div class="post-metadata">

**Author:** ![sugumaranv](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sugumaranv](https://discourse.mailinabox.email/u/sugumaranv)\
**Post date:** [May 22, 2023, 12:09pm UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/19 "2023-05-22T12:09:48Z")

</div>

By “stub”, I mean a “glue record” for the sub domain.

As CloudFlare does not allow changing DNS servers, so suppose a domain name is [EXAMPLE.COM](http://EXAMPLE.COM), you just add a sub domain, like [MIAB.EXAMPLE.COM](http://MIAB.EXAMPLE.COM), and then add an NS record for it with value “[ns1.box.miab.example.com](http://ns1.box.miab.example.com)”. Do the same for “[ns2.box.miab.example.com](http://ns2.box.miab.example.com)”.

Then make sure you set an A or AAAA record for both [ns1.box.miab.example.com](http://ns1.box.miab.example.com) and [ns2.box.miab.example.com](http://ns2.box.miab.example.com)" as they are stub or glue record for your sub domain.

Yes, its like being your own registrar 🙂

MIAB is really fun as it empowers you.

---

<div class="post-metadata">

**Author:** ![JonD](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/jond/32/2477_2.png) [@JonD](https://discourse.mailinabox.email/u/JonD)\
**Post date:** [May 23, 2023, 1:28am UTC](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468/20 "2023-05-23T01:28:49Z")

</div>

@sugumaranv

> [@sugumaranv](#):
>
> [ns1.box.miab.example.com](http://ns1.box.miab.example.com)

Why include the “box” in the “stub?”

At least, why if I am setting up an addon domain rather than the main domain?

[Next page](https://discourse.mailinabox.email/t/manually-adding-a-domain-by-setting-up-dns-records-at-cloudflare/10468.md?page=2)
