Letter Re: A Simple IP Address Conversion Methodology

JWR,
In reference to the recent change in Internet Protocol (IP) address for SurvivalBlog, I thought I’d describe a method to help people set up their computers to use it without DNS names.

How to add important internet addresses to your computer.
I’m using the new SurvivalBlog.com IPv4 address change as an example, I also recommend adding your mail server, and other important host names too.

Audience:  I’ll try and keep the techno-babble to a minimum, so that the largest audience possible can use this.  Any Domain Name Server (DNS) experts or System Administrators out there will probably pull their hair out over the following technical generalizations, but giving instructions on setting up a DNS cache server,  secondary out of country DNS servers,  or your own DNS/NIS/YP server, would greatly restrict the number of people that can use this.

A little background:  

Computers really don’t use names like SurvivalBlog.com, they use something called an IPv4 address (this was simply called called an IP address before IPv6 came around). You don’t see this function take place because a component called DNS has looked up the host name e.g.  ‘survivalblog.com’ and converted it to an IP address for you.   Think of it as the world’s biggest telephone book.  When you want to call a number you found in a telephone book, you type the number not the name of the company or person.  Your brain does this conversion; it sees the name, and looks at the number.  Computers use DNS to do this conversion for you.  By adding host names and their IP addresses directly to a text file on your computer, you can bypass the need for a DNS for those specific lookups.  So, if DNS goes down, your computer will still be able to look it up for you.

Why is having a local copy of the hostname to IP lookup important?  
This is where things get a little fuzzy. Instead of a technical outline,  I’ll list what some possible issues would be, and whether or not this method would help.

• Congress or the FCC passes a law or institutes a rules change requiring some web sites be removed from US-owned DNS servers, and your favorite ones are on the list: YES 
• Your local ISP has blocked your favorite web site: NO (in most cases) – these blocks are usually by means of IP address or by entire DNS domains.
•An ‘anonymous’ hackers has corrupted or manipulated the DNS servers that you use, directing your connections to their favorite web site: YES (some variations exist, but in almost all cases your local lookup is prioritized over DNS)
• A powerful geomagnetic storm hits, your protected computer is fine: NO (in most cases all infrastructure would be impacted, although the file would still work, the connection to the other servers would not)
• Hyperinflation hits, no one at your ISP shows up for work, systems start going offline, starting with your DNS server: YES, for a little while.

Setting it up:

Most personal computers, regardless of whether they use Windows, Apple or UNIX operating systems use essentially the same method for storing hostname to IP mappings on the computer. It’s called a ‘hosts’ file on Apple and UNIX, and  Windows XP.  This is a text file where you enter the IP address and the hostname into.  The file has to be in a text (ASCII) format, so you should use “Notepad” or “edit”  on Windows, or “vi” or “Textedit” on UNIX/Apple. 

Note that it is important to only add your new entries (or modify existing ones). Do not edit any line with: localhost, loghost, broadcasthost, or your computers hostname! And it is critical to keep in in a ‘text’ format. You should not use something like MS Word. (Exceptions? Yes, but making sure that you used MS Word correctly to save in ASCII format is beyond the scope of this simple how-to document.)

Opening the hosts file (varies, by platform):

Apple OS:

Applications->Utilities->Terminal

In the terminal window type:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

[enter your login password]

[add the file changes described below]

Save the file. Type: Command – S

Finally, either restart your computer or go back to the Terminal window and enter:

dscacheutil -flushcache [this clears your DNS cache)

 

UNIX/Linux OS:

su –

[enter your root password]

nano /etc/hosts

[add the file changes described below]

Control – O (overwrites the old file)

Control – X (exits the nano text editor)

Windows XP OS: 

Start->Run-> 
Enter ‘notepad’

In notepad open c:\windows\system32\drivers\etc\hosts

[add the file changes described below]

Control – S

[Note: The hosts file has no extensions.  It will automatically add a “.txt” file name extension to the end of the file, so you will need to click on ‘No extensions’.

Updating the file (all platforms):

[The following file change example is for an Apple computer–note that some operating systems won’t have localhost/broadcasthost/loghost items]

[NOTE: It is critical not to change loghost, broadcast, localhost or your hostname]

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost.

[NOTE: Scroll down to the bottom of your localhost list and ADD any new entries. Again, it is critical not to change loghost, broadcast, localhost or your hostname.]

# Add SurvivalBlog
95.143.193.148 survivalblog.com survivalblog.se survivalblog survivalblog.com survivalblog.se

Then Save the file, and you are done!

Now, if DNS goes down, or if it is hacked, or your favorite server is removed from it, then you can still do a lookup via the hostname.

I hope this helps. – Bob X.

JWR Adds: Before attempting this procedure for the first time, I would recommend first creating a backup of the hosts file, just in case it is deleted or corrupted due to fumble fingers.