小编Bri*_*anC的帖子

如何永久更改 Mac /etc/hosts?

在我的 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.com
Run Code Online (Sandbox Code Playgroud)

更新:我也在使用 Cisco AnyConnect VPN 软件,结果证明这是一个线索。见下面丹尼尔的回答。

2013 年 5 月 20 日更新:思科在 2013 年春季发布的 AnyConnect v3.0.5080(或更高版本)中修复/更改了此行为。发行说明- 搜索hosts.ac.

mac hosts-file macos

16
推荐指数
2
解决办法
3万
查看次数

标签 统计

hosts-file ×1

mac ×1

macos ×1