使用 wget 访问互联网时出现错误消息:连接到本地主机 (localhost)|::1|:8080...失败:连接被拒绝

使用 wget 访问互联网时出现错误消息:连接到本地主机 (localhost)|::1|:8080...失败:连接被拒绝

运行时:

wget https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb

结果如下:

converted 'https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb' (ANSI_X3.4-1968) -> 'https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb' (UTF-8)
--2020-01-05 12:12:22--  https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8080... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:8080... failed: Connection refused.

这里有几个与服务器使用相关的问题,但我没有找到一个与客户端使用相关的问题。所需的文件存在于 gitlab.com 上,我可以通过浏览器毫无问题地下载它。

我没有 iptables 规则阻止任何事情:

iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

这是我的网络配置:

ifconfig 
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet adr:192.168.0.xxx  Bcast:192.168.0.255  Masque:255.255.255.0
          adr inet6: xxxx::xxxx:xxxx:xxxx:xxxx/64 Scope:Lien
          adr inet6: xxxx::xxxx:xxxx:xxxx:xxxx/64 Scope:Global
          adr inet6: xxxx::xxxx:xxxx:xxxx:xxxx/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:419919 errors:0 dropped:0 overruns:0 frame:0
          TX packets:238886 errors:19 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000 
          RX bytes:519444509 (495.3 MiB)  TX bytes:27771976 (26.4 MiB)
          Interruption:17 

lo        Link encap:Boucle locale  
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1333 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1333 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1 
          RX bytes:150478 (146.9 KiB)  TX bytes:150478 (146.9 KiB)

如果我查看本地有哪些服务器可供测试:

netstat -an | grep "LISTEN "
tcp        0      0 0.0.0.0:54729           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:42711           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6463          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:36479           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:53953           0.0.0.0:*               LISTEN     
tcp6       0      0 :::49801                :::*                    LISTEN     
tcp6       0      0 :::5355                 :::*                    LISTEN     
tcp6       0      0 :::111                  :::*                    LISTEN     
tcp6       0      0 :::45331                :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 :::3128                 :::*                    LISTEN     
tcp6       0      0 ::1:25                  :::*                    LISTEN     
tcp6       0      0 ::1:6010                :::*                    LISTEN     
tcp6       0      0 ::1:6011                :::*                    LISTEN     
tcp6       0      0 :::56891                :::*                    LISTEN     
tcp6       0      0 :::2049                 :::*                    LISTEN     
tcp6       0      0 :::33665                :::*                    LISTEN 

然后尝试(不确定这是否是一个相关的测试):

wget localhost:6010
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8080... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:8080... failed: Connection refused.

请问有什么想法吗?

答案1

该命令的输出wget表明您正在使用代理人

在运行以下命令相同的正在运行wget命令的终端:

$ env | grep -i proxy

然后对上面输出中列出的每个变量运行unset命令。例如:

$ unset http_proxy

再次检查变量是否已被删除(再次使用env | grep -i proxy)。

重试该wget命令。

以上只是临时解决方案。要永久删除代理定义,请转到系统设置 ( gnome-control-center),导航至网络网络代理并将其禁用。

相关内容