Don't you hate it when DNS is down?

Solaris

Official something...
My ISP (BT) quite often have DNS failures that stop me surfing the web or reading my mail.

This can be a common cause of pages you know are there but fail to load. An easy way to get around this is to make yourself a hosts file with the ip addresses of your favourite web sites.

To get the ip address use the Terminal command nslookup:

nslookup www.cnn.com

Your DNS server responds with something like:

$ nslookup www.cnn.com
Server: localhost
Address: 127.0.0.1

Name: cnn.com
Addresses: 64.12.50.121, 207.25.71.5, 64.12.50.217, 207.25.71.23
207.25.71.25, 207.25.71.27, 207.25.71.29, 64.12.50.153, 64.12.50.249
64.12.48.217, 64.12.48.249
Aliases: www.cnn.com


As you can see some servers have more than one address. The first one will do. Then add this ip address and hostname to NetInfo (for OS X, which I won't go into here) or your OS 9 hosts file. For those who don't know, pre OS X host files are just text files in the format:

[hostname] [ip address class] [ip address]

with each record seperated by a blank line, eg:

www.cnn.com A 64.12.50.121

www.apple.com A 17.254.0.91

Use the TCP/IP control panel to select the hosts file (Advanced user mode), and you're singing. Your favourite sites will be available now, even when your ISP's DNS servers crash.
 
Originally posted by Solaris
My ISP (BT) quite often have DNS failures that stop me surfing the web or reading my mail.

This can be a common cause of pages you know are there but fail to load. An easy way to get around this is to make yourself a hosts file with the ip addresses of your favourite web sites.

To get the ip address use the Terminal command nslookup:

nslookup www.cnn.com

Your DNS server responds with something like:

$ nslookup www.cnn.com
Server: localhost
Address: 127.0.0.1

Name: cnn.com
Addresses: 64.12.50.121, 207.25.71.5, 64.12.50.217, 207.25.71.23
207.25.71.25, 207.25.71.27, 207.25.71.29, 64.12.50.153, 64.12.50.249
64.12.48.217, 64.12.48.249
Aliases: www.cnn.com


As you can see some servers have more than one address. The first one will do. Then add this ip address and hostname to NetInfo (for OS X, which I won't go into here) or your OS 9 hosts file. For those who don't know, pre OS X host files are just text files in the format:

[hostname] [ip address class] [ip address]

with each record seperated by a blank line, eg:

www.cnn.com A 64.12.50.121

www.apple.com A 17.254.0.91

Use the TCP/IP control panel to select the hosts file (Advanced user mode), and you're singing. Your favourite sites will be available now, even when your ISP's DNS servers crash.

That'd be great if it worked. I can't get that to work for me. I should be able to have my own internal names like:
supermac A 192.168.123.1 or something right? I tried changing the A to a C for a class C IP address but that doesn't work either.
 
Originally posted by testuser
As far as I have read, Mac OS 9 (and earlier) will recognize hostfiles in the format you listed:<pre><font face="courier" size="2" >hostname.domain A xxx.xxx.xxx.xxx<br>alias CNAME xxx.xxx.xxx.xxx<br>alias CNAME hostname.domain</font></pre>I have also read that the A stands for a class A network, but I believe that B or C, etc. will NOT be recognized as valid. The only two options that I have read about are CNAME and A. Please correct me if I am wrong.

For those using OS X, there is a different method. First create a hosts file in this format:
<pre><font face="courier" size="2">xxx.xxx.xxx.xxx hostname.domain<br>xxx.xxx.xxx.xxx alias</font></pre>
Don't forget unix line breaks if you used a text editor. This must be uploaded to the NetInfo database:
sudo niload hosts / < hosts.txt
where hosts.txt is the name of the file that you have created. You could also do this using the NetInfo Manager program, and edit the /machines directory. You can check your hosts with:
nidump hosts /
Now restart the NetInfo server
sudo kill -HUP `cat /var/run/lookupd.pid`

The problem I have is that if your DNS is down, it still takes a while to timeout from the network before checking the local hosts file. I just haven't yet bothered with setting up a /locations/lookupd directory to make my Mac check the local hosts directory before the DNS servers. Anyone up to posting the quick & dirty way to do this??

I got it to work very easily with Netinfo Manager. All I had to do was add a new subdirectory in the machines directory and add the proper things in it. I didn't even have to restart it or anything. I'm not sure why it won't work in OS9 though, because from what I've read, it should.
 
What would be really great is if we could configure hostname caching at the OS level. Perhaps being able to set the expire to a day or so, and providing some means of forcing a premature update would be quite effective. That could be really cool...
 
Originally posted by testuser
devonferns,

The hosts file will not work under OS 9 unless it has Mac line breaks (CRs). Make sure that you did not save a file with unix line breaks. I can't think of any other reason why it would not work. Did you go into the TCP/IP control panel, select advanced, and then select "hosts" and choose your host file?

Yes, I did save the file with Mac line breaks. At least I think I did. I used Simpletext to do it which I believe works fine.

Yes, I've gone into the TCP/IP control panel and selected the hosts file.
 
Originally posted by testuser
As far as I have read, Mac OS 9 (and earlier) will recognize hostfiles in the format you listed:<pre><font face="courier" size="2" >hostname.domain A xxx.xxx.xxx.xxx<br>alias CNAME xxx.xxx.xxx.xxx<br>alias CNAME hostname.domain</font></pre>I have also read that the A stands for a class A network, but I believe that B or C, etc. will NOT be recognized as valid. The only two options that I have read about are CNAME and A. Please correct me if I am wrong.

For those using OS X, there is a different method. First create a hosts file in this format:
<pre><font face="courier" size="2">xxx.xxx.xxx.xxx hostname.domain<br>xxx.xxx.xxx.xxx alias</font></pre>
Don't forget unix line breaks if you used a text editor. This must be uploaded to the NetInfo database:
sudo niload hosts / < hosts.txt
where hosts.txt is the name of the file that you have created. You could also do this using the NetInfo Manager program, and edit the /machines directory. You can check your hosts with:
nidump hosts /
Now restart the NetInfo server
sudo kill -HUP `cat /var/run/lookupd.pid`

The problem I have is that if your DNS is down, it still takes a while to timeout from the network before checking the local hosts file. I just haven't yet bothered with setting up a /locations/lookupd directory to make my Mac check the local hosts directory before the DNS servers. Anyone up to posting the quick & dirty way to do this??

A records are Host records. They should hold only the hostname and the IP address of the hostname. CNAME is short for Canonical Name which allow you to create an alias to link with an A record. There are several different kinds of records that are implemented into DNS, though I have not looked into NetInfo, I believe that NetInfo would support the current DNS standards.

Microsoft has a fairly good Whitepaper called 'DNS and Microsoft Windows NT 4.0'. .... Yes it's Microsoft, but nonetheless the DNS standard is explained in detail in there.
 
You could also just add a whole bunch of DNS servers in TCP/IP settings - only when your ISP's DNS servers go down would your computer ever bother anyone else's servers.

Just read customer FAQs on other ISP's websites, and add their DNS servers after your own - it would be a bit rude to put them before the ones your own ISP offers, maybe...
 
I haven't looked for any OS X related DNS or NetInfo yet, but I'll posts links as soon as I see 'em.
 
Back
Top