CentOS 7 wget 正在連接 127.0.0.1:8118... 失敗:拒絕連接。

正在使用wget下載包的時候,出現了拒絕連接的錯誤

[root@CentOS7 local]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
--2020-04-11 23:46:24--  http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
正在連接 127.0.0.1:8118... 失敗:拒絕連接。

查找問題的方法如下:

  1. 查看本地端口是否被佔用
[root@CentOS7 local]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1151/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1480/master         
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1612/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1150/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1151/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1480/master         
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
tcp6       0      0 :::22                   :::*                    LISTEN      1150/sshd           

  • 本地端口8118並沒有被佔用
  1. 查看本地網絡代理
[root@CentOS7 local]# export | grep -i proxy
declare -x ftp_proxy="http://127.0.0.1:8118"
declare -x http_proxy="http://127.0.0.1:8118"
declare -x https_proxy="http://127.0.0.1:8118"

  • 網絡http確實有代理,幾乎可以斷定是這個代理引發的錯誤。

解決辦法:

  • 嘗試關閉代理,然後重新使用wget下載
[root@CentOS7 local]# unset http_proxy 
[root@CentOS7 local]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
--2020-04-11 23:48:38--  http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
正在解析主機 jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)... 150.65.7.130, 2001:df0:2ed:feed::feed
正在連接 jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)|150.65.7.130|:80... 已連接。

wget連接成功!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章