冰皇艾希 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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。