custom-dns-for-internal-network

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

#intall
apt-get install dnsmasq -y 
# yum install dnsmasq -y

#start & autostart
systemctl start dnsmasq
systemctl enable dnsmasq

conf

#/etc/dnsmasq.conf 
resolv-file=/etc/resolv.dnsmasq.conf
strict-order
listen-address=192.168.2.121,127.0.0.1

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

# /etc/resolv.dnsmasq.conf
cp /etc/resolv.conf /etc/resolv.dnsmasq.conf
echo 'nameserver 119.29.29.29' > /etc/resolv.dnsmasq.conf

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

restart & test

# restart
systemctl restart dnsmasq

# check status
netstat -tunlp|grep 53

# ping test
ping baidu.com

more

# nslookup an domain(not exist) & get the ip
bogus-nxdomain={ip}

# speedup
server=/cn/114.114.114.114
server=/taobao.com/114.114.114.114
server=/taobaocdn.com/114.114.114.114

# foreign
server=/google.com/223.5.5.5

# block ads
address=/ad.youku.com/127.0.0.1
address=/ad.iqiyi.com/127.0.0.1

# redirect site
address=/freehao123.com/123.123.123.123

Refer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值