How to check your server without DNS

You may want to test a domain or website that you have setup in Sentora without having any nameserver pointing on it.

Solution : setup the hosts file of the computer used to browse the domain as following:

With windows (32 or 64):

Your hosts file is C:\Windows\System32\drivers\etc\hosts

Open it with a text editor (ie Notepad) and add at its bottom a new line with the IP of your server and the domain name hosted on it separated by some spaces or tab. In example :

200.201.202.203 my.sub.domain.com

As soon as you have saved the file, you can open (or close and re-open) your browser and use it to browse for that domain with its url like http://my.sub.domain.com with the example above.  It does even not need to restart windows.

With Ubuntu or CentOs:

Your hosts file is  /etc/hosts

Use the same explanations as above for windows.

Note for local server:

If your server is installed on the same local network that the computer used to browse it (ie : another computer at home), you have to use its local IP in the hosts file (often like 192.168.xx.xx).
If the server is on the same computer which is used to browse, use IP 127.0.0.1 (local loop)

Remember that a computer can NEVER reach a server which is on the same side of a router with its external IP. It induces you cannot use a public nameserver to reach such server because the nameserver will always return the external IP.
In such case, the only solution to test a public DNS is to use a public proxy that will relay all requests, from outside.

Warnings:

Do not forget to remove the line from hosts file when you are terminated ! Else you browser would never use the DNS that would remain bypassed !

 

PenWant to help ? Click here to report mistake or to send complement to add.