0

I'm trying to move my development stuff over to a small local Debian based server running ispconfig, and need to basically make it so that *.dev is routed to a specific IP. So for example I went to http://some-site.dev it would go to 192.168.0.150

Is there any way of doing this without a fancy/expensive router?

Thanks

Sk446
  • 103
  • 3
  • It's really not clear what it is you're trying to do. But it sounds like all you need to do is run `bind` on that machine, make it authoritative for `dev.` and put in a wildcard entry for `*.dev` that maps to 192.168.0.150. – David Schwartz Feb 23 '12 at 23:29
  • Thanks David, would I be right in thinking I then just have an extra dns record on each computer for the bind server? – Sk446 Feb 23 '12 at 23:39
  • Each local computer would have to use that machine as its DNS server. – David Schwartz Feb 23 '12 at 23:49

2 Answers2

2

The only way this would be possible would be by hosting your own DNS server and setting up a wildcard rule that resolves all *.dev to a specific address.

Alternatively, if you're only going to be doing this for one machine, dnsmasq appears to do what you're asking. On your workstation;

echo "192.168.0.50  dev" >> /etc/hosts
sudo port install dnsmasq
echo "address=/.dev/192.168.0.50" >> /opt/local/etc/dnsmasq.conf
open your network settings and add 127.0.0.1 as a dns server
ping a *.dev domain to see if the dns forward has worked

If it does work, whenever you enter a *.dev domain, it will automatically forward you to 192.168.0.50

qweet
  • 731
  • 5
  • 11
  • 2
    DNS masq can be used for more then just your local machine, it is the DNS server built-in to the firmware of many router appliances. – Zoredache Feb 23 '12 at 23:53
1

In Windows, I would say 'modify your hosts file'. It turns out that my answer is exactly the same for Mac. The link will show you how to modify the HOSTS file in OSX, allowing you to resolve specific hostnames (such as http://site-name.dev) on a network where you have no DNS server.

Since my answer was downvoted, I figured I might as well expand on WHY I think this is the best option for you. Here's a Microsoft article explaining the concept of hosts files (it also touches on the idea that *nix-based systems have the same file) and here's a great blog post touching on the same thing, with the content focused on Mac's.

Before DNS was prevalent, the hosts file was the way to go for specific name resolution. Since you do not have a DNS server (and building one can be a PITA, and overkill for what you explained you needed) just use the hosts file.

JohnThePro
  • 2,595
  • 14
  • 23
  • Why the downvote? Because it's the right answer? :) – JohnThePro Feb 24 '12 at 15:03
  • Hi John, thanks for your answer - not sure who downvoted you but it wasn't me :) I'll possibly end up having to continue editing the hosts file for each record. It's just a bit os a pain as you cant do a wildcard entry for a TLD on the OSX/NIX hosts file. – Sk446 Feb 24 '12 at 15:44
  • Unfortunately, yes. No wildcard support, but still a bit easier than getting a DNS server set up. – JohnThePro Feb 24 '12 at 15:49
  • Yes, very true! . – Sk446 Feb 24 '12 at 15:50