Linux上不了网——wget无法解析主机

很有可能是网关和域名服务器没有设置

1、设置网关

  netstat -rn  #查看网关配置情况

[hadoop@slave1 ~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface0.0.0.0         10.0.6.252      0.0.0.0         UG    100    0        0 em1
0.0.0.0         192.168.10.1    0.0.0.0         UG    101    0        0 em2
10.0.0.0        0.0.0.0         255.255.0.0     U     100    0        0 em1
192.168.10.0    0.0.0.0         255.255.254.0   U     100    0        0 em2
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

  上面路由表配置应该是任何目的地址都先发送给10.0.6.252,不是我实际的网关

  route add default gw 192.168.10.1  #根据实际网关IP填写

2、设置域名服务器

  vi /etc/resolv.conf

  添加域名服务器

  nameserver 8.8.8.8  #根据实际填写
  nameserver 202.106.196.115  #根据实际填写

ps:因为这两个问题一直安装不了numpy,python很多软件需要在线安装才行

 
原文地址:https://www.cnblogs.com/vincent-vg/p/6632434.html