虚拟机无法联网的解决办法

[lingyun@localhost ~]$ ping 192.168.2.1                                       //先ping路由器,是否能够ping通。这里ping通没问题
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=3.29 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=5.87 ms
^C
--- 192.168.2.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1299ms
rtt min/avg/max/mdev = 3.294/4.585/5.877/1.293 ms


[lingyun@localhost ~]$ route -n                                               // 检查网络配置,这里发现没有网关。  

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
[lingyun@localhost ~]$ route add default gw 192.168.2.1     //添加网关。
SIOCADDRT: 不允许的操作
[lingyun@localhost ~]$ sudo route add default gw 192.168.2.1 
[lingyun@localhost ~]$ ping 4.2.2.2                                      //ping一个通用的dns地址,能ping通说明能上网。
PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data.
64 bytes from 4.2.2.2: icmp_seq=1 ttl=52 time=285 ms
64 bytes from 4.2.2.2: icmp_seq=2 ttl=52 time=280 ms
^C
--- 4.2.2.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1988ms
rtt min/avg/max/mdev = 280.447/283.117/285.788/2.722 ms
[lingyun@localhost ~]$ ping baidu.com
PING baidu.com (111.13.101.208) 56(84) bytes of data.
64 bytes from 111.13.101.208: icmp_seq=1 ttl=51 time=31.3 ms
64 bytes from 111.13.101.208: icmp_seq=2 ttl=51 time=34.7 ms
^C
--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1631ms
rtt min/avg/max/mdev = 31.354/33.076/34.798/1.722 ms
[lingyun@localhost ~]$ wget ftp://iot-yun.eicp.net/linux_tools/conf/vim_conf/vim_conf_V2.1.1.bin
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值