当前位置:网站首页>虚拟机ping不通的几种原因及解决办法
虚拟机ping不通的几种原因及解决办法
2022-06-10 16:25:00 【萌褚】
镜像下载、域名解析、时间同步请点击 阿里云开源镜像站
一:虚拟机宿主机互ping不通
问题一:防火墙
略去,建议主机和宿主机都关闭防火墙,并关闭seLinux(Linux的安全系统)
问题二:网卡未生效
表现
输入命令 ifcongig,若输出的网卡信息不含inet [ip地址],则说明网卡未生效

网卡生效后会变成

解决办法
这是由于网卡配置文件错误导致的。CentOS7系统网卡配置文件路径:
/etc/sysconfig/network-scripts/ifcfg-[网卡名]网卡名为ifconfig命令输出信息最左列eg:/etc/sysconfig/network-scripts/ifcfg-ens32配置文件内容:

如果你还未修改过这个文件,那么你只需要加入与IP地址有关的IPADDR NETMASK GATEWAY DNS1,并最好将绿点配置修改,实现开机启动。
如果你有多个网卡,红点为各个网卡配置不同的项。如果UUID丢失,可通过uuidgen命令重新生成。笔者由于通过cp复制ens32网卡得到ens34网卡时误加了同步选项-s,导致ens32的UUID丢失,修改后网卡生效。
问题三:IP地址,网关,DNS设施
具体如何设置网上教程很多。简单来说,就是
- Windows虚拟网卡VMnet8的IP地址 和 VMWare虚拟网卡VMnet8的子网IP地址 和 网卡设置文件的IPADDR在同一个局域网下
- Windows虚拟网卡VMnet8的网关和DNS地址 和 VMWare虚拟网卡的网关和DNS地址一致
- 以上所有都在同一个局域网下(IP地址的第三个数,这里是80)
宿主机设置:

虚拟机设置方法为:编辑->虚拟网络编辑器

二:虚拟机对宿主机ping不通,但能ping外网
问题一:虚拟网卡VMnet8
虚拟机和宿主机之间的通信是通过虚拟网卡VMware Network Adapter VMnet8实现的,它的功能可参见如下关闭虚拟网卡实验:
控制面板->网络和Internet->网络和共享中心->更改适配器设置


VMnet8被禁用,则主机和虚拟机无法通信,但可以与外网通信(因为虚拟机和主机公用一个网卡)如下:

若VMNet8未被禁用,也不能排除它的问题,可能是它的设置有问题,具体见上一条。
问题二:虚拟机开机期间切换网络(博主遇到的问题)
如挂梯子,切换WIFI。这种操作使网关发生了变化,实质还是虚拟网卡VMnet8的原因。
问题三:防火墙
建议关掉
三:虚拟机对宿主机ping通,不能ping外网
问题:网关和DNS设置问题
具体设置方法见第一条
本文转自:https://blog.csdn.net/a_vegetable/article/details/122868444
边栏推荐
- How to make a simple Snake game with pyGame
- MFC basic knowledge and course design ideas
- vscode常用快捷键
- Carry forward the past and forge ahead into the future, multiple residuals | densenet (II)
- 全链路追踪 & 性能监控工具 SkyWalking 实战
- Fabric. JS activation input box
- Nat. Rev. Drug Discov. | Application of AI in small molecule drug discovery: an upcoming wave?
- Brands are difficult to establish, IPO is difficult, and Chinese tea enterprises are trapped in "tradition"?
- See how advanced technology changes human life
- VBA determines whether a long string contains another short string
猜你喜欢

全链路追踪 & 性能监控工具 SkyWalking 实战

Internet enterprises and chips

Take you to a preliminary understanding of the basic mechanism of classes and objects

MFC basic knowledge and course design ideas

Detailed steps for installing redis image in docker (easy to understand, suitable for novices to get started quickly)

MFC基础知识与课程设计思路

2022年T电梯修理考试题模拟考试题库及在线模拟考试

Can bus protocol Foundation

带你初步了解 类和对象 的基本机制

大山深处的孩子,正在看见更远的星空
随机推荐
MFC basic knowledge and course design ideas
SOA architecture / test phase interface description language transformation scheme
【玩转华为云】鲲鹏DevKit迁移实战
A few misunderstandings about programmers are very harmful!
Redis operation set, Zset, hash data types and use of visualization tools
Web3 is the most complete money making secret script. Just read this one
What are the differences between domain name filing and ICP filing?
The children in the deep mountains are seeing the stars farther away
2022年G2电站锅炉司炉考试模拟100题及模拟考试
为 Chocolatey 设置代理
Create and install the visual studio offline installation package
智慧景區視頻監控 5G智慧燈杆網關組網綜合杆
VBA determines whether a long string contains another short string
Live broadcast preview | a new era of social interaction, exploring new social experiences in the universe
几个对程序员的误解,害人不浅!
Installing kubernetes using kuboardspray (v1.23.1)
Do you know the five GoLand shortcuts to improve efficiency?
智慧景区视频监控 5G智慧灯杆网关组网综合杆
[BSP video tutorial] BSP video tutorial issue 17: single chip microcomputer bootloader topic, startup, jump configuration and various usage of debugging and downloading (2022-06-10)
Nat. Commun. | 用于加速发现抗生素抗性基因的知识整合和决策支持