Linux – Configure a linux VM to use host computers internet connection

linuxnetworkingPROXYvirtual machinevirtualbox

I am using a software which must be configured as a "bridged network" on a Virtual Box VM. I have already tried with NAT and other configurations but none of them work. the bridged network is the only one which works.

Now the problem is that my company uses a script to configure access to internet so in Host machine internet explorer we have http://server.com/proxy.asp

If I go inside my VM and put the same URL in the browser it still cannot connect to the internet. I guess this thing requires some authentication or something.

So how can I configure my VM to connect to the internet? I could have used NAT or Shared networking but then my software on VM stops working.

other approach is that I can perhaps install a small proxy server on my host machine and then let the VM connect to this proxy server.

is this something workable? if yes, can you guide me how? or is there a better solution?

My VM is linux CentOS and my host is Windows 7 Enterprise.

Best Answer

First of all, does the VM have an IP address? Many corporate networks will only give an IP address to registered MAC addresses, and the VM's network interface will have a MAC address not registered with the company. If you don't have an IP address, then you can try to use one that's not used by another computer. Most probably you would have to do all the network configuration by hand, such as adding a default gateway and defining the name servers.

Secodnly, make sure the problem really is authentication. You can do that by running a simple curl, for example:

curl google.com

The error message it gives should make that point perfectly clear, please edit the output into your answer.

If authentication is the problem, you can add your windows username and password in the proxy URL, for example:

export HTTP_PROXY=https://username:password@company.proxy:8080

Also make sure that you can ping the proxy server by name from the VM. If you cannot, then try its IP address.

If a proxy address like http://server.com/proxy.asp as you gave in your post doesn't work, then load that page in the host system (Windows). Usually what you'll see is some JavaScript with various conditions, for the purpose of using direct connection for the various intranet sites, and usually at the bottom there is the IP address of the real proxy server. That's the address to use in the HTTP_PROXY variable.

Related Question