我认为我遇到了 DNS 问题和/或路由器问题。编辑 2019 年 5 月 24 日 现在,在我的路由器上,我可以成功 ping www.yahoo.com,这意味着问题出在服务器级别。
当我 ssh 进入我的一个服务器 X 时,我发出命令
>wget https://www.gnu.org/software/wget
我实际上已经安装了 wget,只是为了测试互联网连接
我得到了类似这样的错误
>wget: unable to resolve host address: 'ftp.gnu.org'
一开始以为是防火墙的问题,但是发现可以ping通外网IP。
user@reporter:/etc/network$ ping 72.30.35.9 #ping Yahoo IP, works
PING 72.30.35.9 (72.30.35.9) 56(84) bytes of data.
64 bytes from 72.30.35.9: icmp_seq=1 ttl=49 time=25.7 ms
64 bytes from 72.30.35.9: icmp_seq=2 ttl=49 time=25.7 ms
--- 72.30.35.9 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 25.704/25.724/25.745/0.161 ms
这表明从服务器 X,我可以以某种方式连接到外部/互联网
user@reporter:/etc/network$ ping 8.8.8.8 #ping Google IP, does not work
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
--- 8.8.8.8 ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6040ms
user@reporter:/etc/network$ ping 8.8.4.4 #ping another Google IP, works. Don't know why
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=50 time=12.8 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=50 time=12.7 ms
--- 8.8.4.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 12.719/12.768/12.817/0.049 ms
我认为我已经在服务器 X 上正确设置了诸如“接口”之类的网络文件,如下所示
user@reporter:/etc/network$ more interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eno1
iface eno1 inet static
address 192.168.2.10 -------------Note: this is the internal IP of the server I'm on now
gateway 192.168.2.1 -------------Note: this is the internal IP of the router
netmask 255.255.255.0
dns-nameservers 127.0.0.1 --------------Note: I also tried 72.30.35.9, 8.8.4.4, 8.8.8.8, and the IP my client gave. Every time I change the IP here. I issue command "sudo service networking restart" But all IPs have the same results: cannot ping www.yahoo.com but positive for 72.30.35.9
/etc/resolv.conf 文件如下所示
# Dynamic ..... comment line
# DO NOT EDIT THIS FILE BY HAND
nameserver 8.8.4.4
但是我无法通过域名进行 Ping
user@reporter:/etc/network$ ping www.yahoo.com
ping: unknown host www.yahoo.com
user@reporter:/etc/network$ ping www.google.com
ping: unknown host www.google.com
user@reporter:~/Documents/tony/temp$ wget www.yahoo.com
--2019-05-23 20:29:51-- http://www.yahoo.com/
Resolving www.yahoo.com (www.yahoo.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘www.yahoo.com’
user@reporter:~/Documents/tony/temp$ wget 8.8.4.4 # did not get anything, but output indicating "Connecting"
--2019-05-23 20:30:21-- http://8.8.4.4/
Connecting to 8.8.4.4:80... ^C
不确定路由器设置是否有问题,但由于我可以 ping IP,所以我猜测它更多地是在服务器级别(Ubuntu v16.04)。
编辑 2019 年 5 月 24 日 现在在我的路由器上,我可以成功 ping www.yahoo.com,这意味着问题出在服务器级别。
多谢!
编辑:几天后,我现在可以从我的服务器 ping 通 www.yahoo.com。但是,我不知道如何解决这个问题!可能需要一些时间来配置设置?或者我的客户在他们的终端更改了一些设置......