MX record for a local mail server

Continuing the discussion from MX Records for internal IPFIRE DNS Server:


Howdy,

I know this is old, but… it drove me crazy trying to remember how to do this.

In /etc/unbound/local.d/hosts.conf add the following, updating for your domain:

server:
  local-zone: "example.com" transparent
  local-data: "mail.example.com 60 IN A 192.168.1.2"
  local-data: "example.com IN MX 10 mail.example.com"
  local-data: "2.1.168.192.in-addr.arpa 60 IN PTR mail.example.com"

And now I can use the MX record for a local mail server hosted on an IPFire test-bed.

8 .)

Note the top two lines in /etc/unbound/hosts.conf

# This file is automatically generated and any changes
# will be overwritten. DO NOT EDIT!

So if you edit it despite the warning then any update on the WUI DNS server page will overwrite anything that you have added. Also any update of unbound will also cause the hosts.conf file to be renewed.

1 Like

Since the hosts.conf was placed in /etc/unbound/local.d/ it should be safe from an update.

I would suggest calling is something like: /etc/unbound/local.d/mxrecord.conf
or
/etc/unbound/local.d/mailserver.conf
or something different from hosts.conf (just to help with confusion).

1 Like

You are quite right Jon. My only excuse is it was late at night and i just didn’t read the content close enough.

Sorry for my error.

2 Likes