服务器无法 ping 通,但只能 curl 有限的网站

服务器无法 ping 通,但只能 curl 有限的网站

我的服务器出现了一些网络问题。该服务器位于其 LAN 中,我可以通过 VPN 访问它。该服务器可以 ping 通 LAN 中的任何其他计算机,但无法 ping 通 LAN 之外的计算机。

ping google.com
PING google.com (216.58.217.14) 56(84) bytes of data.
^C
--- google.com ping statistics ---
74 packets transmitted, 0 received, 100% packet loss, time 73001ms

但它可以 cURL 到相同的地址:

curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

另外,如果我想从互联网上获取 wget rpm 包并将其下载到服务器上进行安装,则需要很长时间。

 curl -O ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/wget-1.14-13.el7.x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:01:25 --:--:--     

但我可以用 curl 获取网站内容:

curl http://www.rpmfind.net/linux/RPM/centos/7.3.1611/x86_64/Packages/wget-1.14-13.el7.x86_64.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /linux/RPM/centos/7.3.1611/x86_64/Packages/wget-1.14-13.el7.x86_64.html was not found on this server.</p>
</body></html>

如果您对我的 iptables 配置感到好奇,我已经将其刷新了。

sudo iptables -F

我还让 selinux 变得宽容:

sudo setenforce 0

但我的服务器无法访问网络外部的任何内容。任何帮助都将不胜感激。

答案1

显然,您位于路由器/防火墙后面,因此不允许从该服务器 ping 到外部。原因:您可以通过 dns 服务连接到外部(您解析了 google 的 ip),并且您也可以清楚地连接到 http(s) 端口,这两个事实结合起来证明您的连接工作正常。

相关内容