Modifying your hosts file enables you to override the domain name system (DNS) for a domain on a specific machine. This is helpful if you wish to bypass some DNS settings such as bypassing Cloudflare to work directly on your webserver or website. Another thing you can do is give static IP's to devices on your network that never change, such as routers, switches, printers and NAS (network attached storage) devices. By adding the devices into your hosts file your computer will always be able to find them.
The hostsfile is generally located in the following areas on your Computer
- Windows 11 / 10 / 8 - c:\Windows\System32\Drivers\etc\hosts or %Windows%\System32\Drivers\etc\hosts
- UNIX / Linux OS's - /etc/hosts
The hosts file contains lines of text with two columns. In the first column there is an IP address. And in the second column, there is a computer hostname. The two columns can be separated by a space or tab. So, an example hosts file might look like this:
192.168.0.1 gatewayrouter 192.168.0.10 swtich01 192.168.0.11 nas1 192.168.0.12 nas2 192.168.0.20 printer01 192.168.0.21 printer02 22.214.171.124 webserver.mycompany.com
Windows 11, 10 and Windows 8
Use the following instructions if you’re running Windows 10 or Windows 8:
Press the Windows key.
Type Notepad in the search field.
In the search results, right-click Notepad and select Run as administrator.
From Notepad, open the following file:
Make the necessary changes to the file.
Select File > Save to save your changes.
Linux / UNIX
- Use the following instructions if you’re running Linux:
- Open a Terminal window.
- Enter the following command to open the hosts file in a text editor:
- sudo nano /etc/hosts
- Enter your sudo user password.
- Make the necessary changes to the file.
- Press Control-X.
- When you are asked if you want to save your changes, enter y.
Editing your hosts file can save you time and a lot of grief. Having proper host file settings will solve your DNS issues if your DNS servers go off line.
Located in Edmonton, AB Canada, Clustered Networks was Incorporated in 2001 and has offered Network / Internet and IT Consulting services for over 20 years. We offer personalized service! Call Us Today! - Click Here for our Contact Info
#linux #windows10 #hosts