Set www A (and other DNS) records after install

Hello,

I’ve installed mail-in-a-box and it’s working pretty much perfectly. However I’d like to point my DNS www record at a different server using the mail-in-a-box name servers. I’ve tried editing the NSD zones files to reflect a change to the www record and then I stopped and re-started the NSD service but the www record still points at the mail server. Also after a reboot the records return to their previous state.

Is there a step I’m missing, or another way to accomplish this?

Thanks!

In the admin (/admin) there are instructions. You can’t hack the box directly.

Thank you Josh,

It looks like I have to use an External DNS to get this functionality - unless I’m missing something?

Thanks again,

Neil

You can use the box’s DNS API to set different DNS records.

Thanks Josh,

I must be stupid or just missing something - but where is the documentation on how to access the API? I cant seem to find it in the /admin panel.

Cheers!

Neil

Do you have the most updated version of mail-in-a-box.

Theres a tab in the System…pull down menu and click DNS (Custom/External)

This will bring you to custom DNS.

There a couple of examples to show how to use curl function to send your request.

Basically you use HTTP request to submit your command to the python function to edit your DNS.

Syntax
curl -d “” --user {email}:{password} https://example.com/admin/dns/set/{qname}[/{rtype}[/{value}]]

Its pretty self explanatory and execute this in curl supported shell. The “” box is for you value, took me a second to figure out even though there are examples to show that. I did a recent command to update my A record for www. This is what I used

curl -d "value=“IP_ADDRESS” --user me@example.com:******** https://example.com/admin/dns/set/www.example.com/A

I exclude my personal details. I hope this helps.

@madmax
@JoshData

Hello Guys,

I tried to find the DNS API documenation how to set it. In my box I have only this menus
System
Status Checks
External DNS (Advanced)

Mail
Instructions
Users
Aliases

I cannot find DNS (Custom/External) under system. Did I miss something?

Cheers,
Chris

The examples are in the master branch, not 14.08-beta which you probably have installed.

Have a look on github for the examples.

Examples:

# sets laptop.mydomain.com to point to the IP address of the machine you are executing curl on
curl -d "" --user me@mydomain.com:###### https://mydomain.com/admin/dns/set/laptop.mydomain.com

# sets an alias
curl -d "" --user me@mydomain.com:###### https://mydomain.com/admin/dns/set/foo.mydomain.com/cname/bar.mydomain.com

# sets a TXT record
curl -d "value=something%20here" --user me@mydomain.com:###### https://{{hostname}}/admin/dns/set/foo.mydomain.com/txt

# clears the TXT record
curl -d "value=" --user me@mydomain.com:###### https://mydomain.com/admin/dns/set/foo.mydomain.com/txt

@jmar71n thanks! I just updated to master branch now I see the menu. Thanks!

Thanks everyone - reverting to the master branch worked for me as well :slight_smile:

Once you add a DNS record, is it supposed to show up in the “DNS (Advanced)” page? Because it’s not showing for me after I add a record:

I switched to the master branch.

I connected to my mailinabox with ssh
I ran (as sudo) curl -k -d "value=THEIPADDRESSOFTHESECONDSERVER" --user MYADMINEMAIL:MYADMINPASS https://MYMAILINABOXURL/admin/dns/set/www.SECONDSERVERURL/A

Did I do this correctly? Or am I also supposed to add the domain to the DNS tab in DigitalOcean for the second server and manage the DNS that way?

EDIT:

Nevermind, I had to first add an email user for the second server. It shows up now.