Using dnsmasq on OS X when not connected to the Internet

2

I'm routing dns requests through dnsmasq so that domains I'm using for local development point to 127.0.0.1. This works great when I'm connected to the Internet via Wi-Fi or ethernet, but I start to have problems when I'm not connected to the Internet at all.

In dnsmasq.conf, I have this setting:

address=/gentoo/127.0.0.1

Turning off all network connections, I run:

$ dscacheutil -q host -a name test.gentoo
name: test.gentoo
ip_address: 127.0.0.1

$ ping test.gentoo
PING test.gentoo (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.043 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.107 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.177 ms
^C
--- test.gentoo ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.043/0.109/0.177/0.055 ms

So that seems to be working fine. But if I try to open http://test.gentoo/ in Chrome, I get the message:

Unable to connect to the Internet Google Chrome can't display the webpage because your computer isn't connected to the Internet.

You can try to diagnose the problem by taking the following steps:

Go to Applications > System Preferences > Network > Assist me to test your connection. Error 106 (net::ERR_INTERNET_DISCONNECTED): The Internet connection has been lost.

Chrome sees that I don't have a network connection, and it doesn't even try to make the request.

Any idea how I can work around this? Can I create a dummy network interface to convince Chrome I'm connected to the Internet? Can I make it send the requests even though I'm not connected? Any other ideas?

I tried the solution at https://serverfault.com/q/22419/92378 but it did not work, as I'm on OS X 10.7.3, so resolver is ignored when not connected to a network.

Jonathan Brinley

Posted 2012-04-30T18:54:29.810

Reputation: 21

No answers