Why do we use canonical hostname in DNS system? [closed] - dns

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 months ago.
Improve this question
I read a document which says that a host with a complicated hostname can have one or more alias names. For example, relay1.west-coast.media.com is a canonical hostname whereas media.com is an alias. They both are related with each other by 'A' record and 'CNAME' record in DNS system follows:
media.com CNAME relay1.west-coast.media.com
relay1.west-coast.media.com A 210.23.25.32
What makes us use the complicated canonical hostname? Can't we simply associate alias with the ip address by adding record 'A' in the DNS system as follows:
media.com A 210.23.25.32

CNAME entries are useful when running multiple services on a single server. For example you could point www.media.com, ftp.media.com, and mud.media.com all to relay1.west-coast.media.com.
That way if the IP address of relay1... ever needed to change, it would be a single update to the A record instead of multiple.

Yes, you can.
First, as Lanexbg explained your specific example is wrong since you can not have a CNAME at apex (root) of the zone because by definition a CNAME record can not coexist with anything else (we will forget about the exceptons here) and at apex you need to have SOA and NS records for your zone to work correctly.
So let us just instead use the appropriate names for configuration/documentation needs and discuss about the difference between www.example.com A and www.example.com CNAME www.example.net + www.example.net A
The end result of the www.example.com A resolution would be the same for an end user, besides various points that can be neglected on a first approach (like performance issues).
If you are maintaining both the authoritative nameservers for example.com and example.net you are free to choose between the two cases. As Chris Meueur noted, the big difference is when you need to change the data (IPv4 address) of the A record. In the first case you will need to change it as many times as you have records for it where in the second case you will need to change it only once, and all other records having a CNAME pointing to www.example.net will get automatically updated.
CNAME have their drawbacks too: they can influence performance, you need to avoid chains of them and even more loops, they can not be used everywhere in the same way as a name in an A record, etc.
So it is a compromise.
But there is another case to take into account: if you are the administrator of example.com but not of example.net. ExampleNET Inc. could be a big hosting company, or a CDN. You want to use their services for your www.example.com website. If they give you an A record to put in your zone they have the problem that they will basically never be able to change it if they need because all their clients will have its current value hardcoded in all their zonefiles, so that is a big problem against agility, and sometimes you need to be able to renumerate in an hurry, like during a DDOS attack.
Instead if they advise you to do a CNAME, they would be free to change their A record without anything else having anything to do and with the results "immediately" applied to everyone.
This is a very common case, specifically for CDN.
Among many others see this live example when asking for www.microsoft.com:
;; ANSWER SECTION:
www.microsoft.com. 3600 IN CNAME www.microsoft.com-c-3.edgekey.net.
www.microsoft.com-c-3.edgekey.net. 20499 IN CNAME www.microsoft.com-c-3.edgekey.net.globalredir.akadns.net.
www.microsoft.com-c-3.edgekey.net.globalredir.akadns.net. 3600 IN CNAME e13678.dspb.akamaiedge.net.
e13678.dspb.akamaiedge.net. 3600 IN A 23.67.120.106
(of course advanced setups can also be enable for load-balancing and/or fail-over and/or varying the result based on the geography of the source).
This is not the only way to do it (for example, instead, they could have asked you to change the authoritative nameservers for your example.com zone so that they could control it), and it has limits too (the most important one being the one outlined at the beginning: you could not put a CNAME at apex so if you wanted also a website on http://example.com/ (note the lack of www) you would need other solutions).

I think media.com could have different sub-domains under the actual domain, for example - www.media.com, ftp.media.com, mud.media.com these are some of the sub-domains under media.com. Each and every sub-domain will have a different IP address also, so if we just point it to media.com A 210.23.25.32, it won't be able to resolve the full query that the user needs.

Related

How to return the same DNS records for all domains?

I have a random number of domains (sub.client1.example, sub.client2.example, etc.) that I ask my clients to delegate to my name servers through a NS record.
The configuration for every delegated domain should be exactly the same (a CNAME to a fixed domain that we own and a record for SSL validation).
How to configure my DNS servers to accept requests for any domain name and return the correct configuration for it? Is there a hosted service like Route53 or DynDNS that would provide vanity name servers with support for that use case?
You are not saying with which nameservers.
With most of them, like Bind, you can write your zonefile in such a way that the domain name itself does not appear in the labels.
Basically you write www CNAME www.whatever.example and the missing dot at the end of www forces the nameserver to automatically add the domain name.
So with a zonefile written like that, you can configure your nameserver for all domain names it should be authoritative on and use that same exact zonefile.
This is one among many other options.
To be a little more on-topic for this programming Q&A website you could also:
use a nameserver that allows to use as source, instead of a static text file, content of a database (that some program of yours could fill in) or even directly a program that will get called to reply to each DNS packet
use some templating mechanism and some program to build all zonefile text files from other sources (like a database) before starting the nameserver.
Note that the first case with a "generic" zonefile text file is by far the easiest so that should be your first try.
Of course various providers on line could give you the same features more or less, starting with your registrar that could give you DNS hosting also. But it is also achievable by yourself if you agree to install and maintain a nameserver.
Also, you do not need any vanity server to do all of that, and I recommend you to just not follow that leads as it will not give you any kind of benefit.

Why does getaddrinfo sometimes behave differently with "example.com" and "www.example.com"?

This is a code example from MSDN: getaddrinfo.
You can use "baidu.com" and "www.baidu.com" to test.
Because baidu.com and www.baidu.com are different addresses!
www.example.com is registered in DNS with an A type record (or a CNAME, which points to an A record - this is slightly simplified) An A record is a name, in this case www that points to an IP Address 12.34.56.78. (as I'm sure you already know!)
example.com can also have an A record registered (though not a CNAME) this is called the Apex (or naked!) domain. example.com's A record could very well point to 123.45.67.89
A little history
Part of the reason that this came about, is that in the early days of the internet, a server would have a hostname of something like LOCUS.UC.EDU because it can be difficult to know what services LOCUS might provide. you could attach the CNAME FTP.UC.EDU to point to that machine. that way people knew what services it offered. at that point, www was just another service, it had no special place in the collective consciousness. (all of this was happening over the decade or two that the internet was developing!) but you could also quite probably want bob#UC.EDU to work. so UC.EDU needed to be a host name also
In actual fact it started with just the hostname (and host records that got telexed - I do love that fact) - but we'll ignore that for this case.
back to the facts
What usually - should - happen is that there is an A record registered at the Apex and a CNAME registered at www But there is certainly no requirement for this and you can have whatever records you wish at your domain.

What's the English words for "pan domain name"? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
the main domain is www.abc.com
I use the DNS to set all sub-domains *.abc.com point to the www.abc.com.
How to say this in english?
I find the wikis, is it correct for 'pan-domain name resolving'
Wildcard DNS records Main article:
Wildcard DNS record The domain name
system supports wildcard domain names
which are names that start with the
asterisk label, '*', e.g.,
*.example.[3][17] DNS records belonging to wildcard domain names
specify rules for generating resource
records within a single DNS zone by
substituting whole labels with
matching components of the query name,
including any specified descendants.
For example, in the DNS zone
x.example, the following configuration
specifies that all subdomains
(including subdomains of subdomains)
of x.example use the mail exchanger
a.x.example. The records for
a.x.example are needed to specify the
mail exchanger. As this has the result
of excluding this domain name and its
subdomains from the wildcard matches,
all subdomains of a.x.example must be
defined in a separate wildcard
statement. The role of wildcard
records was refined in RFC 4592,
because the original definition in RFC
1034 was incomplete and resulted in
misinterpretations by
implementers.[17]
Wildcard DNS record
I think this the computer-specific term which I searched for.
I want to build a wildcard dns resolving in my local-network for windows environment...
I'm search for a tutorial....
Any suggestions?
Thanks for your reply!
I think you're looking for wildcard DNS records.
http://en.wikipedia.org/wiki/Wildcard_DNS_record
I don't understand exactly what you mean. You could set CNAME records on them and point it to www.abc.com, but I don't know if that's what you mean.

DNS two domains one server

Greetings All,
Long time reader first time poster.
I work for a small school district. We are our own SOA so we can pretty much do what we want.
In the state of Washington all educational institutions are given a name like myschools.wednet.edu. I've recently purchased a new and hopefully easier to remember domain myschools.org and I'd like to use both domains and have them point to the same information and subdomains i.e. helpdesk.myschools.org would equal helpdesk.myschools.wednet.edu. I'd also like this to work with e-mail but I think this is a bit more complicated.
I'm sure this has been done, but I'm not entirely sure I'm asking the question in a way that can be easily answered.
Any and all help is appreciated.
TIA,
Dave
To do this, you'll have multiple DNS record entries (A-Recs) pointing to the same IP Address. You may also need to tweak IIS (or your web server software) to accept requests coming from both domains.
So...in your DNS manager (e.g. in Register.com or whereever you manage your domains) change the A-Rec to point myschools.org (your domain) to the same server IP address where myschools.wednet.edu is currently pointed (I take it that you told them where to point the subdomain).
If you are using IIS then setting up multiple domains on one web site is easy. You'll create just one web site (or use the one to which wednet.edu points). Next, right-click the web site in IIS and choose Properties. On the "Web Site" tab, click "Advanced" and in the resulting dialog, use the "Add" button to add your additional domains/subdomains. That's all you'll need to do.
Hope this helps!
If you want lots of subdomain entries to map from one domain to the other then you'll need to either add A or CNAME records in the new domain pointing to the old domain.
In most cases I'd recommend a CNAME, however if you want the unadorned "myschools.org" domain to respond to HTTP requests that would have to be an A record, because you can't put in a CNAME at the top level of a zone.
Alternatively, there's a relatively new DNS record type called DNAME which can map an entire domain to another in one fell swoop. Unfortunately it's not widely supported yet.
All you should do is create two 'A' records, one of host-type '#' and the other one of host-type 'www' both should point to the IP address of your server.
It could be a bit confusing, here's an example of how to set it up #GoDaddy's:

How do I get a list of all subdomains of a domain? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative Nameserver with the following option:
dig #ns1.foo.example example.com axfr
But this never works. Has anyone a better idea/approach
The hint (using axfr) only works if the NS you're querying (ns1.foo.example in your example) is configured to allow AXFR requests from the IP you're using; this is unlikely, unless your IP is configured as a secondary for the domain in question.
Basically, there's no easy way to do it if you're not allowed to use axfr. This is intentional, so the only way around it would be via brute force (i.e. dig a.example.com, dig b.example.com, ...), which I can't recommend, as it could be viewed as a denial of service attack.
If you can't get this information from DNS (e.g. you aren't authorized) then one alternative is to use Wolfram Alpha.
Enter the domain into the search box and run the search. (E.g. stackexchange.com)
In the 3rd section from the top (named "Web statistics for all of stackexchange.com") click Subdomains
In the Subdomains section click More
You will be able to see a list of sub-domains there. Although I suspect it does not show ALL sub-domains.
You can use:
$ host -l example.com
Under the hood, this uses the AXFR query mentioned above. You might not be allowed to do this though. In that case, you'll get a transfer failed message.
dig example.com soa
dig #ns.SOA.example example.com axfr
robotex tools which are free will let you do this but they make you enter the ip of the domain first:
find out the ip (there's a good ff plugin which does this but I can't post the link cos this is my first post here!)
do an ip search on robotex: http://www.robtex.com/ip/
in the results page that follows click on the domain you're interested in>
you are taken to a page that lists all subdomains + a load of other information such as mail server info
You can only do this if you are connecting to a DNS server for the domain -and- AXFR is enabled for your IP address. This is the mechanism that secondary systems use to load a zone from the primary. In the old days, this was not restricted, but due to security concerns, most primary name servers have a whitelist of: secondary name servers + a couple special systems.
If the nameserver you are using allows this then you can use dig or nslookup.
For example:
#nslookup
>ls example.com
NOTE: because nslookup is being deprecated for dig and other newere tools, some versions of nslookup do not support "ls", most notably macOS X's bundled version.
In Windows nslookup the command is
ls -d example.com > outfile.txt
which stores the subdomain list in outfile.txt
few domains these days allow this
If the DNS server is configured properly, you won't be able to get the entire domain. If for some reason is allows zone transfers from any host, you'll have to send it the correct packet to make that request. I suspect that's what the dig statement you included does.

Resources