Hosts file will instruct your machine to go directly to an IP address for specified domain instead of checking with DNS server. For example, point www.qualityology.com and qualityology.com to Google Cloud Platform server:
22.214.171.124 www.qualityology.com 126.96.36.199 qualityology.com
For Windows 10, Windows 8, Windows 7, and Windows Vista systems that use User Account Control (UAC).
- Run Notepad as Administrator.
- Press the "Windows" key, type in "Notepad".
- Right-click the notepad icon and select: Run as Administrator. OK the UAC prompt.
- Open the HOSTS file from Notepad. By default, the Hosts file is located in the C:\Windows\System32\Drivers\etc\ folder.
- Edit the HOSTS file and save.
Run the command below in CMD to flush DNS cache.
*If you use other programs to edit the Hosts file when you have Windows Defender enabled, Windows Defender may determine incorrectly that the Hosts file was changed by malware, and will automatically remove your modified Hosts file and replace it with the default from Microsoft. You will need to allow hosts file change in Windows Defender, exclude the Hosts file from scanning in Windows Defender.
By default, Windows system's Hosts file is located in the %systemroot%\system32\drivers\etc folder.
- Open Windows Defender.
- On the Settings tab, click Excluded files and locations.
- Under File locations, click Browse.
- Locate and then click the Hosts file.
- Click Add, and then click Save changes.
- Exit Windows Defender.
- After everything is done. Go back to Windows Defender and remove the exclusion to secure the hosts file from unauthorized edit.
- Open Terminal.
sudo nano /etc/hosts
and hit return.
- Enter your administrator password and then hit return.
- Edit the record or add IP Domain based on your need.
- press control and X, and type Y to save and exit.
Run the command below in Terminal to flush DNS cache.
sudo killall -HUP mDNSResponder