Hosts

作者: palmlove | 来源:发表于2017-03-09 17:09 被阅读0次

摘自老D
hosts文件在哪?什么修改?另附Windows7/8/10 Mac/iPhone原版hosts文件

Hosts是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些常用的网址域名与其对应的IP地址建立一个关联“数据库”,当用户在浏览器中输入一个需要登录的网址时,系统会首先自动从Hosts文件中寻找对应的IP地址,一旦找到,系统会立即打开对应网页,如果没有找到,则系统会再将网址提交DNS域名解析服务器进行IP地址的解析
这就是为什么通过修改hosts文件就可以浏览谷歌等被墙网站,原因是直接访问目标网站对应ip,不通过DNS,所以GFW的DNS污染就可以成功跳过。

hostshosts
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

你可以用记事本打开并修改

PC建议用Notepad++进行编辑。
注意:
hosts文件属于系统核心文件之一,所以Windows用户必须用管理员身份打开才能修改保存,如果遇到无法保存,请右键文件hosts并找到“属性” -> “安全”
,然后选择你登陆的用户名,最后点击编辑,勾选“写入”即可。
Android(安卓)必须Root才能修改,Root Explorer管理器或ES文件浏览器装载/system可写状态,找到/system/etc/hosts的文件,使用文本编辑器打开编辑后保存。
Linux系统使用Root权限vi编辑
而iPhone、iPad也必须越狱才能修改!Windows系统跟苹果系统的hosts文件文本编码和换行符格式一样,而Android(安卓)则不一样,这点你需要注意。
Windows系统原版hosts文件:

[cc lang="php"]# 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文件:
[cc lang="php"]### Host Database## localhost is used to configure the loopback interface# when the system is booting. Do not change this entry.##127.0.0.1 localhost255.255.255.255 broadcasthost::1 localhostfe80::10 localhost[/cc]
Linux系列我就不列出了,一般用这个系统的人都不会是小白。
大家或许留意到,原版的hosts文件前面都带有井号“#”,以#开头的都是注释用的,所以并没什么卵用,如果你想快速恢复原版hosts文件,那么也可以直接清空里边的内容,一般情况没有什么影响。

修改hosts后生效的方法:
Windows开始 -> 运行 -> 输入cmd -> 在CMD窗口输入
1

ipconfig /flushdns

Linux终端输入
1

sudo rcnscd restart

对于systemd发行版,请使用命令
1

sudo systemctl restart NetworkManager

如果不懂请都尝试下
Mac OS X终端输入
1

sudo killall -HUP mDNSResponder

Android开启飞行模式 -> 关闭飞行模式
通用办法:
拔网线(断网) -> 插网线(重新连接网络) 或者重启系统。

最新远景DNS 2017.3.9

218.93.127.136 pcbeta.com 218.93.127.136 i.pcbeta.com 218.93.127.136 uc.pcbeta.com 218.93.127.136 bbs.pcbeta.com 218.93.127.136 www.pcbeta.com 218.93.127.136 static.template.pcbeta.com 218.93.127.136 cdn.pcbeta.static.inimc.com

相关文章

  • Linux /etc/hosts文件作用(转)

    Linux 修改 etc/hosts文件 hosts文件 hosts —— the static table lo...

  • Pycharm激活码提示激活失败

    修改hosts文件 window的hosts文件路径 mac的hosts文件路径 hosts文件添加以下内容 刷新...

  • Ubuntu 修改 hosts

    修改 hosts 打开文件 /etc/hosts vi /etc/hosts 添加解析记录127.0.0.1 l...

  • Hosts

    Hosts Hosts不是长久有效的,如发现访问不了则需更新最新的Hosts。Hosts更新后打开浏览器访问htt...

  • Mac翻墙

    hosts文件下载地址:https://github.com/racaljk/hosts1、找到mac hosts...

  • ubuntu下虚拟域名配置

    ` hosts sudo vim /etc/hosts //打开hosts文件添加虚拟域名 ` apache2 c...

  • mac-修改hosts

    hosts位置 Finder -> 前往 -> 前往文件夹 -> /etc/hosts 解决hosts没有权限 命...

  • react前端配置本地域名

    在hosts上配置域名hosts路径: C:\Windows\System32\drivers\etc\hosts...

  • hosts

    在我们的测试工作中,经常用到Hosts文件,那么什么是Hosts,为什么需要配置Hosts,以及如何配置Hosts...

  • linux修改hosts

    修改hostsvim /etc/hosts查看hostscat /etc/hosts

网友评论

      本文标题:Hosts

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