Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


BIND - DNS and MX Records
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

BIND - DNS and MX Records

aubsaubs Member
edited March 2012 in Help

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

  • dmmcintyre3dmmcintyre3 Member
    edited March 2012

    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.

    Thanked by 1aubs
  • aubsaubs Member

    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

  • aubsaubs Member
    edited March 2012

    @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 become mydomain.co.uk.mydomain.co.uk [wrong]
    mydomain.co.uk. would become mydomain.co.uk [right]
    sub. would become sub [wrong]
    sub would become sub.mydomain.co.uk [right]

  • aubsaubs Member

    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:

    zone "1.168.192.in-addr.arpa" {
            type master;
            notify no;
            file "/etc/bind/db.192";
    };

    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 show rev.0.168.192.in-addr.arpa, This one even shows:

    zone "3.13.10.in-addr.arpa" {
         type master;
         file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";

    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";
    }

  • aubsaubs Member

    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.

  • aubsaubs Member

    Thanks for that, makes sense now :)

Sign In or Register to comment.