Configure a linux VM to use host computers internet connection

1

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.

Knows Not Much

Posted 2014-12-25T19:20:54.003

Reputation: 205

Answers

1

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.

janos

Posted 2014-12-25T19:20:54.003

Reputation: 2 449

Thanks for responding. when I do a ping google.com it resolves the IP address of google correctly. but the pings fail.

Yes, the machine does have an IP address (without which my software will not work).

I have already tried the export HTTP_PROXY and it does not work because all I have is http://company.com/pac.asp "script" not the actual IP address and port of the proxy server.

I tried reading the pac.asp file and then try to enter IP and port manually but none of them work (I think its because the proxy needs authentication and some other firewall software).

– Knows Not Much – 2014-12-26T05:42:49.427

So firefox inside my VM with the same http://server.com/pac.asp does not work. but firefox on my windows host, with the same http://server.com/pac.asp works fine. so definitely there is some authentication involved.

So I guess I will have to use my host machine as a proxy server... but how...

– Knows Not Much – 2014-12-26T05:47:15.383

The VM can ping server.com ? To go further, the VM can curl server.com/pac.asp ? – janos – 2014-12-26T06:39:54.230

yes. the vm can connect to internal sites. it can also download the pac.asp. I have already tried putting all the IP and ports inside the PAC file directly. it does not work because of authentication to proxy. – Knows Not Much – 2014-12-26T15:55:42.857

And if you embed your username and password in HTTP_PROXY as in the example I gave you, same error? If would be good if you pasted the exact error message into your question. – janos – 2014-12-26T15:57:57.720

"I will have to use my host machine as a proxy server... but how" You could set up Internet Connection Sharing on the host. Google that phrase for instructions on how to configure it. – Charles Burge – 2017-09-29T19:20:06.073