8

All:

I am new to virtualbox. I install virtualbox on a WIndow7x64 box(IP: 45.37.2.38, Mask: 255.255.255.0 Gateway:45.37.2.1) which is behind office's proxy, inside virtualbox, I install Ubuntu 14.04 server. During the installation, I set proxy credential, and use other default setting except using bridge mode connection in virtualbox(IP: 45.37.2.42, Mask: 255.255.255.0).

Right now, I run apache inside ubuntu and I can visit from windows. And in ubuntu, I can use sudo apt-get update, but can NOT ping www.google.com(which says Destination Host Unreachable.)

My route table is like:

default     45.37.2.1  0.0.0.0         UG
45.37.2.0   *          255.255.255.0   U

My questions are:

  1. Should I set proxy in somewhere? (I already set it once during installation)

  2. Is this route wrong to send request out? Why I can not ping www.google.com?

  • You cannot directly ping through an HTTP proxy. You could try using curl to check if you can access anything via the proxy; see the answers here. – mpontillo Jun 26 '15 at 20:37
7

First of all check whether you are able to ping your proxy server using Ubuntu in your virtual box. the command for this is :

ping <address_of_the_proxy_server>

If you are able to ping the proxy-server, now you can check whether your credentials are correctly set or not.Open the terminal and run env.

A lot of information will appear on the screen. Check for http_proxy and https_proxy. If they are not correctly set you can set them using a Graphical tool named ubproxy .You can download a python it to set proxy authentication. Here is the link to it.

Or else you can set proxy authentication using the following steps:

Go to /etc/apt. Create the file apt.conf if you don't have it there. Write the following lines there.

Acquire::http::proxy "http://username:password@proxyserver:port/";
Acquire::https::proxy "https://username:password@proxyserver:port/";
Acquire::socks::proxy "socks://username:password@proxyserver:port/";

Save it. You are done. If the problem persists please comment.

| improve this answer | |
  • THanks, I tested it, it can not ping the proxy server. – Kuan Jun 26 '15 at 21:13
  • Which mode are you using NAT or bridged? – Snake Eyes Jun 26 '15 at 21:17
  • Bridged like I mentioned – Kuan Jun 26 '15 at 22:36
  • 1
    have u checked env command that i have mentioned? – Snake Eyes Jun 27 '15 at 11:14
  • This fixed my problem when I installed Ubuntu 14.04 in VirtualBox with NAT behind an office firewall. Before creating this file, apt-get could not connect. After creating this file with the correct data, apt-get was able to download. – avitevet Feb 19 '16 at 22:42

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.