What is Domain name server ?
Domain name server is a server which converts the human readable domain-names into numeric IP addresses .
There exists basically two namespaces in Domain name system :
1 . The Human readable domain names . Ex : www.google.com
2 . The Numeric IP addresses which is used to locate the computer in the network.
Ex : 209.85.231.104
DNS Resolution :
Whenever you type the domain name in the address bar of the browser, the domain name is sent to a DNS where the mapping of the two namespaces takes place , wherein the domain names are mapped onto the numeric IP addresses for looking up the computer with that particular IP address in the network.
resolv.conf :
It is the name of the computer file found in many of the operating systems which is used to configure domain name system resolver libraries.The resolv.conf file typically contains directives with the IP addresses of nameservers available to a host .
Usually this file is located in /etc directory in most Unix systems.
DNS Lookup utilities :
These are the utilities basically used to interrogate DNS name servers.
Three most Flexible utilities for DNS lookup are :
1 : nslookup.
2 : dig ( Domain Information Groper ).
3 : host
nslookup :
Used to query the Internet name servers .
Syntax : nslookup [-option] [name | - ] [server]
nslookup basically works in two modes :
1 : Interactive Mode : This mode is activated when you type nslookup without arguments . A > prompt appears for interactively querying the name server .
Ex : nslookup
> server 8.6.6.6
2 : Non Interactive Mode : This mode comes into picture when you enter nslookup with arguments .
Ex : nslookup www.google.com
Server: 202.56.230.5
Address: 202.56.230.5#53
Non-authoritative answer:
www.google.com canonical name = www.l.google.com.
Name: www.l.google.com
Address: 209.85.231.104
The Java Code which achieves the same task as nslookup is given below :
import java.net.*;
public class IP {
public static void main(String[] args) throws Exception {
System.out.println(InetAddress.getLocalHost());
System.out.println(InetAddress.getByName("www.facebook.com"));
}
}
The Java code above queries the name server to resolve human readable www.facebook.com to numerical IP address 66.220.147.11 .
There are many options which can be used for effectively quering the DNS . Check out the manual page for nslookup for further details.
dig ( Domain information groper )
Syntax : dig @server name type
server is the IP address or the name of the name server .
name is the name of resource record to be looked up.
type is the type of query required Ex :ANY , MX etc
Is also used to query the DNS . It performs DNS lookups and returns the output given by the name servers . It is the most flexible tool used by most of the network administrators for troubleshooting the problems in DNS resolution . It is also most used DNS lookup utility because of its clarity of output. It has indeed got a huge set of options for memory debugging ,selection of specific family of protocols and much more . Consult the man page for more details .
Ex : dig MX wikimedia.org @ns0.wikimedia.org
;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4548 ;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;wikimedia.org. IN MX ;; ANSWER SECTION: wikimedia.org. 3600 IN MX 10 mchenry.wikimedia.org. wikimedia.org. 3600 IN MX 50 lists.wikimedia.org. ;; ADDITIONAL SECTION: mchenry.wikimedia.org. 3600 IN A 208.80.152.186 lists.wikimedia.org. 3600 IN A 91.198.174.5 ;; Query time: 479 msec ;; SERVER: 208.80.152.130#53(208.80.152.130) ;; WHEN: Sun Feb 13 12:23:26 2011 ;; MSG SIZE rcvd: 109
As we can see the Output is more clear .
host :
Syntax : host [-options] [server ]
Host is the most simple utility for DNS lookups .It is used to convert names into IP addresses and vice versa .
Ex : host www.google.com
www.google.com is an alias for www.l.google.com.
www.l.google.com has address 209.85.231.104
www.l.google.com is an alias for www-notmumbai.l.google.com.
These are the tools which are used for DNS lookups which are usually used by Network Administrators to troubleshoot the problems in DNS .
For any queries , suggestions , comments do fell free to leave a comment or mail me at rajeevrvis@gmail.com
No comments:
Post a Comment