I'm connected to the Internet:
user5@system5:~$ ifconfig
enp4s0 Link encap:Ethernet HWaddr 40:16:7e:82:55:5b
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:19
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:5316 errors:0 dropped:0 overruns:0 frame:0
TX packets:5316 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:617751 (617.7 KB) TX bytes:617751 (617.7 KB)
wlp3s0 Link encap:Ethernet HWaddr 9c:d2:1e:61:c0:f3
inet addr:10.64.117.148 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::c5b3:e44b:49ec:f18/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26669 errors:0 dropped:0 overruns:0 frame:0
TX packets:29074 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16174458 (16.1 MB) TX bytes:8474175 (8.4 MB)
But when running a curl command, it says unable to connect to 127.0.0.0.
user5@system5:~$ curl -L https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 8888: Connection refused
gpg: no valid OpenPGP data found.
why is it trying to use localhost? I swear I've used curl
in the past without issue.
EDIT:
Hosts file in /etc/hosts
:
127.0.0.1 localhost
127.0.1.1 system5.
DNS settings in /etc/network/interfaces
:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
EDIT 2:
The output of env
command showed
http_proxy: 127.0.0.1
I did indeed install Fiddler the other day. I set up the proxy for Firefox, but was unaware it affected my system proxy settings as well.
To fix the curl issue I used gnome GUI: System Settings/Networking/Network Proxy/None/Apply Systemwide. Had to restart computer for changes to take effect.
It seems your curl is trying to connect to a proxy server instead of connecting to the internet directly.
Check your environment by command env and see if there is any http_proxy.
Also, check if you have some debugging tools like Fiddler or TCPDump or Charles proxy or Jmeter setup, as they may create a proxy server.
You can also run curl with -v to get further info: curl -v -L https://packages.microsoft.com/keys/microsoft.asc