Local name resolution in linux is done using /etc/hosts file. To configure linux as a DNS client you need to modify /etc/resolv.conf file.
/etc/resolv.conf
This file contains the ip addresses of name server i.e. DNS server. To configure linux as a DNS client open /etc/resolv.conf in any text editor vi, vim, nano, gedit or anything you love. vi or vim is the most loved one but I personally like nano. Its easy to use and have lots of features.
Add your nameservers as follows.
search myisp.com
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 208.67.222.222
search myisp.com: The search list is normally determined from the local domain name; by default, it contains only the local domain name. So when you type nslookup www, it will be matched to www.myisp.com
nameserver 8.8.8.8: Point out to your own nameserver or to ISP's name server. Max 3 name servers may be listed.
Test the setup:
Now lets test the setup. You can use dig and nslookup to test if the name resolutions is working properly.
# dig www.googlinux.com
; <<>> DiG 9.7.0-P1 <<>> www.googlinux.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5151
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.googlinux.com. IN A
;; ANSWER SECTION:
www.googlinux.com. 2472 IN A 97.74.144.149
;; Query time: 88 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Jan 3 22:59:45 2012
;; MSG SIZE rcvd: 51
# nslookup www.googlinux.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: www.googlinux.com
Address: 97.74.144.149
0 comments:
Post a Comment