首先說一下我的環(huán)境
10多年的紫金網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。網(wǎng)絡(luò)營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整紫金建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“紫金網(wǎng)站設(shè)計(jì)”,“紫金網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
centos 6.7
[root@oldboy ~]# uname -r
2.6.32-573.el6.x86_64
在安裝DNSmasq之前,請為本機(jī)配置靜態(tài)ip
[root@oldboy ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.10.253
NETMASK=255.255.255.0
GATEWAY=192.168.10.2
[root@oldboy ~]# ifconfig eth0|sed -n '2p'
inet addr:192.168.10.253 Bcast:192.168.10.255 Mask:255.255.255.0
首先保證能夠上網(wǎng)
[root@oldboy ~]# ping www.baidu.com -c 4
PING www.a.shifen.com (61.135.169.121) 56(84) bytesof data.
64 bytes from 61.135.169.121: icmp_seq=1 ttl=128time=4.14 ms
64 bytes from 61.135.169.121: icmp_seq=2 ttl=128time=16.6 ms
64 bytes from 61.135.169.121: icmp_seq=4 ttl=128time=20.5 ms
[root@oldboy ~]# yum install dnsmasq -y
已加載插件:fastestmirror, security
設(shè)置安裝進(jìn)程
Loading mirror speeds from cached hostfile
* base:mirrors.aliyun.com
* extras:mirrors.aliyun.com
* updates:mirrors.aliyun.com
解決依賴關(guān)系
-->執(zhí)行事務(wù)檢查
---> Package dnsmasq.x86_64 0:2.48-16.el6_7 willbe安裝
-->完成依賴關(guān)系計(jì)算
依賴關(guān)系解決
=========================================================================
軟件包 架構(gòu) 版本 倉庫 大小
=========================================================================
正在安裝:
dnsmasq x86_64 2.48-16.el6_7 updates 149 k
事務(wù)概要
=========================================================================
Install 1 Package(s)
總下載量:149 k
Installed size: 293 k
下載軟件包:
dnsmasq-2.48-16.el6_7.x86_64.rpm | 149 kB 00:06
運(yùn)行 rpm_check_debug
執(zhí)行事務(wù)測試
事務(wù)測試成功
執(zhí)行事務(wù)
正在安裝 : dnsmasq-2.48-16.el6_7.x86_64 1/1
Verifying :dnsmasq-2.48-16.el6_7.x86_64 1/1
已安裝:
dnsmasq.x86_64 0:2.48-16.el6_7
完畢!
編輯[root@oldboy ~]# vim /etc/dnsmasq.conf
只需修改兩處
修改90行
listen-address=127.0.0.1,192.168.10.253
192.168.10.253為本機(jī)ip,客戶機(jī)的dns地址
修改432行
cache-size=10000
設(shè)置dns緩存,緩存大小,按需設(shè)置
[root@oldboy ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search localdomain
nameserver 223.5.5.5
nameserver 202.106.46.151
223.5.5.5為阿里dns
202.106.46.151.為當(dāng)?shù)剡\(yùn)營商的dns,這里自行添加,指定上游的dns即可
接下來,啟動(dòng)服務(wù),并設(shè)置為開機(jī)自啟動(dòng)
[root@oldboy ~]# /etc/init.d/dnsmasq start
Starting dnsmasq: [確定]
[root@oldboy ~]# chkconfig --level 3 dnsmasq on
[root@oldboy ~]# chkconfig --list|grep dnsmasq
dnsmasq 0:關(guān)閉 1:關(guān)閉 2:關(guān)閉 3:啟用 4:關(guān)閉 5:關(guān)閉 6:關(guān)閉
[root@oldboy ~]#
設(shè)置客戶端dns為我們的dnsmasq服務(wù)器地址,并測試
注意兩次;; Query time: 20 msec兩次時(shí)間間隔
[root@oldboy ~]# dig www.baidu.com
; <<>> DiG9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status:NOERROR, id: 16078
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY:0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 98 IN CNAME www.a.shifen.com.
www.a.shifen.com. 98 IN A 61.135.169.121
www.a.shifen.com. 98 IN A 61.135.169.125
;; Query time: 20 msec
;; SERVER: 223.5.5.5#53(223.5.5.5)
;; WHEN: Sat Apr 9 14:36:15 2016
;; MSG SIZE rcvd: 90
[root@oldboy ~]# dig www.baidu.com
; <<>> DiG9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status:NOERROR, id: 56741
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY:0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 196 IN CNAME www.a.shifen.com.
www.a.shifen.com. 196 IN A 61.135.169.125
www.a.shifen.com. 196 IN A 61.135.169.121
;; Query time: 0 msec
;; SERVER: 192.168.10.253#53(192.168.10.253)
;; WHEN: Mon Apr 11 22:37:56 2016
;; MSG SIZE rcvd: 93