1

having trouble with some DNS configuration, I have managed to get part of the site working, however adding the prefix 'www', I'm finding a little tricky.

Essentially, what I want is

mysite.net -> IP address 12.0.0.50 (This works fine) www.mysite.net -> IP address 12.0.0.60 (This is not working)

I would really appreciate some pointers here, I believe my syntax is what is the source of the problem, but having looked at materials online, I haven't been able to find a solution.

Here is my code for my zone.

$TTL 1D
$ORIGIN mysite.net.
@       IN SOA  ns1 admin.mysite.net. (
                                    0       ; serial
                                    1D      ; refresh
                                    1H      ; retry
                                    1W      ; expire
                                    3H )    ; minimum
    1D IN NS        ns1
    1D IN A         12.0.0.50
www             CNAME   mysite.net.
www     1D IN A         12.0.0.60
ns1             1D IN A 12.0.0.10

www.mysite.net needs to have an A record for 12.0.0.60, and it also needs to be www, hence the reason for the CNAME, but it won't resolve. Any ideas to what I have done wrong here?

  • Have also tried www.mysite.net. 1D IN A 12.0.0.60 with no success, I know that it's not possible to have a record with CNAME, but how can I point the www. -> 12.0.0.60 – user3019191 Nov 13 '14 at 12:40
2

CNAME is used to create aliases to the same destination, however your domains (mysite.net and www.mysite.net) do not share the same destination. You must set up two A records:

$TTL 1D
$ORIGIN mysite.net.
@      IN SOA  ns1 admin.mysite.net. (
                                    0       ; serial
                                    1D      ; refresh
                                    1H      ; retry
                                    1W      ; expire
                                    3H      ; minimum
       )

@      IN NS        ns1          ; mysite.net is handled by ns1.

@      IN A         12.0.0.50    ; mysite.net is at 12.0.0.50
ns1    IN A         12.0.0.10    ; ns1.mysite.net is at 12.0.0.10
www    IN A         12.0.0.60    ; www.mysite.net is at 12.0.0.60

Here, you have three machines available:

  • 12.0.0.10, which is hosting the DNS server. It can be reached through ns1.mysite.net.
  • 12.0.0.50 which is hosting the first website through mysite.net.
  • 12.0.0.60 which is hosting the second website through www.mysite.net.

This configuration should be made on 12.0.0.10, which seems to be your authoritative name server here. However, there is no need for a CNAME entry.

However, let's say that now, you want to add the forum subdomain, the content for which is hosted on 12.0.0.60, you may use:

forum  IN CNAME     www          ; forum is an alias to www (12.0.0.60)    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.