Jake Intel

Mark Wahl

Custom IP Mappings for PC and Mac

On occasion you may have reason to map a domain name to a specific IP address when accessing it from a particular computer. For example, a programmer working on a development website may want the computer process requests for the eventual domain to the IP address of the development server. That way the programmer can interact with the development site as if it was live, while the rest of the world continues to see the domain resolve to the public location. The IP address of the destination may be internal to the LAN or external.

Custom IP mappings can be created by editing some simple settings on the computer. The process will depend on the computer and operating system being used.

Windows XP, Windows Vista, Windows 7

Windows stores any custom IP mappings in its Hosts file. This is usually located at C:WindowsSystem32Driversetchosts, though the ‘System32’ directory may differ based on the operating system. Here is how to add a record to this file:

  1. Open the Hosts file in Notebook or some other simple editor.
  2. At the top of the file there are instructions for how to use the file, all preceeded by the # comment tags.
  3. Below this are the actual mappings. The first column contains the preferred IP destination, while the second column contains the local domain to be mapped. The domains in the second column will resolve to the corresponding IPs in the first column. A third column may be used to include comments about the mapping. A correct mapping may look like this:          www.thejakegroup.com          #map The Jake Group domain to internal IP address
  4. Note that naked domains and subdomains (i.e., www.) must be set separately, and that you must use an IP address in the first column, not another domain name.
  5. Once you’ve made your settings, save the file and all browsers on this computer will follow these mappings for the domains listed in the Hosts file.

Mac OS

Macs have Hosts settings as well, here’s how to edit them:

  1. Browse to the ‘etc’ directory using Terminal.
  2. Enter the following command: mate hosts (you do have TextMate installed, don’t you? If you don’t, you can type sudo vi hosts instead.)
  3. If you are using TextMate, the hosts file will open, and is ready for editing. If you are using VI editor, you will be prompted to enter an administrative password.
  4. To add a new entry to the file, enter it on it’s own line in the format:           www.thejakegroup.com
  5. Hit COMMAND + S to save the file in TextMate (you’ll then be prompted for you password), or press SHIFT + Z twice to save the file if you are using VI editor.

A nice additional feature of custom local IP mappings is that they are not limited to standard domain formats. You can actually map any alphanumeric combination to an IP address, such as ‘jake’ or ‘website1’ or the like.