摘自老D
hosts文件在哪苞慢?什么修改?另附Windows7/8/10 Mac/iPhone原版hosts文件
Hosts是一個(gè)沒有擴(kuò)展名的系統(tǒng)文件,可以用記事本等工具打開筐高,其作用就是將一些常用的網(wǎng)址域名與其對應(yīng)的IP地址建立一個(gè)關(guān)聯(lián)“數(shù)據(jù)庫”,當(dāng)用戶在瀏覽器中輸入一個(gè)需要登錄的網(wǎng)址時(shí)丑瞧,系統(tǒng)會首先自動從Hosts文件中尋找對應(yīng)的IP地址柑土,一旦找到,系統(tǒng)會立即打開對應(yīng)網(wǎng)頁绊汹,如果沒有找到稽屏,則系統(tǒng)會再將網(wǎng)址提交DNS域名解析服務(wù)器進(jìn)行IP地址的解析
這就是為什么通過修改hosts文件就可以瀏覽谷歌等被墻網(wǎng)站,原因是直接訪問目標(biāo)網(wǎng)站對應(yīng)ip西乖,不通過DNS狐榔,所以GFW的DNS污染就可以成功跳過。
Windows系統(tǒng)hosts位于 C:\Windows\System32\drivers\etc\hosts
Android(安卓)系統(tǒng)hosts位于 /system/etc/hosts
Mac(蘋果電腦)系統(tǒng)hosts跟Linux一樣位于 /etc/hosts
iPhone(iOS)系統(tǒng)hosts跟Linux Mac一樣位于 /etc/hosts
Linux系統(tǒng)hosts位于 /etc/hosts
你可以用記事本打開并修改
PC建議用Notepad++進(jìn)行編輯获雕。
注意:
hosts文件屬于系統(tǒng)核心文件之一薄腻,所以Windows用戶必須用管理員身份打開才能修改保存,如果遇到無法保存典鸡,請右鍵文件hosts并找到“屬性” -> “安全”被廓,然后選擇你登陸的用戶名,最后點(diǎn)擊編輯萝玷,勾選“寫入”即可嫁乘。
Android(安卓)必須Root才能修改,Root Explorer管理器或ES文件瀏覽器裝載/system可寫狀態(tài)球碉,找到/system/etc/hosts的文件蜓斧,使用文本編輯器打開編輯后保存。
Linux系統(tǒng)使用Root權(quán)限vi編輯
而iPhone睁冬、iPad也必須越獄才能修改挎春!Windows系統(tǒng)跟蘋果系統(tǒng)的hosts文件文本編碼和換行符格式一樣看疙,而Android(安卓)則不一樣,這點(diǎn)你需要注意直奋。
Windows系統(tǒng)原版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系列我就不列出了脚线,一般用這個(gè)系統(tǒng)的人都不會是小白搁胆。
大家或許留意到,原版的hosts文件前面都帶有井號“#”邮绿,以#開頭的都是注釋用的渠旁,所以并沒什么卵用,如果你想快速恢復(fù)原版hosts文件船逮,那么也可以直接清空里邊的內(nèi)容顾腊,一般情況沒有什么影響。
修改hosts后生效的方法:
Windows開始 -> 運(yùn)行 -> 輸入cmd -> 在CMD窗口輸入
1
ipconfig /flushdns
Linux終端輸入
1
sudo rcnscd restart
對于systemd發(fā)行版挖胃,請使用命令
1
sudo systemctl restart NetworkManager
如果不懂請都嘗試下
Mac OS X終端輸入
1
sudo killall -HUP mDNSResponder
Android開啟飛行模式 -> 關(guān)閉飛行模式
通用辦法:
拔網(wǎng)線(斷網(wǎng)) -> 插網(wǎng)線(重新連接網(wǎng)絡(luò)) 或者重啟系統(tǒng)杂靶。
最新遠(yuǎn)景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