The hosts file is a special file on your workstation computer that will store IP and name information. This file is checked before DNS, so if you place an entry in this file it will supersede anything set in DNS. This feature is very useful in testing websites as it will allow you to control which IP your local computer will visit regardless of what is set in DNS.
The format of the hosts file is very simple. Each line has an IP address and a hostname separated by one or more spaces. By default, hosts files typically contain entries for "localhost" as well as some comment text describing the file and its use. It is best to not change any of these lines.
22.214.171.124 example.com 126.96.36.199 www.example.com
/etc/hostsas root with a text editor. Example:
sudo nano /etc/hosts
ping -c2 example.com