- Find Your IP Address(you can retrieve this information easily using the cPanel dashboard)
- Run Notepad as an Administrator
- To get administrator access, press the Windows key and type Notepad into the search box.
- Right-click on Notepad
- Click Run as Administrator. You will get a prompt whether you want to allow this application to make changes to your device.
- Select Yes(enter an administrative password when prompted).
- Make Your Changes
- Edit the hosts file. In the Notepad, select File > Open.
- Navigate to C:\Windows\System32\drivers\etc . Alternatively, you can copy/paste this file path C:WindowsSystem32driversetchosts into the address bar
- Press Enter.
- Change the file filter from “Text Documents (.txt)” to “All Files (.*)”
- Find the “hosts” file and click open.
- Edit the hosts file.
You will see some text describing the file’s purpose
This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
This file contains the mappings of IP addresses to host names. Each
entry should be kept on an individual line. The IP address should
be placed in the first column followed by the corresponding host name.
The IP address and the host name should be separated by at least one
space.
Enter your custom IP address and hostname at the end of this file.Remember to place each entry on a separate line If you are adding multiple entries,
Save changes and close the hosts file. Edit The Hosts File On Ubuntu You can edit the hosts file in the Terminal by using your favourite command-line editor
We will be using Vim which is one of the traditional text editors in Linux. Ubuntu’s hosts file is located in the /etc/ folder. To use, Vim, you will need to launch it prefaced by sudo, however, if Vim is not installed, just run “sudo apt install vim” in a Terminal.
- Run “sudo vim \etc\hosts” in a Terminal.
- Open up a Terminal, then enter:
sudo vim /etc/hosts - Enter your password and edit
- You will notice that with Ubuntu there is also a section for IPv6, ignore it, and edit the IPv4 section only.
- Add an entry in the hosts file.
- Save the file
Note: If your browser has been configured to use DNS Over HTTPS and its own DNS Server, editing the hosts file will probably not block access.
- To locate the Mac hosts files location: Navigate to the Terminal application.
- Type Terminal on the Spotlight or by going to Applications > Utilities > Terminal.
- Enter this command
- Use the following command if the permission on the hosts file has been locked
- Type the password when prompted.
- The hosts file contains some comments starting with the # symbol and some default hostname mappings (e.g., 127.0.0.1 localhost).
- Enter your custom IP and hostname underneath the default ones.
891.23.45.67 testing.com www.testing.com - Save the file and exit the editor once done
- Open the terminal
- Go to Menu.
- Choose Applications.
- Select Accessories.
- Click Terminal.
- Type the command in the Terminal
- When prompted, type your user password
The hosts file contains some comments lines starting with the # symbol and some default hostname (e.g., 127.0.0.1 localhost). - Enter your custom IP and hostname underneath the default ones.
891.23.45.67 testing.com www.testing.com - Save the file and exit the editor once done
- Click on the Windows button
- Search for the command prompt and type the following command
- Press the Enter key.
Windows should be using your new hosts file settings once this process is complete, you could just restart your computer to flush DNS