Как вынудить nm-инструмент обновить свои серверы DNS

Так как ваш ожидаемый скрипт находится в нетокшеном Heredoc, ваша ожидаемая переменная обрабатывается как переменная оболочки. Изменить

puts "The output is $expect_out(buffer) "

на

puts "The output is \$expect_out(buffer) "

Высюда выхода, ( Выход (буфер) ) - это именно то, что я ожидаю: Shell расширяется $ ende_out , чтобы ничего до вручение скрипта, чтобы ожидать.

0
14.04.2015, 17:09
1 ответ

My ] /etc/dhcp/dhclient.conf Файл использует следующую конфигурацию, обратите внимание на строку

 # Configuration file for /sbin/dhclient, which is included in Debian's
#   dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
#   man page for more information about the syntax of this file
#   and a more comprehensive list of the parameters understood by
#   dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
#   not leave anything out (like the domain name, for example), then
#   few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

#send host-name "andare.fugue.com";
send host-name = gethostname();
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
supersede domain-name-servers 208.67.222.222,208.67.220.220,8.8.8.8;
# prepend domain-name-servers 208.67.222.222,208.67.220.220;
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    dhcp6.name-servers, dhcp6.domain-search,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers,
    dhcp6.fqdn, dhcp6.sntp-servers;

, а вот выход NM-Tool, который подтверждает мои DNS-серверы

$ nm-tool | awk '/DNS/ {print $2}'                                                                                      
208.67.222.222
208.67.220.220
8.8.8.8

, возможно, что Также помогает в том, что в моем /etc/networkmanager/networkmanager.conf у меня есть строка DNS = DNSMAMSQ выкомпленна, чтобы сетевой менеджер не использует плагин dnsmasq

В дополнение к этому методу я также написал сценарий для автоматизации обновления DNS для каждого соединения, что является чем-то, что можно использовать в качестве альтернативы, но идея все еще одна - игнорировать DNS, предоставляемые DHCP, используй свой собственный. Детали здесь: https://unix.stackexchange.com/a/164728/85039

1
28.01.2020, 02:51

Теги

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