当前位置:网站首页>解决本地连接不上虚拟机的问题
解决本地连接不上虚拟机的问题
2022-06-27 19:46:00 【Lilianac】
发现问题
(记录一下本地连接不上虚拟机的问题)原本我是想在本地浏览器中打开hadoop0的hdfs网站,但是一直进不去,而在虚拟机的浏览器中却能进去,于是我打开cmd ping以下虚拟机,连接超时:

通过百度查到了,是网关有了问题,首先使用ipconfig -all命令查看本地电脑网关地址:
虚拟机的网关:
本地网关和虚拟机网关不一致,现在来修改虚拟机地址,先关闭虚拟机,我本机的IP地址是192.168.168.117
解决问题
1. 修改虚拟机的IP地址 打开虚拟机的虚拟网络编辑器





2. 修改Windows的IP地址
打开网络和Internet



3. 修改/etc/sysconfig/network-scripts/ifcfg-ens33文件
做完这些步骤之后,打开虚拟机,输入ifconfig,没有出现ens33的ip地址,只出现了lo:

查阅资料后发现是/etc/sysconfig/network-scripts/ifcfg-ens33文件出现问题,原来我之前在给这个master节点配置了静态ip,输入命令:vi /etc/sysconfig/network-scripts/ifcfg-ens33

把这几个IP地址修改一下,与前面在虚拟网络编辑器中配置的IP地址一致,然后保存退出,重启一下网卡,输入service NetworkManager stop,然后输入service NetworkManager start完成重启,然后再次输入ifconfig就出现ens33啦
我的虚拟机时CentOS 8,查到的重启网关的命令基本都是service network restart或者service network-manager restart,但是一直在报:
Redirecting to /bin/systemctl start network-manager.service
Failed to start network-manager.service: Unit network-manager.service not found.
这样的错,输入nmcli c reload或者nmcli networking off 或者nmcli networking on之类的命令,则报的也是networkmanager没有启动的错误,最后我终于找到了上面两个命令能完成网卡的重启

问题解决
尝试在本地是否能ping同虚拟机IP

欧克,问题得到解决,最后IP地址被修改了,在/etc/hosts文件中的IP也应相应的修改,还有C:\Windows\System32\drivers\etc文件中配置的ip也应做相应修改,如果配置了的话,防止后续学习又遇见错误.
边栏推荐
- MONTHS_ Between function use
- [LeetCode]动态规划解拆分整数I[Silver Fox]
- 石子合并问题分析
- Go from introduction to actual combat - task cancellation (note)
- Acwing weekly contest 57- digital operation - (thinking + decomposition of prime factor)
- [leetcode] 508. Élément de sous - arbre le plus fréquent et
- \W and [a-za-z0-9_], \Are D and [0-9] equivalent?
- Installing Oracle11g under Linux
- 不外泄的测试用例设计秘籍--模块测试
- Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
猜你喜欢

Stm32cubeide1.9.0\stm32cubemx 6.5 f429igt6 plus lan8720a, configure eth+lwip

读写分离-Mysql的主从复制

清华大学教授:软件测试已经走入一个误区——“非代码不可”

深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图

CUDA error:out of memory caused by insufficient video memory of 6G graphics card

Use Fiddler to simulate weak network test (2g/3g)

Fill in the blank of rich text test

List of language weaknesses --cwe, a website worth learning

洛谷P5706 再分肥宅水

【Redis】零基础十分钟学会Redis
随机推荐
Simulink method for exporting FMU model files
Gbase 8A OLAP analysis function cume_ Example of dist
Go from introduction to practice - error mechanism (note)
MONTHS_BETWEEN函数使用
A method of go accessing gbase 8A database
Magic POI error in reading excel template file
Go from introduction to actual combat - only any task is required to complete (notes)
Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
matlab查找某一行或者某一列在矩阵中的位置
GBase 8a的create database 会被查询耗时很长怀疑卡住的现象分析
Windwos 8.1系统安装vmware tool插件报错的解决方法
∫(0→1) ln(1+x) / (x ² + 1) dx
xpath
管理系统-ITclub(上)
It smells good. Since I used Charles, Fiddler has been completely uninstalled by me
二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)
Management system itclub (Part 2)
vmware虚拟机PE启动
Record a list object traversal and determine the size of the float type
Acwing weekly contest 57- digital operation - (thinking + decomposition of prime factor)