当前位置:网站首页>解决本地连接不上虚拟机的问题
解决本地连接不上虚拟机的问题
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也应做相应修改,如果配置了的话,防止后续学习又遇见错误.
边栏推荐
- xpath
- Experience sharing of meituan 20K Software Test Engineers
- 软件测试自动化测试之——接口测试从入门到精通,每天学习一点点
- Crontab scheduled task common commands
- Go from introduction to actual combat - only any task is required to complete (notes)
- 二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)
- CUDA error:out of memory caused by insufficient video memory of 6G graphics card
- STM32CubeIDE1.9.0\STM32CubeMX 6.5 F429IGT6加LAN8720A,配置ETH+LWIP
- Gbase 8A method for reducing the impact on the system by controlling resource usage through concurrency during node replacement of V8 version
- Record a list object traversal and determine the size of the float type
猜你喜欢
真香,自从用了Charles,Fiddler已经被我彻底卸载了
Go from introduction to actual combat - task cancellation (note)
Codeforces Round #716 (Div. 2)
使用Jmeter进行性能测试的这套步骤,涨薪2次,升职一次
Educational Codeforces Round 108 (Rated for Div. 2)
Stm32f107+lan8720a use stm32subemx to configure network connection +tcp master-slave +udp app
Codeforces Round #719 (Div. 3)
管理系统-ITclub(下)
.NET学习笔记(五)----Lambda、Linq、匿名类(var)、扩展方法
YOLOv6:又快又准的目标检测框架开源啦
随机推荐
xpath
Acwing weekly contest 57- digital operation - (thinking + decomposition of prime factor)
Simulink method for exporting FMU model files
单元测试界的高富帅,Pytest框架,手把手教学,以后测试报告就这么做~
[LeetCode]513. 找树左下角的值
对话乔心昱:用户是魏牌的产品经理,零焦虑定义豪华
Quick excel export
CUDA error:out of memory caused by insufficient video memory of 6G graphics card
分享|智慧环保-生态文明信息化解决方案(附PDF)
石子合并问题分析
Analysis of stone merging
.NET学习笔记(五)----Lambda、Linq、匿名类(var)、扩展方法
[LeetCode]161. Edit distance of 1
[MySQL] database function clearance Tutorial Part 2 (window function topic)
PCIe knowledge point -008: structure of PCIe switch
\W and [a-za-z0-9_], \Are D and [0-9] equivalent?
AQS SOS AQS with me
Method of reading file contents by Excel
[LeetCode]508. 出現次數最多的子樹元素和
. Net learning notes (V) -- lambda, LINQ, anonymous class (VaR), extension method