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

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 Stata链式中介效应代码修改
  • ¥15 latex投稿显示click download
  • ¥15 请问读取环境变量文件失败是什么原因?
  • ¥15 在若依框架下实现人脸识别
  • ¥15 添加组件无法加载页面,某块加载卡住
  • ¥15 网络科学导论,网络控制
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错