日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

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

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
使用Dnsmasq搭建DNS服務(wù)器具體方法

搭建一個(gè)屬于自己的本地DNS服務(wù)器很有必要,本篇文章將使用Dnsmasq為大家演示一下搭建DNS服務(wù)器具體方法。

img

一、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)聽(tīng)地址

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開(kāi)機(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,第一次是沒(méi)有緩存,所以時(shí)間是200多

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

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

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


本文標(biāo)題:使用Dnsmasq搭建DNS服務(wù)器具體方法
分享地址:http://www.5511xx.com/article/dhpgpss.html