冰皇艾希 2022-10-06 21:54 采纳率: 66.7%
浏览 28
已结题

Hosts文件不生效!

建立Centos7虚拟机一台,设置hostname 为 hadoop100。

Windows10 设置 C:\Windows\System32\drivers\etc 中的hosts文件 ,
开始看到这个文件夹中没有这个文件,
百度用命令(for /f %P in ('dir %windir%\WinSxS\hosts /b /s') do copy %P %windir%\System32\drivers\etc & echo %P & Notepad %P),
生成了一个hosts文件。

然后修改其中配置如下 :

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 addreses to host names. Each

entry should be kept on an individual line. The IP addres should

be placed in the first column followed by the corresponding host name.

The IP addres 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

192.168.10.100 hadoop100 【此行为我添加的,其他都是文件自带的,100和 hadoop100中间是空格】

用Xshell 连接此IP虚拟机,用 192.168.10.100 作为IP 可正常连接。改为hadoop100缺无法连接 ,报错【Unable to resolve host 'hadoop100'】
然后启动CMD,输入命令 ping hadoop100 ,报错【Ping 请求找不到主机 hadoop100。请检查该名称,然后重试。】

百度尝试过
1)刷新本地的DNS缓存数据 ipconfig /flushdns
2)清空缓存 netsh winsock reset ,重启机器。

均无法解决此问题。

请道友襄助,到底如何才能让windows解析hadoop成功 。抱拳了~!!

  • 写回答

2条回答 默认 最新

  • 凯歌响起 2022-10-06 22:02
    关注

    hosts文件只能读取ASCII编码,修改一下hosts文件的格式

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 10月15日
  • 已采纳回答 10月7日
  • 创建了问题 10月6日

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制