Update README.md
This commit is contained in:
parent
dcba187d74
commit
8635f7ba03
43
README.md
43
README.md
|
@ -10,9 +10,9 @@ The following is required or suggested:
|
||||||
|
|
||||||
* OpenBSD (or another BSD or some Linux distro) with HTTPD and NSD installed (pkg_add nsd), configured and running
|
* OpenBSD (or another BSD or some Linux distro) with HTTPD and NSD installed (pkg_add nsd), configured and running
|
||||||
* (sub-)domain for your webserver. Needed for updating the NS record of your actual DynDNS domain.
|
* (sub-)domain for your webserver. Needed for updating the NS record of your actual DynDNS domain.
|
||||||
* In this example: update.example.com
|
* In this example: _update.example.com_
|
||||||
* (sub-)domain that is updated dynamically.
|
* (sub-)domain that is updated dynamically.
|
||||||
* In this example: dyn.example.com
|
* In this example: _dyn.example.com_
|
||||||
* A router capable of sending custom GET-requests to your DynDNS server.
|
* A router capable of sending custom GET-requests to your DynDNS server.
|
||||||
* In this example: A FritzBox
|
* In this example: A FritzBox
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ The following is required or suggested:
|
||||||
|
|
||||||
### Configure your HTTPD
|
### Configure your HTTPD
|
||||||
|
|
||||||
Add the following new virtual host to your /etc/httpd.conf:
|
Add the following new virtual host to your _/etc/httpd.conf_:
|
||||||
|
|
||||||
```
|
```
|
||||||
server "update.example.com" {
|
server "update.example.com" {
|
||||||
|
@ -30,7 +30,7 @@ The following is required or suggested:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Create an empty index.html:
|
Create an empty _update.html_:
|
||||||
|
|
||||||
```
|
```
|
||||||
# mkdir /var/www/htdocs/dyndns/
|
# mkdir /var/www/htdocs/dyndns/
|
||||||
|
@ -38,11 +38,11 @@ Create an empty index.html:
|
||||||
```
|
```
|
||||||
|
|
||||||
After reloading HTTPD, try to access http://update.example.com/update.html
|
After reloading HTTPD, try to access http://update.example.com/update.html
|
||||||
The request should show up in /var/www/logs/dyndns.log
|
The request should show up in _/var/www/logs/dyndns.log_
|
||||||
|
|
||||||
### Create a zone file for dyn.example.com
|
### Create a zone file for dyn.example.com
|
||||||
|
|
||||||
Create a new zone file (e.g. at /var/nsd/zones/dyn.example.com.zone) with the following content
|
Create a new zone file (e.g. at _/var/nsd/zones/dyn.example.com.zone_) with the following content
|
||||||
|
|
||||||
```
|
```
|
||||||
$ORIGIN example.com.
|
$ORIGIN example.com.
|
||||||
|
@ -65,7 +65,7 @@ dyn IN A 123.123.123.13
|
||||||
```
|
```
|
||||||
|
|
||||||
Don't forget to set your own domain names, name servers and ip addresses
|
Don't forget to set your own domain names, name servers and ip addresses
|
||||||
Furthermore, add this zone file to your /var/nsd/etc/nsd.conf
|
Furthermore, add this zone file to your _/var/nsd/etc/nsd.conf_
|
||||||
|
|
||||||
### Configure and Install nsd-dyndns
|
### Configure and Install nsd-dyndns
|
||||||
|
|
||||||
|
@ -75,10 +75,35 @@ Furthermore, add this zone file to your /var/nsd/etc/nsd.conf
|
||||||
* Make the script executable:
|
* Make the script executable:
|
||||||
* _# chmod u+x /usr/local/bin/dyndns.sh_
|
* _# chmod u+x /usr/local/bin/dyndns.sh_
|
||||||
* Add _/usr/local/bin/dyndns.sh_ to your crontab
|
* Add _/usr/local/bin/dyndns.sh_ to your crontab
|
||||||
|
|
||||||
|
### Configure your router
|
||||||
|
|
||||||
|
Configure your router to query the following URL:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
update.example.com/update.html?qwertzuiop1234567890
|
||||||
|
```
|
||||||
|
|
||||||
|
Don't forgert to set your own domain name and to replace the string after "?" with the password you configured in the config file.
|
||||||
|
|
||||||
|
### What it does
|
||||||
|
|
||||||
|
When your router gets a new IP and therefore sends an HTTP request to your server, a similar entry should appear in your _/var/www/logs/dyndns.log_:
|
||||||
|
|
||||||
|
```
|
||||||
|
update.axample.com 123.123.123.123 - - [29/Apr/2018:20:48:19 +0200] "GET /update.html?qwertzuiop1234567890 HTTP/1.1" 200 6
|
||||||
|
```
|
||||||
|
|
||||||
|
When the script is executed e.g. via cron, the following happens:
|
||||||
|
* It greps the last line of _/var/www/logs/dyndns.log_ where the correct password was found and extracts the requesting IP address
|
||||||
|
* It checks if this IP is the same than the last time
|
||||||
|
* If it's a new IP, then it replaces the forth line in your zone file - the line with the version number - with a new version (current unix time stamp)
|
||||||
|
* As a second step, it updates the A record of you DynDNS domain (dyn.example.com in our example)
|
||||||
|
* It then stores the new IP in the file _/tmp/last_dyndns_ip.txt_
|
||||||
|
* Finally it reloads NSD
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue