如标题所示,运行os x 10.10.1。如果我在主机文件中有一个条目并执行一个操作,dig或者nslookup即使尝试刷新各种缓存后,它仍显示出与主机文件中不同的IP。
我尝试了以下方法。
- 通过运行以下命令刷新mdns和udns缓存:
- sudo discoveryutil mdnsflushcache;
- sudo discoveryutil udnsflushcaches;
 
- 使用刷新刷新 dscacheutil -flushcache
- 重新加载discoveryd.plist文件- sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
- sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
 
我的主机文件看起来像这样。
% cat /private/etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0 localhost
166.78.60.102   admin.devsite1.com