-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
35 lines (24 loc) · 1.72 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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.