Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dns lookup not working while offline

i have setup my acrylic dns proxy to include some addresses to redirect to localhost- therefore i am able to redirect specific domain names to my local machine, without any need to look anything up on the internet (i don't have internet connection at places where i develop, long story).

anywyas, everything works fine when i am connected to internet

however, when i try to access the local domains when my internet connection is off (and that is quite often in my case) the web browsers will simply ignore the dns and won't even check it, writing me me off instantly by the "no internet connection" error message.

browsers seems to check the windows hosts file for the local addresses but ignores my dns proxy, containing more complex redirection that windows hosts file is simply not capable off. now i don't know how to hack firefox/chrome to check for the dns even though my internet connection is off.

does anybody have any experience with this?

the dns proxy setup details (if anyone was interested):

*.my.dev.local translates to 127.0.0.1

i am then using .htaccess to redirect user1.my.dev.local, user2.my.dev.loca., etc to specific user profiles of my website.

like image 794
user151496 Avatar asked Mar 05 '13 10:03

user151496


2 Answers

I use acrylic dns proxy too. The problem is that you need an active network interface for DNS queries to work. With loopback interface only (localhost) acrylic dns queries won't work.

I think that windows checks for active network interfaces: if no interface is found, all DNS queries will fail even without trying. In my case, it's enough to plug an ethernet cable and thus activate the ethernet interface, no matter if there is an internet connection.

So, even if you're not connected to internet, try to enable wifi or another network interface and setting a valid IP on it.

Be sure that the interface has DNS configured to 127.0.0.1 and has a valid ip, for acrylic dns proxy to work.

If you don't have any valid network interface, you could try to install a virtual interface, but I haven't tested this solution.

like image 153
Ghigo Avatar answered Oct 03 '22 15:10

Ghigo


I have hacked chrome web browser before to use a DNS server that I point to it.

For Chrome web browser it is using getaddrinfo() by default for name resolution. i.e. it asks the OS to resolve the host.

If you like to hack Chrome to use a certain name server(not the one detected by the OS) then you need to download the chromium src code and modify a few lines in the DnsConfig class - putting the IP address of the custom DNS host, after you successfully built it, enable the "Built-in Asynchronous DNS" from "chrome://flags"-type this in the chrome browser to see. You will now have a chrome browser that can use a custom DNS server independent of the DNS being used by the OS.

I believe this can be a way to solve your problem, however, you need to build a custom chrome browser, so am not sure if it's feasible for your situation.

like image 40
TravellingGeek Avatar answered Oct 03 '22 15:10

TravellingGeek