Кто-нибудь может объяснить мне насчет dns-search
директива в /etc/network/interfaces
файл:
iface eth0 inet static address 192.168.3.3 netmask 255.255.255.0 gateway 192.168.3.1 dns-search example.com dns-nameservers 192.168.3.45 192.168.8.10
Является ли это обязательным? И как я могу его настроить?
dns-search
определяет, какой домен добавляется для поиска в dns.
Обычно вы указываете здесь тот же домен, который возвращается hostname -f
.
Для получения подробной информации см. Следующую цитату из man resolv.conf
:
search Search list for host-name lookup. The search list is normally determined from the local domain name; by default, it contains only the local domain name. This may be changed by listing the desired domain search path following the search keyword with spaces or tabs separating the names. Resolver queries having fewer than ndots dots (default is 1) in them will be attempted using each component of the search path in turn until a match is found. For environments with multiple subdomains please read options ndots:n below to avoid man-in-the-middle attacks and unnecessary traffic for the root-dns-servers. Note that this process may be slow and will generate a lot of network traffic if the servers for the listed domains are not local, and that queries will time out if no server is available for one of the domains. The search list is currently limited to six domains with a total of 256 characters.
Я также нашел это в README.gz находится в /usr/share/doc/resolvconf в Ubuntu 14.04. Это дает немного больше ясности.
Остерегайтесь того, что файл resolv.conf управляется службой resolvconf.
dns-поиск, по-видимому, является необходимой строкой в строфе логического интерфейса.
3.4 ifupdown * Remove any "up" or "down" commands from /etc/network/interfaces that futz with /etc/resolv.conf and remove any scripts from /etc/network/if-*.d/ that futz with /etc/resolv.conf. * For each inet static logical interface through which a nameserver is accessible, add lines like the following to /etc/network/interfaces . dns-nameservers 11.22.33.44 55.66.77.88 dns-search foo.org bar.com Other recognized option words are 'dns-domain' and 'dns-sortlist'. These option names correspond to the option names used in the resolv.conf file with one exception: whereas one lists several nameserver addresses in /etc/resolv.conf on several "nameserver" lines, here one should list them all on a single "dns-nameservers" line. See resolv.conf(5) for more information. The lines entered in /etc/network/interfaces will be added to the resolver configuration file (without the "dns-" prefix, of course) when a physical interface is brought up as that logical interface. Note that the resolver configuration is updated AFTER all the "up" commands have been run; therefore "up" commands cannot make use of nameservers listed on "dns-nameservers" lines in the same logical interface stanza. Changing this will require modifying ifupdown so that it talks to resolvconf; currently resolvconf hooks into ifupdown using the script /etc/network/if-up.d/000resolvconf. Note too that scripts in /etc/network/if-up.d/ CAN make use of the added nameservers because those scripts run after 000resolvconf.
Я лично отключил это на своем сервере, потому что я использую IPv6, и когда адрес (например. hello.com ) Я пытался подключиться к не поддерживал IPv6, система пыталась разрешить hello.com.example.com " вместо этого, и это дало представление о
example.com в результате (не IPv4-адрес
hello.com "как и ожидалось). Я написал об этом более подробно здесь: http://www.daysleeper.cz/?W-Failed-to-fetch-http-security-ubuntu-com-in-IPv6