dnsmasq
docker: https://hub.docker.com/r/jpillora/dnsmasq/
vim /opt/dnsmasq.conf#dnsmasq config, for a complete example, see:# http://oss.segetech.com/intra/srv/dnsmasq.conf#log all dns querieslog-queries#dont use hosts nameserversno-resolv#use google as default nameserversserver=8.8.4.4server=8.8.8.8#serve all .company queries using a specific nameserverserver=/company/10.0.0.1#explicitly define host-ip mappingsaddress=/myhost.company/10.0.0.2docker run --name dnsmasq -d -p 53:53/udp -p 5380:8080 -v /opt/dnsmasq.conf:/etc/dnsmasq.conf \-e "HTTP_USER=ushare" -e "HTTP_PASS=usharednsmasq" --restart always jpillora/dnsmasq
BlackholeJ
简介
基于Java的dns服务器, 配置简单, 即插即用.
http://code4craft.github.io/blackhole/
安装
curl http://code4craft.github.io/blackhole/install.sh | sh
配置
前置操作:
关防火墙
关selinux
关bind9
逐个添加想要配置的域名和对应的ip即可, 支持通配符
sudo vim /usr/local/blackhole/config/zones
运行/停止
sudo /usr/local/blackhole/blackhole.sh start|stop
自动启动
添加service配置
sudo vim /lib/systemd/system/blackhole.service # Ubuntusudo vim /usr/lib/systemd/system/blackhole.service # Centos
输入配置如下:
[Unit]Description=BlackHoleJ Domain Name ServerDocumentation=man:named(8)After=network.target[Service]ExecStart=/usr/local/blackhole/blackhole.sh startExecReload=/usr/local/blackhole/blackhole.sh reloadExecStop=/usr/local/blackhole/blackhole.sh stopType=forkingKillMode=processRestart=on-failureRestartSec=42s[Install]WantedBy=multi-user.target
然后执行
sudo systemctl enable blackhole.servicesudo systemctl start blackhole.service
