Hosts文件分析,附上原版文件

tetsai
原创声明
本文由tetsai原创,转载请注明来源
Windows系统hosts位于 C:\Windows\System32\drivers\etc\hosts
Android(安卓)系统hosts位于 /system/etc/hosts
Mac(苹果电脑)系统hosts跟Linux一样位于 /etc/hosts
iPhone(iOS)系统hosts跟Linux Mac一样位于 /etc/hosts
Linux系统hosts位于 /etc/hosts
注意:hosts文件属于系统核心文件之一,所以Windows用户必须用***身份打开才能修改保存,如果遇到无法保存,请右键文件hosts并找到“属性” -> “安全”,然后选择你登陆的用户名,最后点击编辑,勾选“写入”即可。
注意*2:hosts被修改可能导致系统异常,博主搞Linux时手滑删了hosts,结果系统变得非常非常卡,经常找不到主机“debian”
Android(安卓)必须Root才能修改,Root Explorer管理器或ES文件浏览器装载/system可写状态,找到/system/etc/hosts的文件,使用文本编辑器打开编辑后保存。
Linux系统使用Root权限vi编辑
而iPhone、iPad也必须越狱才能修改!Windows系统跟苹果系统的hosts文件文本编码和换行符格式一样,而Android(安卓)则不一样,这点你需要注意。
windows:
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost
Mac、iPhone、iPad原版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::10 localhost
Linux系列我就不列出了,因为每个繁生版本都不一样,而且用Linux的人一般不是小白。