How to Create A local Host in Windows?

The hosts file is a local plain text file that maps servers or hostnames to IP addresses. This file has been in use since the time of ARPANET. It was the original method to resolve hostnames to a specific IP address. The hosts file is usually the first process in the domain name resolution procedure. Here is an example of a hosts file entry.

h

note:- We have added the curly brackets around each entry in the hosts file belwo to better define each section.

{67.225.187.61} {liquidweb.com}

We use the above code as an example since it almost always included in every hosts file. Another example would be similar to the following entry.

· The first section denotes the IP address where a request will be redirected to.

· The second section designates the location that we want to redirect a request from.

· The third section specifies a comment for the entry.

· Each entry is usually separated by a space or a tab

Why is a Hosts File Useful?

Let’s say we have just completed a migration to a new server. In order to see how our domains will look and operate on our new server before we move our DNS settings, we cannot just type in one of our current domain names as it will resolve to the old server we are moving away from (since we never move our DNS A records from the old server until we are sure the new site is working as expected).

So, to see how our domain will look on the new server, (without having to change our DNS record ) we can simply modify our local hosts file to point the domain to the new servers IP. If our domain is liquidweb.com and the old IP is 67.225.187.61 and our new IP will be 72.30.35.10, we can temporarily comment out the current liquidweb.com entry (using a ‘#’ symbol) and add an alternate entry which points to the new servers IP.

#67.225.187.61 liquidweb.com #Liquid Web72.30.35.10   liquidweb.com #this is the new liquidweb.com

If we added the above entry to our hosts file, every time we open liquidweb.com in our browser, we will now be redirected to the 72.30.35.10 IP.

Where is the Hosts File Located?

The location of the hosts file will differ by operating system. The typical locations are noted below.

Windows 10 — “C:\Windows\System32\drivers\etc\hosts”

Linux — “/etc/hosts”

Mac OS X — “/private/etc/hosts”

Future Techno India / Create A Local Host in Windows

Now create our own local host in window

  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. In the search results, right-click Notepad and select Run as administrator.
  1. The Windows needs your permission UAC window appears.
  2. Click Continue to grant permission.
  3. Notepad opens.
  4. In Notepad, select File > Open

Navigate to C:\Windows\System32\drivers\etc\hosts or click the address bar at the top and paste in the path and choose Enter. If you don’t readily see the host file in the /etc directory then select All files from the File name: drop-down list, then click on the hosts file.

Select Open.

Make the necessary changes to the file.

Add the appropriate IP and hostname at the end of your hosts’ file, select Save, and then close the file.

Now you’re ready to edit the file. If you’ve never opened the hosts file before, all you’ll see is a short section of text describing its purpose and how to make edits. The introduction provides a useful overview of how the file is structured, but we’ll cover the basics here.

On the File menu, select Save.

Click the Windows button and search command prompt.

Finally, you will want to flush your DNS cache for your computer to recognize changes to the Type the following command in the terminal and press Enter

--

--

--

We believe in making future tech leaders by providing right education to them. https://www.payumoney.com/webfronts/#/index/Expertise-on-Container

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Understanding WSO2 API Manager Deployment patterns

Asynchronous programming in Kotlin: dissecting coroutines

Conquer The Command Line: The cp Command

Cinemachine: 3rd Person Follow, Orbital, and Transposer

4 ways to inject dependencies in Symfony that you probably don’t know about?

Symfony Dependency Injection

Get SubString Between Tags in Java | Code Factory

What I wish someone had told me before starting a coding boot camp

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Future Techno India

Future Techno India

We believe in making future tech leaders by providing right education to them. https://www.payumoney.com/webfronts/#/index/Expertise-on-Container

More from Medium

WordPress security plugins that are essential to keep hackers away

Backing Up Your Website’s Files: A quickie how-to guide

Type of Email Attacks

Building Extensions for Zowe containerization