Error Message When Using Wget to Internet: Connecting to Localhost (Localhost)|: :1|:8080. .. Failed: Connection Refused
When Running: Wget Here Is the Result: Converted ' (Ansi_X3.4-1968) -> ' (Utf-8) --2020-01-05 12:12:22-- Resolving Localhost (Localhost). .. ::1, 127.0.0.1...
when running:
wget
Here is the result:
converted ' (ANSI_X3.4-1968) -> ' (UTF-8)
--2020-01-05 12:12:22--
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.
There are several questions here related to server use, but I have not found one for client use. The wanted file exists on gitlab.com and I can download it via the browser without any problem.
I have no iptables rule preventing anything:
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
Here is my network configuration:
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)
If I look at what servers are available locally for testing:
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
Then try (not sure this is a relevant test):
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.
Any idea please?
1 Answer
The output of the wget command suggests that you are using a proxy.
Run the following command on the same terminal that you are running the wget command:
$ env | grep -i proxy
Then run unset command for every variable listed from the above output. For example:
$ unset http_proxy
Check once more that the variable is removed (using again env | grep -i proxy).
Re-try the wget command.
The above is only a temporary solution. To permanently remove the proxy definition, go to system settings (gnome-control-center), navigate to Network and Network Proxy and disable it.