I got tired of manually inserting lines into my /etc/hosts
file and decided to look for other solutions. The DD-WRT router has a DNSMAsq feature in which I list domains that are supposed to be internal domains to be resolved to its local IP. I still have to insert lines but now it’s more organized and better than seeing mumbo jumbo in your hosts file.
Here are my steps: [gist]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you don't have Homebrew installed, you should. Do this. | |
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" | |
# Install DNSMasq from Homebrew | |
brew install dnsmasq | |
# Create a directory for virtual hosts files | |
mkdir -p /usr/local/etc/dnsmasq.d | |
# Create a config for DNSMasq | |
vim /usr/local/etc/dnsmasq.conf | |
# Insert the following settings | |
server=8.8.8.8 # Public upstream DNS server 1 for non-local domains - Google | |
server=208.67.222.222 # Public upstream DNS server 2 for non-local domains - OpenDNS | |
server=208.67.220.220 # Public upstream DNS server 3 for non-local domains - OpenDNS | |
conf-dir=/usr/local/etc/dnsmasq.d # Put virtual hosts in a separate file/directory structure | |
# Start DNSMasq at bootup | |
sudo cp /usr/local/Cellar/dnsmasq/2.60/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons | |
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist |