How to config proxy in Ubuntu on VirtualBox
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.
Related videos on Youtube
Kuan
Updated on September 18, 2022Comments
-
Kuan over 1 year
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?
-
mpontillo almost 9 yearsYou 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.
-
Kuan almost 9 yearsTHanks, I tested it, it can not ping the proxy server.
-
Snake Eyes almost 9 yearsWhich mode are you using NAT or bridged?
-
Kuan almost 9 yearsBridged like I mentioned
-
Snake Eyes almost 9 yearshave u checked
env
command that i have mentioned? -
avitevet about 8 yearsThis 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.