美文网首页
Mac修改hosts文件来禁止访问网站

Mac修改hosts文件来禁止访问网站

作者: 王小冬 | 来源:发表于2018-02-28 12:59 被阅读58次

背景

在前进的路上不能有绊脚石,既然自驱动不靠谱,就靠外力促使自己不玩游戏吧——决定把三国杀网站web.sanguosha.com封掉。

步骤

进入hosts文件所在目录

cd /private/etc/
sudo vi hosts

由于一般用户没有权限,需要切换到root执行,输入root密码。
加入127.0.0.1 web.sanguosha.com这一行,代表每次访问web.suoguosha.com的时候实际会访问120.0.0.1也就是localhost本地ip。

##
# 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
127.0.0.1       web.sanguosha.com
255.255.255.255 broadcasthost
::1             localhost

相关文章

网友评论

      本文标题:Mac修改hosts文件来禁止访问网站

      本文链接:https://www.haomeiwen.com/subject/txmbxftx.html