Using the hosts file


The hosts file is an operating system file located on your computer. You can use the hosts file to redirect a hostname to an IP address. This allows you to use the same hostname in different locations, and map that hostname to different IP addresses.

Note: If you prefer you can also store the IP address in an external file — using a configuration variable like “HL7_DB_IP” or “jupiter_IP”.

This has the advantage of one less dependency (you don’t need to edit the hosts file). But your Administrators may prefer to use the hosts file (if they are used to it). In the end it your choice.

Tip: It is possible to use a local DNS server for these redirections (instead of the hosts file). But that is beyond the scope of this article.

You can discuss this with your Network Administrator who may prefer to use DNS.

What is a hostname? [top]

A hostname is basically a label (name) for a device on a computer network (like a computer, a database server, or an Iguana server). A hostname can be a single unqualified name like Jupiter or longer “qualified” name like In general we recommend using the qualified name whenever possible.

With the internet we are very used to using these longer qualified Domain names as part of the URLs that we use in our web browsers (like Chrome and FireFox). Notice that the “http://” is not part of the hostname — the hostname is simply “”.

Editing the hosts file [top]

First you need to locate the hosts file on your system. These are the most common locations:

  • Windows: c:\windows\system32\drivers\etc\hosts
  • Linux, Unix, Posix: /etc/hosts
  • Mac: /etc/hosts (a symbolic link to /private/etc/hosts)

Otherwise you can search for the filename “hosts”. And the Wikipedia hosts file page also has a section Location in the file system that is helpful.

Because it is an operating file you will need administrative access to edit it. In Windows you can right-click on notepad and choose to run it as administrator. In Linux, Unix and Mac the easiest way is probably to use sudo to run a text editor from terminal.

If you need help getting permission to edit the hosts file talk to your local administrator, or contact us at

Using the host file [top]

You will need to add entries to the hosts file for each Iguana Server environment. For example if you have three Iguana environments Dev, Test and Prod you will need to edit the hosts file on all three servers.

The hosts files entries use this general format:

<IP address> <hostname> #this is a comment

For example to redirect the jupiter server:

So lets use our example where we have three Iguana Environments Dev, Test and Prod that use a database The Dev and test environments use the same DB whereas the production server uses

These are the entries you will need to add to the hosts file on each Iguana Server:

  • Iguana Dev server: #same IP as Test

  • iguana Test server: #same IP as Dev

  • Iguana Prod server: #uses LIVE server IP

Note: You could use an entry with unqualified server name, like this: HL7_DB

But we recommend using a qualified name if possible.

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.