I have a BIND9 DNS server running on a company network that has a single master zone company.example
and everything else is forwarded to the company DNS. I have managed to map server1.company.example
and server2.company.example
to their respective IP addresses, but I would also like to reach them by simply using their hostnames server1
and server2
.
Any ideas on how to achieve this?
I tried using CNAME like shown below without any luck
$ORIGIN company.example.
...
server1 IN A 4.5.6.7
server2 IN A 4.5.6.8
server1. IN CNAME server1
server2. IN CNAME server2
You need a new SOA record as server1 and server2 are not within the company.example. domain. You would also have to append a . to your SOA record:
; Start of Authority
server1. IN SOA ns1.example.com. support.example.com. (
XXXXXXXXXX ; Serial
XXXXXX ; Refresh
XXXXX ; Retry
XXXXXXX ; Expire
XXXXXX ; Minimum
);
Disclaimer: I haven't actually tried this record as my nameservers are live :)