27.06.2014, 22:22, "Yunqiang Su" <wzss...@gmail.com>: > On Fri, Jun 27, 2014 at 9:48 PM, Xiang Liu <xian...@yandex.com> wrote: >> 我查看了一下dnsmasq的帮助文档CONFIG FILE一节以及--address选项。我觉得这就是我需要的。 >> 于是我建立了/etc/dnsmasq.conf文件,其中写入了一行作为测试: >> address=/googleapis.com/1.2.3.4 > > 配置文件和命令行格式不一样哈 > man dnsmasq.conf
就是帮助文档告诉我是一样的,只是没有“--”这个前缀。有空我直接上dnsmasq的主页去问问算了 >> 按照man dnsmasq中--server和--address的解释,应该能匹配*.googleapis.com的域名解析工作,但是 >> 我测试中发现没有生效。 >> >> 有哪位对dnsmasq比较熟悉的指导一下呗,谢谢! >> >> 以下是附录: >> ====================== >> CONFIG FILE >> At startup, dnsmasq reads /etc/dnsmasq.conf, if it exists. (On >> FreeBSD, >> the file is /usr/local/etc/dnsmasq.conf ) (but see the -C and >> -7 >> options.) The format of this file consists of one option per >> line, >> exactly as the long options detailed in the OPTIONS section but >> without >> the leading "--". Lines starting with # are comments and ignored. >> For >> options which may only be specified once, the configuration file >> over‐ >> rides the command line. Quoting is allowed in a config file: >> between " >> quotes the special meanings of ,:. and # are removed and the >> following >> escapes are allowed: \\ \" \t \e \b \r and \n. The later >> corresponding >> to tab, escape, backspace, return and newline. >> ===================== >> -A, --address=/<domain>/[domain/]<ipaddr> >> Specify an IP address to return for any host in the >> given >> domains. Queries in the domains are never forwarded and >> always >> replied to with the specified IP address which may be IPv4 >> or >> IPv6. To give both IPv4 and IPv6 addresses for a domain, >> use >> repeated -A flags. Note that /etc/hosts and DHCP leases >> over‐ >> ride this for individual names. A common use of this is to >> redi‐ >> rect the entire doubleclick.net domain to some friendly >> local >> web server to avoid banner ads. The domain specification >> works >> in the same was as for --server, with the additional >> facility >> that /#/ matches any domain. Thus --address=/#/1.2.3.4 >> will >> always return 1.2.3.4 for any query not answered from >> /etc/hosts >> or DHCP and not sent to an upstream nameserver by a more >> spe‐ >> cific --server directive. >> >> 25.06.2014, 15:02, "Yunqiang Su" <wzss...@gmail.com>: >>> 自己在本地用dnsmasq搭一个dns服务器 >>> >>> 2014-06-25 14:58 GMT+08:00 Xiang Liu <xian...@yandex.com>: >>>> 我需要将*.googleapis.com, >>>> *.facebook.net等类似的域名解析到本机,以避免有时候上网因为封禁的原因,网页连接这些域名,非要等到超时后才显示出内容…… >>>> >>>> 编辑/etc/hosts文件似乎只能指定具体的域名,不能进行模式匹配。 >>>> >>>> help…… >>>> >>>> -- >> -- >> ubuntu-zh mailing list >> ubuntu-zh@lists.ubuntu.com >> https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh > > -- > Yunqiang Su > -- > ubuntu-zh mailing list > ubuntu-zh@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh -- ubuntu-zh mailing list ubuntu-zh@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh