Connectivity and Performance Issues due to DNS Name Resolution

Description

The environment is affected by one or several issues as follows:

Reason

Computers in a TCP/IP network are often assigned alphanumeric names so they can be identified by these names instead of numeric IP addresses, as the hostnames are easier to remember than IP addresses. When the hostname is used to identify a computer on the network, the hostname must be resolved to the respective IP address for the communication to happen. The process is called hostname resolution. For hostname resolution to succeed, a hostname must have a corresponding IP address specified in a local hosts file or in a Domain Name Server (DNS) database.

While in many cases it may be not necessary to specify the mapping of a hostname to an IP address, it makes sense to do so for hostnames of network resources that are used often. Reading a local file is faster than sending name resolution requests to a remote server. While resolving a single name of a server typed in the URL field of the browser will pass seamlessly to the user, resolving hostnames multiple times when a database is queried can significantly affect the performance as each time the hostname must be looked up in the DNS database.

Solution

In environments where hostnames are used to address the database servers, license servers, and other network resources it is strongly recommended to maintain hostnames mapping within the local hosts files.

 

Windows

To add the IP mappings to the hosts file in the Windows environment proceed as follows:

1. Run command prompt by typing cmd into the Windows search field and choosing Open:

mceclip1.png

2. To retrieve the IP address of a host, in the command prompt type ping command followed by the hostname: 

mceclip0.png

3. Copy the IP address, which is included in the pinging results: in our example 2.20.241.17

4. Open the hosts file in notepad++ from the folder path C:\Windows\System32\drivers\etc:

mceclip2.png

Note: elevation is required when saving changes to the hosts file. When using notepad++, it will be applied automatically when saving the file: notepad will display the user dialog and after confirmation, it will restart with elevated privileges and save the file. If notepad++ is not available in the environment, standard Windows Notepad can be used as explained below.

4.1. Command prompt has to be run with elevation:

mceclip3.png

4.2. Type notepad in the command prompt and press Enter:

mceclip4.png

4.3. Choose File Open:

mceclip5.png

4.4. Paste the folder path into the address field and ensure the All Files mask is selected as the hosts file has no extension:

mceclip6.png

5. Add an entry to the hosts file contents as follows:

mceclip7.png

Do not remove existing text. Use Tab to format your added entry. Save the file when ready.

 

Linux

To add the IP mappings to the hosts file in the Linux environment proceed as follows:

1. Use Putty to connect to the Linux environment. On Linux the hosts file is located in the /etc folder:

mceclip9.png

Change directory to /etc by typing the cd etc command at the prompt. Press Enter to execute the command.

2. As the hosts file is a plain text file, we can use any text editor. In the present example, we will use vim, as it is likely to be available in any environment. To open the hosts file for editing, type vim hosts and press Enter:

mceclip10.png

3. The file is opened:

mceclip14.png

4. To switch into the Insert mode, which actually allows editing, press i:

mceclip13.png

The status line changes to -- INSERT --

5. Add the hostname to IP address mapping:

mceclip15.png

6. To save changes and exit press Esc and type :wq! followed by Enter:

mceclip16.png

7. Linux systems by default do not have a DNS cache. DNS information may be stored locally with an application like nscd (name service caching daemon), pdnsd, dns-clean, or dnsmasq. If one of these services is used for caching, you have to control it from the terminal in order to clear the cache.

 

Was this article helpful?
1 out of 2 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.