OS X 系统,修改hosts文件后不生效的问题

系统版本

OS X El Capitan,10.11.2

问题描述

业务需要,配置“nexus”为某个ip,如下图更改了 /etc/hosts 文件。

结果在ping的时候,请求并未发到指定ip上。

问题解决

hosts文件权限不足,应当至少为644,如下操作后,hosts文件生效。

chmod 644 /etc/hosts

备注

OS X 中似乎会将hosts文件保存在 /etc/hosts 和 /private/etc/hosts 两个地方,两处为同一文件。

原文地址:https://www.cnblogs.com/maozhige/p/5049255.html