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.

We'd like to set things up on our developers' Windows boxes such that all .dev domains resolve to localhost. On Unix systems, firing up dnsmasq with a single additional line to hosts would do it, but dnsmasq is sadly Unix-only. On the Windows side, I'm not aware of an equivalent solution, either built-in or available in a third-party utility. The best I've been able to come up with are some PowerShell scripts, running as administrator, that would alter c:\Windows\System32\Drivers\etc\hosts directly—ugly and error-prone at best.

What's the right way to do this? Does no solution meaningfully exist right now?

share|improve this question
    
I don't think the hosts files in Windows supports wildcards. You could do what TheFiddlerWins is suggesting and set a wildcard A record to 127.0.0.1, but yes it would go to all Windows clients using that DNS server. Probably doesn't matter since it is a .dev though. But mixing "production" and "development" is typically taboo. Why the need? Can't the dev peeps create their own entries as they build up a local site/server/host? –  TheCleaner Sep 17 '13 at 15:58
    
The issue here is that there are a collection of sites (foo.com, bar.com, etc.) that talk to each other; we'd like to make it so that their location on the dev boxes is similar (foo.dev, bar.dev), which allows for consistency without editing the hosts file for each site. Making new virtual hosts in IIS would be sufficient. –  Benjamin Pollack Sep 17 '13 at 16:06
add comment

3 Answers

up vote 3 down vote accepted

Do you have a .dev zone in DNS already? You can create a wildcard entry where *.dev goes to the loopback.

share|improve this answer
    
We don't; you're proposing doing this at the AD level, so that any machines on the domain would pick it up? –  Benjamin Pollack Sep 17 '13 at 15:48
    
It's not really at the "AD" level, although if you use AD integrated DNS and create the zone as such it would work out that way - it would be for any machine that resolved against that DNS server(s). –  TheFiddlerWins Sep 17 '13 at 17:22
    
Got it. That sounds a lot saner than doing this on each box. –  Benjamin Pollack Sep 17 '13 at 19:06
add comment

Alternative: get your devs to just append .localtest.me, which is a public DNS zone that already exists (with a * A record) for this purpose.

share|improve this answer
    
I'm not sure that adding an untrusted public domain to your workflow is a great plan! –  JamesRyan Jan 15 at 23:48
    
If this concerns you, it would be simple to add a DNS test to whatever monitoring solution you use. If the DNS for localtest.me has changed in the last second, make it blast an alert to your devs. –  Ross Presser Jan 17 at 16:20
add comment

I can recommend http://localhost.tv - all subdomains resolve to 127.0.0.1

share|improve this answer
    
I'm not sure that adding an untrusted public domain to your workflow is a great plan! –  JamesRyan Jan 15 at 23:48
add comment

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.