Как осуществить dnsmasq для использования восходящего сервера DNS только для некоторых указанных доменных имен?

Необходимо будет добавить запись CNAME в зону DNS. Однако Вы, возможно, должны были бы скорректировать некоторый вход в систему в своем коде, если зависящий от требуемого хоста, вызовете свои сценарии, то не будет видеть sub1.mysite.com, но sub1.com, поэтому корректировать их соответственно для обработки обоих случаев.

15
задан 8 May 2018 в 18:11
1 ответ

You can do this by using the server= directive e.g.

server=/ajax.googleapis.com/8.8.8.8

would query the google public DNS server for the ajax.googleapis.com domain, similarly

server=/amazonaws.com/209.244.0.3

would query Level3's public DNS server for the amazonaws.com domain.

You can group multiple domains together

server=/co.uk/com/8.8.4.4

Would send the .co.uk and .com domains to the DNS server at 8.8.4.4

You can have multiple server= directives too

−S, --server=[/[]/[domain/]][[#][@[#]]]

Specify IP address of upstream severs directly. Setting this flag does not suppress reading of /etc/resolv.conf, use -R to do that. If one or more optional domains are given, that server is used only for those domains and they are queried only using the specified server. This is intended for private nameservers: if you have a nameserver on your network which deals with names of the form xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag -S /internal.thekelleys.org.uk/192.168.1.1 will send all queries for internal machines to that nameserver, everything else will go to the servers in /etc/resolv.conf. An empty domain specification, // has the special meaning of "unqualified names only" ie names without any dots in them. A non-standard port may be specified as part of the IP address using a # character. More than one -S flag is allowed, with repeated domain or ipaddr parts as required.

Also permitted is a -S flag which gives a domain but no IP address; this tells dnsmasq that a domain is local and it may answer queries from /etc/hosts or DHCP but should never forward queries on that domain to any upstream servers. local is a synonym for server to make configuration files clearer in this case.

The optional second IP address after the @ character tells dnsmasq how to set the source address of the queries to this nameserver. It should be an address belonging to the machine on which dnsmasq is running otherwise this server line will be logged and then ignored. The query-port flag is ignored for any servers which have a source address specified but the port may be specified directly as part of the source address.

28
ответ дан 2 December 2019 в 20:48

Теги

Похожие вопросы