How to config proxy in Ubuntu on VirtualBox

44,607

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.

Share:
44,607

Related videos on Youtube

Kuan
Author by

Kuan

Updated on September 18, 2022

Comments

  • Kuan
    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:

    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?

    • mpontillo
      mpontillo almost 9 years
      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.
  • Kuan
    Kuan almost 9 years
    THanks, I tested it, it can not ping the proxy server.
  • Snake Eyes
    Snake Eyes almost 9 years
    Which mode are you using NAT or bridged?
  • Kuan
    Kuan almost 9 years
    Bridged like I mentioned
  • Snake Eyes
    Snake Eyes almost 9 years
    have u checked env command that i have mentioned?
  • avitevet
    avitevet about 8 years
    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.