私の環境だと、 ubuntu 15.10 におけるデフォルトの resolvconf 設定だと、
頻繁に google.com の名前解決ができなくなる現象が発生した。
これを解決するために、以下を実施した。
- eth0 に固定アドレスを設定
-
/etc/avahi/avahi-daemon.conf
の domain-name の箇所をdomain-name=.alocal
と修正 -
/etc/nsswitch.conf
を修正 -
/etc/NetworkManager/NetworkManager.conf
のdns=dnsmasq
をコメントアウト
eth0 に固定アドレスを設定
eth0 に固定アドレスを設定するようにした。
(/etc/network/interfaces
, /etc/resolvconf/resolv.conf/base
などを設定した)
例:
- /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.11.2
netmask 255.255.255.0
gateway 192.168.11.1
dns-servers 8.8.8.8 8.8.4.4
結果として、 /etc/resolv.conf
が生成される
設定を有効にするには、 resolvconf
コマンドを実行すれば良い。
$ sudo resolvconf -u
/etc/avahi/avahi-daemon.conf
を修正
/etc/avahi/avahi-daemon.conf
の # domain-name=local
の箇所に、
domain-name=.alocal
と追記。
/etc/nsswitch.conf
を修正
/etc/nsswitch.conf
の次の箇所を修正する。
変更前:
files mdns4_minimal [NOTFOUND=return] dns mdns4
変更後:
files dns
/etc/NetworkManager/NetworkManager.conf
の dns=dnsmasq
をコメントアウト
dns=dnsmasq
をコメントアウト。
Trouble Shooting
"ping: unknown host google.com" but IP's works fine
の時は resolvconf
を入れなおした。
sudo apt-get remove --purge resolvconf && sudo apt-get install --reinstall resolvconf
References
-
http://www.tecmint.com/set-static-ip-address-in-ubuntu-15-10-server/
-
http://askubuntu.com/questions/455338/ping-unknown-host-google-com-but-ips-works-fine
-
http://askubuntu.com/questions/465729/ping-unknown-host-google-com-in-ubuntu-server
-
http://askubuntu.com/questions/688557/after-15-10-upgrade-networkmanager-using-30-cpu
-
http://askubuntu.com/questions/134121/how-to-restore-recreate-etc-resolv-conf-files