BIND - DNS and MX Records
Hi all, I've been playing around with DNS, but for some reason, can't seem to resolve what I'm aiming for.
Basically, I want sub.mydomain.co.uk to have MX entries (pointing to google's servers) but also to have a website.
This works on its own:
sub IN CNAME mydomain.co.uk
... so I can use it as a website which points to the main website as mydomain.co.uk anyway (yes, I could get away with using * IN CNAME mydomain.co.uk
, but if I wanted it pointing elsewhere this wouldn't work).
This works on its own:
sub.mydomain.co.uk. IN MX 1 aspmx.l.google.com.
...so I can have emails directed to google.
The trouble is, I can't seem to have them both together. Am I missing something?
I appreciate sub
is the same as sub.mydomain.co.uk.
Comments
you can't mix CNAMEs with other records. Use an A (and AAAA if IPv6 is used) record instead of CNAME to point it to your webserver.
Excellent, thank you @dmmcintyre3 - Should have known that really
I dunno if it is how you are typing stuff, but my first reaction is you are missing a trailing dot on your CNAME
@miTgiB : Thanks for that, I did actually have a trailing dot in the file but for some reason didn't copy it over (though I did miss it in two examples!). For others who this may be of use (I learnt this at my old job!) ... Fully qualified domain names need the dot or the domain name is appended. Examples:
mydomain.co.uk
would becomemydomain.co.uk.mydomain.co.uk
[wrong]mydomain.co.uk.
would becomemydomain.co.uk
[right]sub.
would becomesub
[wrong]sub
would becomesub.mydomain.co.uk
[right]Hi, hopefully someone will have insight in to this.
https://help.ubuntu.com/10.04/serverguide/C/dns-configuration.html#dns-reverse-zone-file
Edit /etc/bind/named.conf.local and add the following:
All documentation I have seen regarding this always show local IP addresses, such as in the example 192.168.1.x, but never explain if this needs to be the publicly accessible IP if it is for public DNS (as opposed to internal DNS). Additionally, different guides specify different file names. the above shows
db.192
, others showrev.0.168.192.in-addr.arpa
, This one even shows:Looks like they both differ completely?
Am I missing something? Thanks
The name of the file does not matter.
Often, the zone files you see are examples.
If you wanted to provide reverse DNS for IP address AAA.BBB.CCC.DDD and had public delegation for the AAA.BBB.CCC/24 subnet, you could
in named.conf
zone "CCC.BBB.AAA.in-addr.arpa" {
type master;
file "/etc/my.filename.can.be.anything.i.want.but.I.will.call.it.zone.AAA.for.ease";
}
Thanks, @judouk
So if I understand you correctly, if I am setting this up for an internal system (with internal IP's) I can use your example.
However if I am setting up Bind up for a number of domains I have, so I have more control over the DNS, I shouldn't set up a reverse zone file as I will be hosting more than one domain on a single IP. I will then need to get my ISP / VPS provider to set the rDNS for the IP?
Sorry if this sounds a bit silly, I'm just making sure I understand it properly.
If your ISP has delegated control of the reverse DNS to you, then you would normally need to setup your zone accordingly.
Try not to confuse forward and reverse (in-addr.arpa) zones.
You can have as many records (A, CNAME, MX etc) as you want for one particular IP address but, for the reverse, you should normally only have one.
Thanks for that, makes sense now