host 不起作用問題的解決方法
2020-10-22 18:59:44
供稿:網友
這里簡單說明下,這個問題的兩個原因與解決方法:
第一種: 需要修過注冊表
最近有同仁反應hosts不起作用,在網上找了很久,只找到大部分都是下面這篇文章,但看了有問題的客戶機,發現需要修正的設定是相同的,所以應該不是這個解決辦法!
由于的 需要,經常要修改C:/windows/system32/drivers/etc/hosts里面的域名指向??墒悄涿畹氖?,自己電腦上的 hosts文件修改了沒有作用,google幾天沒有結果,郁悶。所幸的是還是找到了一篇高人的文章,原來是把 HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Servic es/Tcpip/Parameters里面的"DataBasePath"類型從"REG_SZ"修改為"REG_EXPAND_SZ"就OK了(需要 重新啟動計算機),據說可能是安裝MSN 7.0/7.5后類型被修改了,而微軟對這個完全沒有說明,FT。
全文如下
Open regedit and browse to
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Servic es/Tcpip/Parameters
Examine "DataBasePath" key in this node carefully.
If the path is set to %SystemRoot%/System32/drivers/etc and the key type is anything but REG_EXPAND_SZ, that is is your problem.
If the type is REG_SZ, edit the DatabasePathregistry keyand hardcode th entire path (remove the env variable)
e.g. c:/windows/system32/drivers/etc
or
delete the existing registry key and create a new key by the same name (DataBasePath) of type REG_EXPAND_SZ and set the value to %SystemRoot%/System32/drivers/etc
Files in etc dir should now be enabled.
Why did this happen to you? Most likely you installed MSN Messenger 7.0/7.5 which changed the type of this key.
Why did it do that, why didn't it inform you of what it has done? Ask Bill gates?
Is it documented anywere? Not to the best of my knowledge.
不過在查找的時候發現有一個人的回復是,“保證格式和權限正確”,這倒提醒了我,查看hosts文件的權限,果然這個文件沒有集成這個文件夾的權限,于是修改權限,問題解決!
總結:對于的系統參數,一個要格式正確外,一定要注意權限的設定,這個很容易被忽略掉。但問題在于這個文件從外部拷貝進來,為什么權限沒有被文件夾自動覆蓋掉,不解!
第二種:因為書寫順序不對(我就是因為這個原因)
應該是先寫 ip[tab]域名的格式
例如: 127.0.0.1 www.cctv.com