Originally posted by sarah Marsh:
are you sure it's 'dig' on UNIX?
That depends on your Unix flavour. If dig doesn't work, try nslookup.
Originally posted by Fred Dez:
how does 'www.javaranch.com' gets mapped to the IP address? and where are all the DNS servers installed?
The mapping, in itself, is the easy bit. It works a bit like a Java "Map".
A bit.
A
tiny bit.
There are millions of people connected to the net at any given time. The number of hostnames is, I don't know, millions as well I guess. No single DNS server can take that load. No single DNS server can know all hostnames (and its information would be obsolete if it tried). For that reason, DNS is organised broadly as a huge, hierarchical, distributed database.
When your computer connects to the internet, it asks your ISP for some vital information using DHCP, such as your IP address and (drum roll) the DNS server to use.
Your provider -- let's call him yourprovider.com -- will generally have one or more DNS servers for its customers. The provider will use that DNS server to manage the name/IP mappings for the yourprovider.com domain. When you ask for for mail.yourprovider.com, the DNS server can go straight to the local configuration file and find the corresponding IP.
When you ask for
www.javaranch.com, one of two things will happen. The most likely option is that someone else on your provider has visited the ranch some time earlier, and the server will still know the IP: it's
cached. But if not, it will delegate the lookup to the next level of DNS servers that it, in turn, is connected to.
Ultimately it might end up at the server for the .com
top-level domain (TLD); this server would not necessarily know about "www.javaranch.com" but it would be able to tell which DNS server manages the "javaranch.com" domain, so the query can go there.
There's a whole hierarchy of DNS servers, from company servers managing domains such as provider.com through TLD servers (eg .com) to the thirteen (? or thereabouts)
root servers that manage the root zone. The root servers answer the question "where do I go to resolve a .com domain"?
Because caching is used at all levels to distribute the enormous load as evenly as possible, DNS configuration changes take a long time to propagate everywhere. This can be very painful -- you may have heard about
the DNS problem at the Microsoft Update servers a while back.
Finally, whoever maintains DNS servers wields power. The highest levels (TLDs and root) wield a LOT of power, turn over a LOT of money, and their management is fraught with sometimes rather
distasteful politics,
games and
power struggles. When you buy the freddez.com domain, all you actually buy is an entry in the .com TLD server, paying $20 a year or so for the privilege. Try to imagine how many .com domains there are, do the maths, and try to imagine all the companies queuing up for such a license to print money. (Of course, it's not
quite as simple as that, but it comes too close for comfort.)
- Peter
[ December 20, 2002: Message edited by: Peter den Haan ]