今天要实现一个爬虫,需要将所有的域名都解析到本地地址,比如 127.0.0.1
或者 192.168.x.x
翻了一下,发现很简单,只要添加以下语句即可
把某些后缀类型的域名解析到本地,比如 com
,只要将以下代码添加到 /etc/dnsmasq.conf
中
# Add domains which you want to force to an IP address here. # The example below send any host in double-click.net to a local # web-server. address=/com/192.168.2.1 address=/uk/192.168.2.1 address=/org/192.168.2.1 address=/gov/192.168.2.1 address=/net/192.168.2.1 address=/us/192.168.2.1
如果是所有域名解析到本地,则只要
address=/#/192.168.2.1
目前尚无回复