Override DNS on a Local Machine for Testing Purposes
Posted by Greg Pettit, Last modified by Aly Essa on 09 June 2016 04:39 PM

Overview

In IPv4, the local machine loopback IP 127.0.0.1 is mapped to the hostname localhost. For the majority of testing situations, this will be fine. However, there are a few reasons you might want to associate your local machine with your organization's public domain name or even an arbitrary domain name but yet have this name resolve entirely on the local machine instead of the public internet.

For example:

  1. You are testing SSL certificates and are using a production certificate. This will cause redirections to the actual Public domain, which will conflict with your test environment.
    When testing SSL certificates in a test environment, many people will generate a self-signed certificate tied to the localhost instead of the public domain. However, this is not always ideal. Testing might require ensuring that the actual public certificate is valid and works alongside the web application. The problem is that the production certificate is generated using your actual public domain, as soon as a redirect is performed, you will be dumped out of your test environment and into the public site.
  2. Parts of your web application built in-house have hard-coded references to the domain and you do not want to be taken out to the public internet during testing.
  3. Simplified URL entry into the address bar or using the DNS as a hostname.

This article will outline the steps to add an alias to the hosts file in a Windows Environment, which will redirect a DNS name to the loopback IP address.  The resolution steps will apply to Linux and other *nix Systems.

Environment

FileCatalyst Server v3.4 and later.

FileCatalyst Workflow v4.9 and later.

FileCatalyst Webmail v4.9 and later.

Resolution

  1. Click the Start button and search for notepad.exe.
  2. Right-click on Notepad and select Run as Administrator.
  3. Browse to C:\Windows\system32\drivers\etc\ and open the hosts file.
  4. On a new line, enter the IP followed by the domain name, separated by at least one space. For example: 127.0.0.1 www.mydomain.com
  5. Save the file and close Notepad.
  6. Restart your machine for the changes to take effect.

Whenever www.mydomain.com is called, this DNS will resolve to 127.0.0.1 on this machine.

 

Notes