欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

虚拟机 ping 不通 宿主机?

程序员文章站 2022-07-03 15:53:54
...

场景:VirtualBox 安装CentOS7最小安装的 ,所以没有vim编辑器,就去执行下载指令。yum install vim -y结果发现无法安装吧啦吧啦一大堆提示。我又测试网络是否能ping通,结果发现:虚拟机无法ping通宿主机,ping不通百度。

tips:如果网络通畅无法安装vim,则忽略以下直接去执行:vi /etc/resolv.conf在文件里面添加一行:nameserver 8.8.8.8再测试安装。

无法安装截图:

虚拟机 ping 不通 宿主机?

过程:改过网络模式,改过静动态IP,改过DNS,等等。。。(反正就是虚拟机中各种改)

解决:有时候度娘本娘还是很亲民的,按百度经验中试了下,结果行了!!!!!

虚拟机 ping 不通 宿主机?

特此记录一下,安装完成的时候就把虚拟机的防火墙关了,然后我虚拟机无法ping通宿主机,但是宿主机能ping通虚拟机,我就一直在虚拟机改各种配置,然后才发现是Windows防火墙的问题,我把Windows防火墙全部关闭了都还是不行(不知道是不是操作快或者没重启的原因),最后把虚拟机监控启用才ping通。最后成功安装vim

[aaa@qq.com xxxxx]# yum install vim -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * extras: mirrors.njupt.edu.cn
 * updates: mirrors.njupt.edu.cn
base                                                                                                                                                                | 3.6 kB  00:00:00     
extras                                                                                                                                                              | 2.9 kB  00:00:00     
updates                                                                                                                                                             | 2.9 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                                                                                                       | 153 kB  00:00:00     
(2/4): extras/7/x86_64/primary_db                                                                                                                                   | 206 kB  00:00:01     
(3/4): updates/7/x86_64/primary_db                                                                                                                                  | 4.5 MB  00:00:08     
(4/4): base/7/x86_64/primary_db                                                                                                                                     | 6.1 MB  00:00:10     
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-common = 2:7.4.629-6.el7 for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Running transaction check
---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed
---> Package vim-common.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-6.el7.x86_64
--> Running transaction check
---> Package vim-filesystem.x86_64 2:7.4.629-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================
 Package                                          Arch                                     Version                                            Repository                              Size
===========================================================================================================================================================================================
Installing:
 vim-enhanced                                     x86_64                                   2:7.4.629-6.el7                                    base                                   1.1 M
Installing for dependencies:
 gpm-libs                                         x86_64                                   1.20.7-6.el7                                       base                                    32 k
 vim-common                                       x86_64                                   2:7.4.629-6.el7                                    base                                   5.9 M
 vim-filesystem                                   x86_64                                   2:7.4.629-6.el7                                    base                                    11 k

Transaction Summary
===========================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 7.0 M
Installed size: 23 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/vim-filesystem-7.4.629-6.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY           ]  0.0 B/s |    0 B  --:--:-- ETA 
Public key for vim-filesystem-7.4.629-6.el7.x86_64.rpm is not installed
(1/4): vim-filesystem-7.4.629-6.el7.x86_64.rpm                                                                                                                      |  11 kB  00:00:00     
(2/4): gpm-libs-1.20.7-6.el7.x86_64.rpm                                                                                                                             |  32 kB  00:00:00     
(3/4): vim-common-7.4.629-6.el7.x86_64.rpm                                                                                                                          | 5.9 MB  00:00:03     
(4/4): vim-enhanced-7.4.629-6.el7.x86_64.rpm                                                                                                                        | 1.1 MB  00:00:10     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                      683 kB/s | 7.0 MB  00:00:10     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <aaa@qq.com>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-8.2003.0.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:vim-filesystem-7.4.629-6.el7.x86_64                                                                                                                                   1/4 
  Installing : 2:vim-common-7.4.629-6.el7.x86_64                                                                                                                                       2/4 
  Installing : gpm-libs-1.20.7-6.el7.x86_64                                                                                                                                            3/4 
  Installing : 2:vim-enhanced-7.4.629-6.el7.x86_64                                                                                                                                     4/4 
  Verifying  : gpm-libs-1.20.7-6.el7.x86_64                                                                                                                                            1/4 
  Verifying  : 2:vim-enhanced-7.4.629-6.el7.x86_64                                                                                                                                     2/4 
  Verifying  : 2:vim-common-7.4.629-6.el7.x86_64                                                                                                                                       3/4 
  Verifying  : 2:vim-filesystem-7.4.629-6.el7.x86_64                                                                                                                                   4/4 

Installed:
  vim-enhanced.x86_64 2:7.4.629-6.el7                                                                                                                                                      

Dependency Installed:
  gpm-libs.x86_64 0:1.20.7-6.el7                            vim-common.x86_64 2:7.4.629-6.el7                            vim-filesystem.x86_64 2:7.4.629-6.el7                           

Complete!