Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using a proxy to connect to internet. I can use firefox and software center. but can not ping google. when I try it says


ping: unknown host

I have tried with ip address also. it says Destination Host Unreachable.

please help. Thanks in advance.

share|improve this question
That doesn't matter in this case... – the_Seppi Mar 2 '14 at 15:44
yes, You are right. I found that I am also suffering from same problem. – g_p Mar 2 '14 at 15:46
If you're accessing through proxy.. then have you tried applying proxy system wide under network... :) – AzkerM Mar 2 '14 at 15:50
Little strange problem. I can ping when I am connected using ppp interface but can't when using my samsung wave mobile wifi hotspot. – g_p Mar 2 '14 at 15:55
I guess the phone accesses the internet via 3G etc. so you don't need the proxy there – the_Seppi Mar 3 '14 at 17:04
up vote 1 down vote accepted

For bash commands you have to set the proxy seperately. For this, you have to set a environment variable, e.g.:

ping    # can't resolve, no proxy set
ping    # works, proxy set for this bash session.

Replace the address and the port with your proxy configuration. If you're always behind this proxy, add the export http_proxy... command to ~/.bashrc so it gets executed every time you start a new bash session.

Or to execute a single command with proxy settings and without setting environment variables, use env, e.g.:

env ping
sudo env apt-get install cowsay

To use other services, e.g. HTTPS or FTP you have to set different variables:

share|improve this answer
This seems to contradict Has ping gained new functionality? – Carsten S Sep 13 '15 at 16:20
Actually, the SU answer is only partially correct: While the ICMP protocol itself is on the IP layer, the ping utility itself operates on the application layer. My CS teacher once had some problems in explaining this properly, and simply declared ping as a hybrid of ISO/OSI layer 3 and 7. – the_Seppi Sep 13 '15 at 18:50
Thanks for the reply. I still do not see how an http proxy should help, but I do not currently have access to a system where I could test this. – Carsten S Sep 13 '15 at 19:09

Try this:

Open a terminal. Ctrl + Alt + T

Run it:

$ sudo -i
# nano /etc/bash.bashrc

Put the following lines in the file:

export http_proxy=http://my_proxy_server:3128/
export https_proxy=http://my_proxy_server:3128/
export ftp_proxy=http://my_proxy_server:3128/
export socks_proxy=socks://my_proxy_server:3128/

Ctrl + U, paste. Ctrl + O, save file. Ctrl + X, close nano.

$ sudo -i
# nano /etc/environment

Put the following lines in the file


Ctrl + U, paste. Ctrl + O, save file. Ctrl + X, close nano.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.