• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

host 不起作用问题的解决方法

2022-2-13 09:57| 发布者: 菜鸟教程小白| 查看: 221| 评论: 0|原作者: [db:作者]|来自: [db:来源]

摘要: 由于某种需要,需要将域名指向指定的ip地址,平时挺好用,今天发现不能用了,注册表,host文件也修改了都不能用,经过排查,原来是host中的文件顺写反了 ...
这里简单说明下,这个问题的两个原因与解决方法:

第一种: 需要修过注册表

最近有同仁反应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

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap