-
Notifications
You must be signed in to change notification settings - Fork 0
Script to update the public IP in the DNS, when the server is behind a NAT and the ISP assigns the IP dinamically.
License
angonz/updateip
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# updateip If you have a server behind an ISP without a fixed IP, the ISP may change its public IP anytime. Actually this may happen after a service outage or a modem reset. There are some programs that detect this situation and can update the public IP address in the DNS accordingly. However, if the server has a private IP address and is behind a router that NATs it to a public address, it will never know when the public address has changed. This script detects when the public address has changed, even regardless the private IP address of the server. Then it updates the DYN record of the DNS server. It works with Zoneedit DNS provider. However it can be easily modified to suite any other DNS service, provided it has a web service URL to change the record. Installation ------------ This is a bash script tested in Ubuntu 14.04 LTS. - Copy updateip to a suitable folder for custom scripts (normally /usr/local/bin) - Create a crontab entry to execute the script periodically. Every 30 min show be fine. Not too fast, because the DNS server may block your updates and you may load the server unnecessarily. In Ubuntu, a way to do this is: - sudo crontab-e In the editor window, append the following line to the end of the file: 0,30 * * * * /usr/local/bin/updateip - Edit the USERNAME and AUTHTOKEN with your Zoneedit username and authtoken or password. - Grant execution privilege (sudo chmod 755 updateip) - You can also run the script from the command line Logfile ------- updateip.sh will log events in a file, by default, /var/log/updateip.log. The logfile can be modified in the scrip by changing the LOGFILE variable at the beginning. Notes ----- Depending on where the logfile is located, updateip.sh needs to be executed as root.
About
Script to update the public IP in the DNS, when the server is behind a NAT and the ISP assigns the IP dinamically.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published