LoginSignup
11

More than 5 years have passed since last update.

/etc/resolv.conf が勝手に書き換えられて悲しいときの対処法

Posted at

DHCPクライアントな環境で、開発していると /etc/resolv.conf を直接書き換えてDNSサーバを追加しても、マシンを再起動したりすると元に戻ってしまって悲しい思いをすることがあると思います。

そんなとき、この方法を使うと悲しい思いをせずに済みます。

CentOS6.5, Ubuntu12.04, Debian など手元にあった環境では一通り使えたので割と汎用的に使えます。

/etc/dhcp/dhclient.conf に prepend domain-name-servers 192.168.30.1; を追記してネットワークを再起動すれば /etc/resolv.conf に反映されます。

詳しくは dhclient.conf(3) を読んでください。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11