日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Linux下使用DNSmasq建本地DNS服務(wù)器

DNSmasq是一個(gè)小巧且方便地用于配置DNS和DHCP的工具,適用于小型網(wǎng)絡(luò),它提供了DNS功能和可選擇的DHCP功能。它服務(wù)那些只在本地適用的域名,這些域名是不會(huì)在全球的DNS服務(wù)器中出現(xiàn)的,下面為大家詳細(xì)講解一下Linux下使用DNSmasq建本地DNS服務(wù)器具體方法。

創(chuàng)新互聯(lián)專注于珠海網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供珠海營銷型網(wǎng)站建設(shè),珠海網(wǎng)站制作、珠海網(wǎng)頁設(shè)計(jì)、珠海網(wǎng)站官網(wǎng)定制、小程序制作服務(wù),打造珠海網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供珠海網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

一、Dnsmasq安裝

安裝并啟動(dòng)Dnsmasq

yum install -y dnsmasq
service dnsmasq start

二、Dnsmasq配置

1、Dnsmasq的配置文件路徑為:/etc/dnsmasq.conf

# ll -d /etc/dnsmasq.conf
-rw-r--r-- 1 root root 21237 Feb 23 00:17 /etc/dnsmasq.conf

2、編輯/etc/dnsmasq.conf

resolv-file=/etc/resolv.dnsmasq.conf    //dnsmasq 會(huì)從這個(gè)文件中尋找上游dns服務(wù)器
strict-order             //去掉前面的#
addn-hosts=/etc/dnsmasq.hosts         //在這個(gè)目里面添加記錄
listen-address=127.0.0.1,192.168.1.123     //監(jiān)聽地址

3、修改/etc/resolv.conf

echo 'nameserver 127.0.0.1' > /etc/resolv.conf

4、創(chuàng)建resolv.dnsmasq.conf文件并添加上游dns服務(wù)器的地址

touch /etc/resolv.dnsmasq.conf
echo 'nameserver 119.29.29.29' > /etc/resolv.dnsmasq.conf

5、創(chuàng)建dnsmasq.hosts文件

cp /etc/hosts /etc/dnsmasq.hosts
echo 'addn-hosts=/etc/dnsmasq.hosts' >> /etc/dnsmasq.conf

提示:resolv.dnsmasq.conf中設(shè)置的是真正的Nameserver,可以用電信、聯(lián)通等公共的DNS。

三、Dnsmasq啟動(dòng)

1、設(shè)置Dnsmasq開機(jī)啟動(dòng)并啟動(dòng)Dnsmasq服務(wù):

chkconfig dnsmasq on
/etc/init.d/dnsmasq restart

2、netstat -tunlp|grep 53 查看Dnsmasq是否正常啟動(dòng):

# netstat -tlunp|grep 53
tcp        0      0 0.0.0.0:53                  0.0.0.0:*                   LISTEN      2491/dnsmasq        
tcp        0      0 :::53                       :::*                        LISTEN      2491/dnsmasq        
udp        0      0 0.0.0.0:53                  0.0.0.0:*                               2491/dnsmasq        
udp        0      0 :::53                       :::*                                    2491/dnsmasq        

3、dig www.freehao123.com,第一次是沒有緩存,所以時(shí)間是200多

使用Dnsmasq搭建本地dns服務(wù)器上網(wǎng)使用Dnsmasq搭建本地dns服務(wù)器上網(wǎng)

4、第二次再次測試,因?yàn)橐呀?jīng)有了緩存,所以查詢時(shí)間已經(jīng)變成了0.

使用Dnsmasq搭建本地dns服務(wù)器上網(wǎng)使用Dnsmasq搭建本地dns服務(wù)器上網(wǎng)


本文題目:Linux下使用DNSmasq建本地DNS服務(wù)器
網(wǎng)頁路徑:http://www.dlmjj.cn/article/dppigjj.html