是否可以在/ etc / hosts文件中使用轮询DNS?


Answers:


9

dnsmasq包括开箱即用的轮询DNS

> egrep -m1 '^nameserver' /etc/resolv.conf
nameserver 127.0.0.1
> grep -i rrtest /etc/hosts
1.1.1.1 rrtest
2.2.2.2 rrtest
> /etc/init.d/dnsmasq restart 
Shutting down dnsmasq:                                     [  OK  ]
Starting dnsmasq:                                          [  OK  ]
> nslookup rrtest 
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   rrtest
Address: 2.2.2.2
Name:   rrtest
Address: 1.1.1.1

> nslookup rrtest 
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   rrtest
Address: 1.1.1.1
Name:   rrtest
Address: 2.2.2.2

1
dnsmasq只能归档通配符dns或RR dns。如果您需要同时使用这两个功能,则可以使用bind9。
okwap

8

不,那是行不通的。

/ etc / hosts同样是DNS旨在替换的名称->地址映射的原始形式。如果要循环DNS,请安装DNS服务器。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.