Updating mac os x 10 3 9 hostfile
This morning I was up a few hours earlier than normal today, and was looking forward to getting in some solid programming hours earlier so I wouldn’t work late tonight.Instead, I spent about four hours fighting a new change (I’d call it a bug) in Mac OS X Lion.
So I would go into my terminal and ping the domain. Apparently, the terminal and some of the BSD Unix tools correctly use /etc/and the correct order of /etc/hosts first and then DNS servers.You can test this by running the command “scutil –dns”:[code]Justin-Carmonys-Mac Book-Pro-2:etc justin$ scutil –dns DNS configurationresolver #1 nameserver : 22.214.171.124 nameserver : 192.168.1.1resolver #2 domain : local options : mdns timeout : 5 order : 300000resolver #3 domain : 254.169.options : mdns timeout : 5 order : 300200resolver #4 domain : 8.e.f.ip6options : mdns timeout : 5 order : 300400resolver #5 domain : 9.e.f.ip6options : mdns timeout : 5 order : 300600resolver #6 domain : a.e.f.ip6options : mdns timeout : 5 order : 300800resolver #7 domain : b.e.f.ip6options : mdns timeout : 5 order : 301000DNS configuration (for scoped queries)resolver #1 nameserver : 127.0.0.1 if_index : 5 (en1) flags : Scoped[/code]I spent hours and hours googling, finding a bunch of people with this same problem, but no solution on how to fix the ordering.I have my suspicions why Apple made this change, which I’ll address later on.)The only solution we have, that I could find, is to use your own DNS Server locally on your own machine. Now, the problem with this solution is that it isn’t nearly as quick and easy to manage DNS entries. It is a lightweight DNS server that is easy to configure.However, it had one key feature we needed: it will read the /etc/hosts file and serve it’s entries.The /etc/hosts file looks something like this:[code]### Host Database## localhost is used to configure the loopback interface# when the system is booting.
Do not change this entry.##127.0.0.1 localhost255.255.255.255 broadcasthost::1 localhostfe80::1%lo0 localhost127.0.0.1 local.joind.in209.1 my actual /etc/hosts file contains 83 entries.
I haven’t been able to figure out the difference between Lion installs that work correctly, and those that don’t.
So if you are have the following problems, the suggestions below will work to fix it.
This is where your computer would set “localhost” is the IP “127.0.0.1”. For example, when I work on joind.in, I use MAMP and create a Virtual Host for the code under the server name local.(i.e. I don’t have access to the DNS, so I create an entry in my /etc/hosts file.
You have to have admin permissions to edit the file, so I normally run the command “sudo nano /etc/hosts” and make my changes and then save.
Some are just short cuts to machines I often connect to.