The Internet, sometimes called simply the Net, is a worldwide system of computer networks and a distributed system .We use a web browser to accesses the internet from computer or mobile. But what happens when we writes simply such as www.yahoo.com. Generally we can identify www.yahoo.com as a hostname. Internet hostnames are composed of parts separated by dots. A domain is a collection of machines that share a common name suffix like .com, .org, .net & .bd. They define as Top Level Domain (TLD).
When domain are added with another part separated by dot called subdomain like .yahoo.com. Totally www.yahoo.com is a hostname & now at present www is replaced by mail or another different word. Every hostname has different IP address of 32 bits. It is impossible to memorize the IP address for different hostnames but each host establishes a connection to another host by only IP address. The whole network of programs and databases that cooperates to translate hostnames to IP addresses is called DNS (Domain Name System).
Each domain is defined by an authoritative name server that knows the IP addresses of the other machines in the domain. The nameservers for a domain do not have to know the locations of all the machines in other domains (including their own subdomains); they only have to know the location of the nameservers. In our example, the authoritative name server for the .com domain knows the IP address of the nameserver for .yahoo.com but not the address of all the other machines in .yahoo.com.
The domains in the DNS system are arranged like a big inverted tree. At the top are the root servers. Everybody knows the IP addresses of the root servers; they're wired into your DNS software. The root servers know the IP addresses of the nameservers for the top-level domains like .com and .org, but not the addresses of machines inside those domains. Each top-level domain server knows where the nameservers location.
So when we writes www.yahoo.com, first nameserver asks a root server to tell it where it can find a nameserver for .com. Once it knows that, it then asks the .com server to tell it the IP address of a .yahoo.com nameserver. Once it has that, it asks the .yahoo.com nameserver to tell it the address of the host www.yahoo.com. Finally we can browse the page.