虚拟机突然无法访问外部网络的现象集合

现场还原

虚拟机突然无法访问外部网络

  1. ping 8.8.8.8的时候显示网络不可达
ping 8.8.8.8
  1. ping www.baidu.com(报:未知的名称或服务或请求超时)
ping www.baidu.com
  1. yum操作 也提示错误:为仓库 ‘appstream’ 下载元数据失败 :
Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

  1. 利用虚拟机的浏览器Firefox也无法访问网址
    在这里插入图片描述
  2. 命令ifconfig可以查看IP地址
[root@localhost-cs8 ~]# ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.122.128  netmask 255.255.255.0  broadcast 192.168.122.255
        ...
  1. XShell等工具都能正常访问虚拟机
Connecting to 192.168.122.128:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Activate the web console with: systemctl enable --now cockpit.socket

Last login: Tue Sep 12 16:20:38 2023 from 192.168.122.1
Session lifetime based on X11 requested, but X11 initialization failed.
[root@localhost-cs8 ~]# 

解决方案

尝试网卡配置防火墙配置域名解析配置等操作均无法达到目的

最终在虚拟机中的虚拟网络编辑器里重新配置 NAT模式后成功访问百度,一切恢

[admin@localhost-cs8 ~]$ ping www.baidu.com
PING www.wshifen.com (104.193.88.77) 56(84) bytes of data.
64 bytes from 104.193.88.77 (104.193.88.77): icmp_seq=1 ttl=128 time=173 ms
64 bytes from 104.193.88.77 (104.193.88.77): icmp_seq=2 ttl=128 time=179 ms
^Z
[1]+  已停止               ping www.baidu.com
[admin@localhost-cs8 ~]$ 

猜你喜欢

转载自blog.csdn.net/Klhz555/article/details/132832727