2

I am trying to ping google.com in my ubuntu terminal. but getting an error message.

ping www.google.com
ping: unknown host www.google.com

I am behind the proxy of my university network. I have seen many examples on INTERNET of how to do this, but have none worked for me.

I am using UBUNTU 14.04 LTS (I am a new user of UBUNTU)

I have tried the following solutions

Option 1

gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http enabled true
gsettings set org.gnome.system.proxy.http host 'http://192.168.3.10'
gsettings set org.gnome.system.proxy.http port 3128
gsettings set org.gnome.system.proxy.http use-authentication true
gsettings set org.gnome.system.proxy.http authentication-user 'myusername'
gsettings set org.gnome.system.proxy.http authentication-password 'mypassword'

Finally

sudo gedit /etc/apt/apt.conf.d/20proxy

Acquire::http::Proxy "http://myusername:mypassword@192.168.3.10:8080"

Option 2

sudo -H gedit /etc/profile.d/proxy.sh
export http_proxy=http://username:password@proxyhost:port/ 
export ftp_proxy=http://username:password@proxyhost:port/
export telnet_proxy=http://username:password@proxyhost:port/

Unfortunately, neither of these worked.

1
  • try ping 8.8.8.8 and nslookup 8.8.8.8 8.8.8.8 – meccooll Sep 2 '16 at 23:25
2

Short answer: You can't if they did their job right.

Long answer: You are on a network where everything has to go over a proxy (that's why you need to set those environment variables, which by the way, should be set in /etc/environment and don't forget the exclude list no_proxy).

ping uses, by default, ICMP packets. The proxies will handle exclusively TCP packets and UDP packets if you have a socks proxy.

Proxies are a pain for the end user. Historically, they were used for performance reasons, but today they are almost exclusively used to either police the connection (your employer, your university, etc...) or avoid geoblocking (avoid being blocked geographically by Hulu, Netflix and similar).

You can get around a proxy, but it requires significant work and a "free" external server. Way are, using ssh-tunneling over https, or a VPN also simulating https connections. However, this falls entirely beyond the scope of the question.

1

If you're using a static IP you should also add DNS servers.

  1. Edit /etc/network/interfaces:

    sudo nano /etc/network/interfaces
    
  2. Below iface eth0 inet static add the following line:

    dns-nameservers 8.8.8.8 8.8.4.4
    

    This will use Google's DNS servers.

  3. Restart your network:

    sudo /etc/init.d/networking restart
    

Note: as chaos says, you can also edit /etc/resolv.conf but these changes will be overwritten on reobot.

Note2: Sometimes sudo /etc/init.d/networking restart is not enough, but a full reboot helps.

2
  • 1
    You cannot simply assume that on a proxied network, outgoing udp packets to non-internal DNS servers aren't blocked. Changing the DNS to Googles servers is only going to work if you can actually query them. You should first test that using ` dig www.google.com @8.8.8.8`. – jawtheshark Sep 2 '16 at 16:09
  • Why would you do sudo /etc/init.d/networking restart when it can break many other things? Use ifupdown. – heemayl Sep 2 '16 at 17:04
0

Open your terminal,

gedit .bashrc

then add these lines,

export http_proxy="http://myusername:mypassword@mycompanyproxy.com:8080"
export https_proxy="https://myusername:mypassword@mycompanyproxy.com:8080"

close terminal, open new terminal

sudo gedit /etc/apt/apt.conf

and add following lines,

Acquire::http::Proxy "http://myusername:mypassword@mycompanyproxy.com:8080"
Acquire::https::Proxy "https://myusername:mypassword@mycompanyproxy.com:8080"
Acquire::socks::Proxy "socks://myusername:mypassword@mycompanyproxy.com:8080"

now try to ping google

ping www.google.com

it will work for sure.

1
  • What will be the result of nvm ls -remote and nvm install with your solution? Thank you. – Frank Jan 29 '18 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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