安装Coredns
#
wget https://github.com/coredns/coredns/releases/download/v1.14.3/coredns_1.14.3_linux_amd64.tgz
tar -zxvf coredns_1.14.3_linux_amd64.tgz
rm coredns_1.14.3_linux_amd64.tgz
mv coredns /bin/
cat > /etc/dns.conf << 'EOF'
.:53 {
acl {
allow net 120.0.0.0/8
drop
}
hosts {
14.103.224.46 yun.mm
127.0.0.1 x.mm
10.0.0.1 1.mm
10.0.0.2 2.mm
10.0.0.3 3.mm
10.0.0.4 4.mm
10.0.0.5 5.mm
10.0.0.6 6.mm
10.0.0.7 7.mm
10.0.0.8 8.mm
10.0.0.9 9.mm
10.0.0.10 10.mm
10.0.0.209 209.mm
10.0.0.221 221.mm
10.0.0.222 222.mm
fallthrough
}
forward . 223.5.5.5
log . "from:{remote} domain:{name}"
}
fi
EOF
快速启动(打印时间)
#
dns() {
(coredns -conf /etc/dns.conf 2>&1 | while IFS= read -r line; do
printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"
done >> coredns.log) </dev/null &
disown
}