0

My software uses DNS Name to connect to the Server. My Clients sometimes need to work off site and in such a case they use Hamachi to connect to the server.

I would like to know if it is possible to set up the hosts file (or perhaps an easier method) to check the local IP Address and if it fails it goes to the Hamachi IP

127.0.0.1       localhost
12.34.56.78     localhost   
2
  • Sorry if this is in the wrong place. I dont use StackExchange all that often. I followed a google link here
    – Corne
    May 14, 2014 at 14:07
  • What do you mean by "check the local IP Address?" Is your software possibly running on the localhost as well? May 14, 2014 at 17:25

2 Answers 2

8

Neither the HOSTS file nor DNS have any type of service availability checking capability. They resolve DNS names to ip addresses. Furthermore, the HOSTS file works on a first come first served basis, meaning the first match is the one that's used and all others are ignored. So, neither DNS or the HOSTS file can do what you need.

It's also generally assumed that the name localhost refers to 127.0.0.1 or ::1. Breaking this assumption is very strange. If you don't mean localhost, it's usually better for manageability to not write localhost.

-1

You could setup split DNS to have public DNS to go to your public IP address and private DNS to point to your private IP.

Not the answer you're looking for? Browse other questions tagged .