Ubuntu 服务器无法向某个特定 IP 地址发送 GET 请求

Ubuntu 服务器无法向某个特定 IP 地址发送 GET 请求

我有一个来自 DigitalOcean 的 droplet,搭载的是 Ubuntu 18.04.3 LTS(GNU/Linux 4.15.0-52-generic x86_64)。

当我尝试ruby open-uri从服务器发送 GET 请求时,它会对一个特定的 IP 地址超时,但对所有其他 IP 地址都运行正常。

irb(main):001:0> open("https://www.google.ca/")
=> #<Tempfile:/tmp/open-uri20191121-3549-1dtt546>     // works
irb(main):002:0> open("https://stackoverflow.com/")
=> #<Tempfile:/tmp/open-uri20191121-3549-3j1xyi>      // works
irb(main):003:0> open("https://www.ncbi.nlm.nih.gov/") // doesn't work
Traceback (most recent call last):
       16: from (irb):3
       15: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:35:in `open'
       14: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:735:in `open'
       13: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:165:in `open_uri'
       12: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:224:in `open_loop'
       11: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:224:in `catch'
       10: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:226:in `block in open_loop'
        9: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:755:in `buffer_open'
        8: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:337:in `open_http'
        7: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:909:in `start'
        6: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
        5: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:935:in `connect'
        4: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
        3: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:937:in `block in connect'
        2: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:937:in `open'
        1: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:937:in `initialize'
Net::OpenTimeout (execution expired)
irb(main):004:0> open("https://130.14.29.110/") // 130.14.29.110 is the ip of www.ncbi.nlm.nih.gov
Traceback (most recent call last):
       16: from (irb):4
       15: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:35:in `open'
       14: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:735:in `open'
       13: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:165:in `open_uri'
       12: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:224:in `open_loop'
       11: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:224:in `catch'
       10: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:226:in `block in open_loop'
        9: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:755:in `buffer_open'
        8: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/open-uri.rb:337:in `open_http'
        7: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:909:in `start'
        6: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
        5: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:935:in `connect'
        4: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
        3: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:937:in `block in connect'
        2: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:937:in `open'
        1: from /apps/orth/.rbenv/versions/2.5.0/lib/ruby/2.5.0/net/http.rb:937:in `initialize'
Net::OpenTimeout (execution expired)

这是traceroutewww.ncbi.nlm.nih.gov 上的输出

traceroute to www.ncbi.nlm.nih.gov (130.14.29.110), 30 hops max, 60 byte packets
 1  159.89.176.253 (159.89.176.253)  1.315 ms  1.266 ms  1.265 ms
 2  138.197.248.26 (138.197.248.26)  0.800 ms 138.197.248.8 (138.197.248.8)  0.765 ms  9.825 ms
 3  138.197.244.26 (138.197.244.26)  0.899 ms 138.197.244.16 (138.197.244.16)  0.865 ms 138.197.244.30 (138.197.244.30)  1.593 ms
 4  * * *
 5  ae-1-3501.ear2.Washington1.Level3.net (4.69.206.69)  7.459 ms  7.096 ms  7.189 ms
 6  NATIONAL-LI.ear2.Washington1.Level3.net (4.59.144.190)  7.075 ms  6.621 ms  6.586 ms
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

这是我的ufw设置

Status: active

To                         Action      From
--                         ------      ----
Nginx HTTP                 ALLOW       Anywhere                  
OpenSSH                    ALLOW       Anywhere                  
Nginx HTTPS                ALLOW       Anywhere                  
Nginx HTTP (v6)            ALLOW       Anywhere (v6)             
OpenSSH (v6)               ALLOW       Anywhere (v6)             
Nginx HTTPS (v6)           ALLOW       Anywhere (v6)   

我询问了 NCBI 支持人员,他们说他们没有屏蔽我的 IP 地址或将我的 IP 地址放入黑名单。所以,我认为我的服务器出了问题。

请问我该如何诊断这个问题?

太感谢了!

相关内容