测试使用dnsmasq。
/etc/dnsmasq.d ###目录下#Enable forward lookup of the ‘consul‘ domain:server=/consul/127.0.0.1#8600#Uncomment and modify as appropriate to enable reverse DNS lookups for# common netblocks found in RFC 1918,5735, and 6598:#rev-server=0.0.0.0/8,127.0.0.1#8600#rev-server=10.0.0.0/8,127.0.0.1#8600#rev-server=100.64.0.0/10,127.0.0.1#8600#rev-server=127.0.0.1/8,127.0.0.1#8600#rev-server=169.254.0.0/16,127.0.0.1#8600#rev-server=172.16.0.0/12,127.0.0.1#8600#rev-server=192.168.0.0/16,127.0.0.1#8600#rev-server=224.0.0.0/4,127.0.0.1#8600#rev-server=240.0.0.0/4,127.0.0.1#8600#Accept DNS queries only from hosts whose address is on a local subnet.#local-service#Don‘t poll /etc/resolv.conf for changes.#no-poll#Don‘t read /etc/resolv.conf.Get upstream servers only from the command# line or the dnsmasq configuration file (see the "server" directive below).#no-resolv#Specify IP address(es) of other DNS servers for queries not handled# directly by consul.There is normally one ‘server‘ entry setfor every#‘nameserver‘ parameter found in ‘/etc/resolv.conf‘.See dnsmasq(8)‘s#‘server‘ configuration option for details.#server=1.2.3.4#server=208.67.222.222#server=8.8.8.8#Set the size of dnsmasq‘s cache.Thedefault is 150 names.Setting the# cache size to zero disables caching.#cache-size=65536原文:http://www.cnblogs.com/rongfengliang/p/6380103.html