


The problem with this method is that although you would be able to log into your development server, so would everyone else as the DNS server is publicly accessible. To connect to the development server from a remote location, you could change in your public DNS server to point to, or add an additional entry in the public DNS server. For example, your true web server may have a domain name while you may have named your development server. You may want to set up and test online servers, but have them resolving only for your workstation.
Windows hosts file windows#
The Windows hosts file is a great help in testing new machines or deployment servers. In case the hosts file is missing, you can copy the lmhosts file to hosts and use it as you wish after editing it in Notepad. Hosts & lmhosts.sam files in File Explorer You will find the hosts file and lmhosts.sam file in the following location for all Windows opertating systems, including Server editions:įigure 1. Windows machines may not always have a hosts file, but they will have a sample hosts file named as lmhosts.sam. Understanding Domain Name Resolution on Windows You will not need to either reboot or enter any additional command to make the operating system start using the entries in the hosts file. Whatever entries you add to your hosts file, they start working immediately and automatically. In fact, if your operating system finds a mapping for a domain name in its hosts file, it will use that IP address directly and not even bother to query the DNS server. Most operating systems, including Microsoft Windows, are configured to give preference to the hosts file over the DNS server queries. By suitably manipulating the contents of the hosts file, it is very easy to interchange the IP address mappings of and, such that when searching for Yahoo your browser will point to Google and vice versa! Typically, it contains IP addresses and corresponding domain names separated by at least one space, and each entry on its own line. You can view the contents of the hosts file in a text editor. In the hosts file, you can create a mapping between domain names and their corresponding IP addresses. All operating systems use a hosts file to communicate via TCP/IP, which is the standard of communication on the Internet. This is like the local address book in your mobile, which you can consult for quickly calling up commonly used telephone numbers.

An alternative faster method is to look up the hosts file first. Querying the DNS server to connect to a remote device can be a time-consuming process. Finally, the device opens a connection directly to the remote IP address to perform the necessary operations. The DNS server then returns the remote IP address to the device. In turn, the DNS server may have to query other similar servers on the Internet until it is able to locate the correct information for that domain name. The device queries the DNS server, usually configured by the local router, by requesting the server for the IP address of that specific remote domain name. To know the remote IP address, the device has first to resolve the remote domain name to its mapped IP address by using DNS. On the Internet, any device wanting to connect to another can do so only by using the IP address of the remote device. All devices on the Internet have a unique IP address, much like the postal addresses people use. The Internet uses a standard domain name resolution service called the DNS or the Domain Name System. This article explains how the Windows operating system makes use of the popular Host file, where it is located for various operating systems, how it can be used to manipulate DNS lookups and redirect DNS lookups to different IP addresses and hosts.
