How to config proxy in Ubuntu on VirtualBox
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:
Should I set proxy in somewhere? (I already set it once during installation)
Is this route wrong to send request out? Why I can not ping www.google.com?
Solution 1:
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.