Configure a linux VM to use host computers internet connection

6,920

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:[email protected]: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.

Share:
6,920

Related videos on Youtube

Knows Not Much
Author by

Knows Not Much

Updated on September 18, 2022

Comments

  • Knows Not Much
    Knows Not Much 5 months

    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
    Knows Not Much about 8 years
    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 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
    Knows Not Much about 8 years
    So firefox inside my VM with the same server.com/pac.asp does not work. but firefox on my windows host, with the same 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...
  • janos
    janos about 8 years
    The VM can ping server.com ? To go further, the VM can curl server.com/pac.asp ?
  • janos
    janos about 8 years
    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.
  • Charles Burge
    Charles Burge over 5 years
    "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.