【发布时间】:2019-01-23 06:16:15
【问题描述】:
我尝试使用/etc/hosts 文件将一些网站重定向到本地主机。
为此,我使用sudo nano /etc/hosts 在终端中打开它,然后我修改了文件并保存了它。作为最后一步,我使用sudo killall -HUP mDNSResponder 刷新了 DNS 缓存。
这是我的主机文件的样子:
$ 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 somethig.com
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
这根本行不通。我试图重新启动,但没有运气。我也做了很多研究,但在互联网上没有找到任何有效的答案。操作系统是否仍然使用这个文件,或者这永远不会真正起作用?
我使用的是 macOS 10.13。
【问题讨论】: