Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Using Linux (Debian)

At my current place of employment I'm behind an ISA proxy server, I'm not in a position to make any changes on this machine.

I'm developing software and have set up a virtual machine using kvm, almost everything works fine. The VM is on a virtual network 192.168.122.0

In /etc/profile I have the following environment variables:

http_proxy=http://x.x.x.x:8080/
no_proxy=localhost,192.168.122.0/24

I have the VM's name in /etc/hosts.

From the host I can ping the VM and connect via ssh by name.

I can't use a browser to connect to an apache server running on the VM, name resolution is passed to the ISA server and I get a failure displayed that the hostname could not be found (not surprised that corporate DNS doesn't know about my VM)..

I get the same in all browsers, so

elinks http://vmname

fails, even though

elinks -lookup vmname

returns the correct IP address for the VM.

However, "getent hosts vmname" returns the correct local IP for the VM.

If I do :

http_proxy="" elinks http://vmname

then I can connect via http fine.

Is there a configuration somewhere that I've missed? I've looked in /etc/nsswitch.conf & /etc/host.conf & /etc/resolv.conf

I notice that "host vmname" returns 2(SERVFAIL) rather than 3(NXDOMAIN). Is it possible to configure this such that I can connect both to external servers & my internal VM without re-configuring the browser for each?

share|improve this question
    
Do you want traffic to the VM to bypass the proxy, or go through the proxy but fix the DNS issue? –  mgorven Feb 19 '13 at 17:04
    
I want the traffic to the VM to bypass the proxy. The subnet the VM is on is in the no_proxy environment variable. Why do the browsers not get the address from /etc/hosts? –  Andy Ruddock Feb 21 '13 at 10:56

3 Answers 3

First you should add the <ip> vmname to your local /etc/hosts

Then also add your local network in the broswer settings to be an exception for which it shouldn't use the proxy, like you seem to have done it in /etc/profile already.

Then it should work.

share|improve this answer
    
> I have the VM's name in /etc/hosts –  Andy Ruddock Feb 20 '13 at 9:35
    
When there is a proxy enabled, DNS resolution is done in the proxy not in the local machine. –  diegows Mar 13 '13 at 12:35

Add the VM's name to the no_proxy variable.

no_proxy=localhost,192.168.122.0/24,vmname

And this should get you fixed. Your problem is that all the browsers are sending the HTTP request to your ISA proxy.

share|improve this answer
    
Same as before, there are no http requests, the browsers are trying to get vmname from dns, failing & not trying /etc/hosts. –  Andy Ruddock Feb 21 '13 at 11:04

If you have a proxy, the DNS resolution is done in the proxy. You can't change that. Modifying /etc/hosts is useless. If the destination web server doesn't have virtualhosts, you can try connecting using the IP address. But if there are VirtualHosts, you can't do anything legal.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.