栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Xshell不能连接到Centos,虚拟机中不能ping外网的解决方案

Xshell不能连接到Centos,虚拟机中不能ping外网的解决方案

1.使用Xshell连接虚拟机出现如下问题,连接不上

Host 'hadoop104' resolved to 192.168.10.104.
Connecting to 192.168.10.104:22...
Could not connect to 'hadoop104' (port 22): Connection failed.

Type `help' to learn how to use Xshell prompt.

 

2.进入虚拟机:ping www.baidu.com

3.连不上网,那必定是网没打开了

输入:systemctl status network.service

出现如下结果:

network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since 三 2022-03-23 11:40:16 CST; 29s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3342 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

3月 23 11:40:15 hadoop104 network[3342]: RTNETlink answers: File exists
3月 23 11:40:15 hadoop104 network[3342]: RTNETlink answers: File exists
3月 23 11:40:15 hadoop104 network[3342]: RTNETlink answers: File exists
3月 23 11:40:15 hadoop104 network[3342]: RTNETlink answers: File exists
3月 23 11:40:15 hadoop104 network[3342]: RTNETlink answers: File exists
3月 23 11:40:15 hadoop104 network[3342]: RTNETlink answers: File exists
3月 23 11:40:16 hadoop104 systemd[1]: network.service: control process exited, co...=1
3月 23 11:40:16 hadoop104 systemd[1]: Failed to start LSB: Bring up/down networking.
3月 23 11:40:16 hadoop104 systemd[1]: Unit network.service entered failed state.
3月 23 11:40:16 hadoop104 systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

 

4.输入:systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since 三 2022-03-23 11:24:35 CST; 14min ago
     Docs: man:NetworkManager(8)
 Main PID: 687 (NetworkManager)
    Tasks: 3
   CGroup: /system.slice/NetworkManager.service
           └─687 /usr/sbin/NetworkManager --no-daemon


5.将NetworkManager关闭:systemctl stop NetworkManager

 

6.service network start

Starting network (via systemctl):                          [  确定  ]

7.重新 ping www.baidu.com

64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=44.9 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=44.9 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=47.0 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=45.2 ms
^C
--- ps_other.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3008ms
rtt min/avg/max/mdev = 44.934/45.524/47.006/0.901 ms

8.在Xshell端连接centos虚拟机

Host 'hadoop104' resolved to 192.168.10.104.
Connecting to 192.168.10.104:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Wed Mar 23 11:30:42 2022
[fei@hadoop104 ~]$ 
9.能够连上了,问题总算解决!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/774940.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号