Faster domain name resolution in linux

Source: Internet
Author: User
Make your linux DNS domain name faster-Linux Enterprise Application-Linux server application information. The following is a detailed description. When I was using LINUX, I felt that the host was being resolved when I opened the website in firefox. Ie is connecting to the host .. What makes us connect to this let point for the first time. The second time I spent less time parsing this domain name. Some may say that history is acceptable. However, I think the history record only records the content of the webpage. Domain names should not be cached .. I use cent OS as an example. Here we will introduce a software package named dnsmasq which may be used for yum installation.

1: yum-y install dnsmasq
2: hash
3: Modify/etc/dnsmasq. conf
Remove # In Front Of listen_address =, and then add the local loopback address 127.0.0.1 to the end of =.
Or add a line at the bottom of the configuration file.
Listen-address = 127.0.0.1
Modify the/etc/resolv. conf file
Change the first dns server to nameserver 127.0.0.1
4: then start the dnsmasq Service

/Etc/rc. d/init. d/dnsmasq start
Chkconfig dnsmasq on

Now I will post the domain name resolution time before dnsmasq is installed and the time used to resolve the domain name after dnsmasq is installed.

Before installing dnsmasq:

Ig baidu.com

; <> DiG 9.2.4 <> baidu.com
; Global options: printcmd
; Got answer:
;-> HEADER <-opcode: QUERY, status: NOERROR, id: 61569
; Flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

; Question section:
; Baidu.com. IN

; Answer section:
Baidu.com. 466 in a 202.108.22.46
Baidu.com. 466 in a 220.181.38.84

; Query time: 40 msec
; SERVER: 202.96.134.133 #53 (202.96.134.133)
; WHEN: Wed Aug 29 21:43:31 2007
; Msg size rcvd: 59

Second Query

[Root @ abc ~] # Dig baidu.com

; <> DiG 9.2.4 <> baidu.com
; Global options: printcmd
; Got answer:
;-> HEADER <-opcode: QUERY, status: NOERROR, id: 58802
; Flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

; Question section:
; Baidu.com. IN

; Answer section:
Baidu.com. 465 in a 202.108.22.46
Baidu.com. 465 in a 220.181.38.84

; Query time: 39 msec
; SERVER: 202.96.134.133 #53 (202.96.134.133)
; WHEN: Wed Aug 29 21:43:32 2007
; Msg size rcvd: 59

Third Query
[Root @ abc ~] # Dig baidu.com

; <> DiG 9.2.4 <> baidu.com
; Global options: printcmd
; Got answer:
;-> HEADER <-opcode: QUERY, status: NOERROR, id: 30773
; Flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

; Question section:
; Baidu.com. IN

; Answer section:
Baidu.com. 464 in a 220.181.38.84
Baidu.com. 464 in a 202.108.22.46

; Query time: 31 msec
; SERVER: 202.96.134.133 #53 (202.96.134.133)
; WHEN: Wed Aug 29 21:43:33 2007
; Msg size rcvd: 59

Fourth
[Root @ abc ~] # Dig baidu.com

; <> DiG 9.2.4 <> baidu.com
; Global options: printcmd
; Got answer:
;-> HEADER <-opcode: QUERY, status: NOERROR, id: 48642
; Flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

; Question section:
; Baidu.com. IN

; Answer section:
Baidu.com. 463 in a 202.108.22.46
Baidu.com. 463 in a 220.181.38.84

; Query time: 43 msec
; SERVER: 202.96.134.133 #53 (202.96.134.133)
; WHEN: Wed Aug 29 21:43:34 2007
; Msg size rcvd: 59


Detected between 30-50 msec

The query speed after dnsmasq is installed


; <> DiG 9.2.4 <> baidu.com
; Global options: printcmd
; Got answer:
;-> HEADER <-opcode: QUERY, status: NOERROR, id: 10817
; Flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

; Question section:
; Baidu.com. IN

; Answer section:
Baidu.com. 6164 in a 202.108.22.46
Baidu.com. 6164 in a 220.181.38.84

; Query time: 2 msec
; SERVER: 127.0.0.1 #53 (127.0.0.1)
; WHEN: Wed Aug 29 22:01:05 2007
; Msg size rcvd: 59

Speed of domain name query after the dnsmasq Service is Disabled

[Root @ abc ~] # Service dnsmasq stop
Shutting down Lightweight caching nameserver (dnsmasq): [OK]
[Root @ abc ~] # Dig baidu.com

; <> DiG 9.2.4 <> baidu.com
; Global options: printcmd
; Got answer:
;-> HEADER <-opcode: QUERY, status: NOERROR, id: 51018
; Flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

; Question section:
; Baidu.com. IN

; Answer section:
Baidu.com. 6122 in a 220.181.38.84
Baidu.com. 6122 in a 202.108.22.46

; Query time: 51 msec
; SERVER: 202.96.134.133 #53 (202.96.134.133)
; WHEN: Wed Aug 29 22:01:47 2007
; Msg size rcvd: 59
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.