LoginSignup
54
27

More than 5 years have passed since last update.

/etc/hosts が反映されない?安心してください。反映されてますよ。

Last updated at Posted at 2015-10-05

結論

安心してください。反映されてますよ。

/etc/hosts が反映されない?

Yosemite にて /etc/hosts を編集したのだけれども反映されていないようだ。
キャッシュをフラッシュすれば良いと見たが、試しても変わらず。

/etc/hosts
xxx.xxx.xxx.xxx  www.my-awesome-domain.jp
$ nslookup nslookup www.my-awesome-domain.jp 
Server:         192.168.1.1
Address:        192.168.1.1#53

** server can't find nslookup www.my-awesome-domain.jp : NXDOMAIN

あれれれ〜?

一部コマンドではシステムの DNS リゾルバが使われない

dig, nslookup, そして host コマンドは /etc/hosts を参照しない。

ブラウザはちゃんと解決してくれるので大丈夫。
コマンドで確認したい場合には ping を使おう。

$ ping www.my-awesome-domain.jp
PING www.my-awesome-domain.jp (xxx.xxx.xxx.xxx): 56 data bytes
...

参考: osx - OS X 10.10.1 /etc/hosts & /private/etc/hosts file is being ignored and not resolving - Ask Different

54
27
1

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
54
27