使用 wget 连接 Internet 时出现错误消息:连接到 localhost (localhost)|::1|:8080... 失败:连接被拒绝

lal*_*rde 0 internet localhost connection

运行时:

wget https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb
Run Code Online (Sandbox Code Playgroud)

结果如下:

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.
Run Code Online (Sandbox Code Playgroud)

这里有几个关于服务器使用的问题,但我没有找到一个供客户端使用的。想要的文件存在于 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  
Run Code Online (Sandbox Code Playgroud)

这是我的网络配置:

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)
Run Code Online (Sandbox Code Playgroud)

如果我查看本地可用于测试的服务器:

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 
Run Code Online (Sandbox Code Playgroud)

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

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.
Run Code Online (Sandbox Code Playgroud)

请问有什么想法吗?

Fed*_*eli 6

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

在运行命令的同一终端上运行以下wget命令:

$ env | grep -i proxy
Run Code Online (Sandbox Code Playgroud)

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

$ unset http_proxy
Run Code Online (Sandbox Code Playgroud)

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

重试该wget命令。

以上只是暂时的解决办法。要永久删除代理定义,请转到系统设置 ( gnome-control-center),导航到网络网络代理并禁用它。