for the reason that we need test the func in internal network, we use dnsmasq to set up internal dns.
Tools
ubuntu 14.x/Centos7.x
dnsmasq
Steps
install
#intallapt-get install dnsmasq -y # yum install dnsmasq -y#start & autostartsystemctl start dnsmasqsystemctl enable dnsmasq
conf
#/etc/dnsmasq.conf resolv-file=/etc/resolv.dnsmasq.confstrict-orderlisten-address=192.168.2.121,127.0.0.1# /etc/resolv.confecho 'nameserver 127.0.0.1' > /etc/resolv.conf# /etc/resolv.dnsmasq.confcp /etc/resolv.conf /etc/resolv.dnsmasq.confecho 'nameserver 119.29.29.29' > /etc/resolv.dnsmasq.conf# /etc/dnsmasq.d/dnsmasq.hostscp /etc/hosts /etc/dnsmasq.d/dnsmasq.hostsecho 'addn-hosts=/etc/dnsmasq.d/dnsmasq.hosts' >> /etc/dnsmasq.conf
restart & test
# restartsystemctl restart dnsmasq# check statusnetstat -tunlp|grep 53# ping testping baidu.com
more
# nslookup an domain(not exist) & get the ipbogus-nxdomain={ip}# speedupserver=/cn/114.114.114.114server=/taobao.com/114.114.114.114server=/taobaocdn.com/114.114.114.114# foreignserver=/google.com/223.5.5.5# block adsaddress=/ad.youku.com/127.0.0.1address=/ad.iqiyi.com/127.0.0.1# redirect siteaddress=/freehao123.com/123.123.123.123