no internet for terminal- connect through a proxy
Solution 1
for me the following worked in our company network with proxy:
cd /etc/apt
mv ./apt.conf ./apt.conf.bak
this is to force the system to use the new file we create now.
cd ./etc/apt/apt.conf.d
create new file "95proxies" and add there the content of the apt.conf file Example:
Acquire::http::Proxy “http://proxy_url:proxy_port/”;
Acquire::ftp::Proxy “http://proxy_url:proxy_port/”;
now the system use the 95proxies file
Try
sudo apt-get update
this should work now
Solution 2
I had the same issues with the network at my university as well.
I believe that there is nothing wrong with your machine or the proxy server.
The problem is that the network admins block certain protocols and ports and only allow you to perform specific operations.
In your example, 'ping' doesn't work but lets say if you try 'ssh', you may have no issues at all.
Solution 3
If you use a proxy server, and want to access the Web through Terminal, you need to export the proxy variables.
To do that, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
bash -c export http_proxy='http://proxy_username:password@proxy_ip:port/'
Make sure you replace proxy_username, and password, with your information.
Another way is to: (from terminal)
cd etc/apt
sudo gedit apt.conf
This will open an empty document, just add the lines below, and save it
Acquire::http::Proxy “http://proxy_url:proxy_port/”;
Acquire::ftp::Proxy “http://proxy_url:proxy_port/”;
Related videos on Youtube
Sudheera
Updated on September 18, 2022Comments
-
Sudheera over 1 year
I'm using newly installed 13.04 on my lap. I've connected to wifi connection in our university and configured the proxy settings in network settings. I can access web and even software updater work nicely, but using the terminal I even can't ping into a website. "ping google.com" gives 100% packet loss
-
Steven K almost 11 yearsFirst, what is your question? All you've given is a series of facts. What's wrong? Do you want to ping google.com? No proxy will help you with that.
-
Sudheera almost 11 yearsI want to pull a source using 'bzr'. but it complains about not having internet connection. Then I tried pinging google. then I realized even that is not working.
-
Alaa Ali almost 11 yearsI think that, since you're in a university, they might be blocking ICMP (ping) packets. Were you able to ping before, on Windows perhaps or any other machine? What is the complete output of the
ping
command? There should be aReply from (<IP Address>): Destination network unreachable
kind of message. Also, let's trytraceroute -n google.com
and tell us what the output is (I think you'll first need tosudo apt-get install traceroute
to installtraceroute
). -
Sudheera almost 11 yearstraceroute output :
traceroute to google.com (74.125.236.97), 30 hops max, 60 byte packets 1 10.8.108.254 2.687 ms 20.577 ms 20.742 ms 2 192.248.8.62 6.150 ms 7.613 ms 9.987 ms 3 192.168.100.1 10.132 ms 18.938 ms 19.579 ms 4 192.168.100.6 19.812 ms 20.852 ms 21.386 ms 5 192.248.8.125 21.666 ms 22.230 ms 23.575 ms 6 * * * 7 * * *
-
-
Sudheera almost 11 yearsI get this message -> sudo: export: command not found I tried it without sudo, then it gives no errors but no effect.
-
Mitch almost 11 yearsTry the new command, and let me know.
-
Sudheera almost 11 yearsI tried but no luck :(
-
Mitch almost 11 yearsTry what I've added in my answer, and let me know.
-
Alaa Ali almost 11 years@Mitch, you forgot the almighty root!
cd /etc/apt/
=). Also, it would be weird if this worked, becauseapt.conf
is for theapt
suite, right? -
Sudheera almost 11 yearsyeah. apt works fine. :(
-
Sudheera over 10 yearsI finally found out that they have blocked most of the ports except for http, https etc :(
-
dedunumax about 6 yearsUpdating apt.conf will make sure apt-get can access internet through the proxy. But you have to set http_proxy environment variable for other terminal applications to use the proxy