2023-03-27 21:29:52 +02:00
|
|
|
# netcup DNS
|
|
|
|
|
2023-03-29 10:51:05 +02:00
|
|
|
Update DNS A/AAAA records with your current external IP address using the netcup DNS API.
|
2023-03-27 21:29:52 +02:00
|
|
|
|
2023-06-16 14:09:05 +02:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
On Arch Linux:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
make
|
|
|
|
```
|
|
|
|
|
|
|
|
With `pip`:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
make install-pip
|
|
|
|
```
|
|
|
|
|
2023-03-28 17:16:11 +02:00
|
|
|
## Configuration
|
|
|
|
|
2023-03-29 10:51:05 +02:00
|
|
|
For each netcup customer, create a `.json` configuration file inside `/etc/netcup-dpns`.
|
2023-03-28 17:16:11 +02:00
|
|
|
|
2023-03-29 10:51:05 +02:00
|
|
|
There is an [example configuration](cfg/example.json).
|
2023-03-28 17:16:11 +02:00
|
|
|
|
2023-06-28 19:51:09 +02:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
```
|
|
|
|
usage: netcup-dns [-h] [--config-directory CFG_DIR]
|
|
|
|
[--cache-directory CACHE_DIR]
|
|
|
|
[--cache-validity-seconds CACHE_VALIDITY_SECONDS]
|
|
|
|
|
|
|
|
Update DNS A/AAAA records with your current external IP address using the
|
|
|
|
netcup DNS API.
|
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
|
|
|
--config-directory CFG_DIR
|
|
|
|
Path to directory where `.json` config files reside.
|
|
|
|
--cache-directory CACHE_DIR
|
|
|
|
Path to cache directory. Retrieved and updated DNS
|
|
|
|
records are cached there.
|
|
|
|
--cache-validity-seconds CACHE_VALIDITY_SECONDS
|
|
|
|
Value in seconds for how long cached DNS records are
|
|
|
|
valid. Set to `0` to disable caching.
|
|
|
|
```
|
|
|
|
|
2023-03-27 21:29:52 +02:00
|
|
|
## TODOs
|
|
|
|
|
|
|
|
Alternative external IP detection:
|
|
|
|
|
|
|
|
```python
|
|
|
|
def external_ip_upnp():
|
|
|
|
"""
|
|
|
|
https://stackoverflow.com/a/41385033
|
|
|
|
|
|
|
|
Didn't work for me. Even after double checking fritz.box settings:
|
|
|
|
|
|
|
|
fritz.box > Heimnetz > Netzwerk > Statusinformationen über UPnP übertragen
|
|
|
|
"""
|
|
|
|
import miniupnpc
|
|
|
|
u = miniupnpc.UPnP()
|
|
|
|
u.discoverdelay = 1000
|
|
|
|
u.discover()
|
|
|
|
u.selectigd()
|
|
|
|
print('external ip address: {}'.format(u.externalipaddress()))
|
|
|
|
```
|