Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Dynamic hosts editor

As the way to connect to my computer at home from outside, I use n2n. It is great, but when I come back home and connect to home network, my computer's hostname is still assigned to n2n's IP, so I cannot use full potential of LAN. That's why created this simple program in Java, to help me use the maximum speed I can get.

How it works

The program pings periodicly list of IP's that target hostname can gain. When ping is sucessful it will assign that IP to hostname and continues to next hostname. Order of IP's that target hostname can gain is mandatory, e.g. first specify LAN IP and then n2n IP, so if you are at home, ping on the home IP will succed and assign hostname to it, but when you are somewhere else ping to home IP will fail, so program will try to ping n2n IP, which will suceed, so hostname will be assigned to computer's n2n IP.


  • Java (openjdk) 7 and higher
  • Read/Write permission on hosts file
  • Read/Write permission on config file while using automatic instalation, read only otherwise


You can download the bin/DHE.jar file, or compile it on your own, and run it. Program will automaticly show you next steps.


After configuration is complete, program is fully automatic. Every time ping suceed, checks if IP is not already assigned, then write. If hostname is not found, adds it to the end of the file.


When you have your dhe.conf file, you can configure it this way:

All parameters are stored as {key}={value}

Requied parameters are:

hostFile - tells where your host file is located, on Windows is default C:/Windows/System32/drivers/etc/hosts, /etc/hosts otherwise

Optional parameters are:

scan - in seconds tells how often to start pinging IPs, 180 by defaulty

your hostname and IPs that hostname can gain - eg. {home-pc}={,,} means first try to ping, if succed then assign home-pc to, else ping etc. You can add as many hostnames as you want, known IPs are separated by comma.

##Sample config

{hostFile}={/etc/hosts} //My hosts file location

{scan}={270} //Try ping every 270 seconds

{my-laptop}={,} //My laptop's known IPs

{home-pc}={,,} //My home PC's known IPs

You can’t perform that action at this time.