Bri*_*anC 16 mac hosts-file macos
在我的 Mac(运行 OS 10.6.8)上,我可以使用 编辑我的主机文件sudo vi /etc/hosts,但我所做的更改似乎不会通过重新启动或可能从睡眠模式中唤醒。
有没有办法让这些变化持续存在?
这是为 www.example.com 添加覆盖的示例更改:
$ cat /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
1.2.3.4 www.example.comRun Code Online (Sandbox Code Playgroud)
更新:我也在使用 Cisco AnyConnect VPN 软件,结果证明这是一个线索。见下面丹尼尔的回答。
2013 年 5 月 20 日更新:思科在 2013 年春季发布的 AnyConnect v3.0.5080(或更高版本)中修复/更改了此行为。发行说明- 搜索hosts.ac.
小智 18
我有同样的问题。就我而言,我使用的是 F5 VPN 客户端。您不应/etc/hosts在 VPN 客户端运行时进行编辑,因为当您关闭 VPN 客户端时,这些更改将被删除。要使更改永久生效,请/etc/hosts在启动 VPN 客户端之前编辑文件。