Git Product home page Git Product logo

dyndns's Introduction

DynDNS IPv4 and/or IPv6 Dynamic DNS Client

DynDNS is a simple Linux client to update one or more of your dynamic DNS hosting services with the hosts public IPv4 and/or IPv6 addresses. Just configure your own update URLs in the configuration file and run it.

DynDNS supports dynamic DNS services which use a simple http or https URL get update mechanism, such as:

The above all offer free dynamic DNS services. There is example configuration for each of these services in the sample dyndns.toml configuration file but note that most (free or paid) dynamic DNS services should be supported. Extensive configuration instructions are provided in that file.

Why another dynamic DNS client? I wanted a simple, lightweight app managed by systemd, generic and flexible enough to use with any dynamic DNS service and IP address servers. It should work with both IPv4 and IPv6 and allow multiple URLs to be set. I didn't find anything I liked so wrote my own.

Ensure you read the latest documentation and the instructions in the example dyndns.toml file but then ask a question on the DynDNS discussion forum if you still need clarification about usage or operation.

Operation

This client runs every poll_period (default 10 mins) and determines your current public IPv4 and/or IPv6 address from a list of configured public address servers. If any IP address differs from the last address then an update is sent to the pertinent configured dynamic DNS URLs. You can configure "<ipv4>" and/or "<ipv6>" placemarkers in your URLs to be substituted at runtime, and/or for those services that support it, rely on automatic IP detection. Every force_period (default 24 hours), an update is sent regardless to each service. The last IP addresses determined are stored on change only and are always cached to disk so they are preserved through reboots. The service URLs, their parameters to update, the time periods, and the list of IP address servers can be changed in the configuration file.

Configuration

You copy the sample dyndns.toml file to your ~/.config/ and then edit it for your requirements. Follow the examples and instructions in that file.

Installation

Requires python 3.7 or later and a modern Linux systemd environment.

  1. Clone repository and create configuration:

    $ git clone https://github.com/bulletmark/dyndns.git
    $ cd dyndns
    $ mkdir -p ~/.config
    $ cp dyndns.toml ~/.config
    $ vim ~/.config/dyndns.toml # Add your [[urls]] entries
  2. Create virtual environment (venv) and install service.

    $ python3 -m venv .venv
    $ .venv/bin/pip install -r requirements.txt
    $ sudo cp dyndns.service /etc/systemd/system
    $ sudoedit /etc/systemd/system/dyndns.service # Edit #TEMPLATE# values.

Note: Alternatively, to create the venv, install the requirement packages, insert the template values, and enable + start the service you can use my pinstall tool. Just install it and do the following in the dyndns directory.

$ pinstall venv
$ pinstall service

Starting, Stopping, and Status

To enable starting at boot and also start immediately:

$ sudo systemctl enable dyndns
$ sudo systemctl start dyndns

To stop immediately and also disable starting at boot:

$ sudo systemctl stop dyndns
$ sudo systemctl disable dyndns

Show status:

$ systemctl status dyndns

Show log:

$ journalctl -u dyndns

Upgrade

cd to source dir, as above. Then update the source:

$ git pull

Update ~/.config/dyndns.toml and /etc/systemd/system/dyndns.service if necessary. Then restart the service.

$ sudo systemctl restart dyndns

Usage

Type dyndns -h to view the usage summary:

usage: dyndns [-h] [-v] [-i] [-c CONF]

Update external IP v4 and/or v6 addresses to a dynamic DNS server.

options:
  -h, --help            show this help message and exit
  -v, --verbose         verbose output
  -i, --ignore-cache    ignore cache for startup
  -c CONF, --conf CONF  configuration file, default =
                        ~/.config/dyndns.toml

Summary of Version 2 Changes

  • Added the ability to cater for IPv6 addresses.

  • Added the ability to configure multiple dynamic DNS server URLs instead of just one and also the ability to substitute "<ipv4>" and "<ipv6>" placemarkers in the url string.

  • Cater for dynamic DNS servers which return one or more text strings for success/failure instead of just looking at the HTML response status code.

  • Changed from YAML to TOML configuration file format as that is the future for Python apps given TOML is now included in the standard packages since Python v3.11. Note that tomli package gets installed if you are running on < 3.11. This change mean any previous personal configuration file must be ported to the new format.

  • Requires minimum Python version 3.7 instead of 3.6.

License

Copyright (C) 2017 Mark Blakeney. This program is distributed under the terms of the GNU General Public License. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.gnu.org/licenses/ for more details.

dyndns's People

Contributors

bulletmark avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

shelleycat485

dyndns's Issues

Path is not absolute error

I'm trying to connect to FreeDNS.afraid.org but the service is erroring out and I don't know what to do. Running journalctl gets me this:

noah@beelink-server:~$ journalctl -u dyndns
Jun 22 22:28:55 beelink-server systemd[1]: /etc/systemd/system/dyndns.service:11: WorkingDirectory= path is not absolute: #WORKDIR#
Jun 22 22:28:55 beelink-server systemd[1]: dyndns.service: Unit configuration has fatal error, unit will not be started.
Jun 22 22:34:59 beelink-server systemd[1]: /etc/systemd/system/dyndns.service:12: Neither a valid executable name nor an absolute path: home/noah/dyndns/dyndns
Jun 22 22:34:59 beelink-server systemd[1]: dyndns.service: Unit configuration has fatal error, unit will not be started.
Jun 22 22:36:03 beelink-server systemd[1]: Started dyndns.service - Update External IP v4/v6 addresses to a Dynamic DNS server.
Jun 22 22:36:03 beelink-server (dyndns)[4652]: dyndns.service: Failed to determine user credentials: No such process
Jun 22 22:36:03 beelink-server systemd[1]: dyndns.service: Main process exited, code=exited, status=217/USER
Jun 22 22:36:03 beelink-server systemd[1]: dyndns.service: Failed with result 'exit-code'.
Jun 22 22:38:03 beelink-server systemd[1]: /etc/systemd/system/dyndns.service:11: WorkingDirectory= path is not absolute: #/home/noah/dyndns#
Jun 22 22:38:03 beelink-server systemd[1]: dyndns.service: Unit configuration has fatal error, unit will not be started.
Jun 22 22:43:45 beelink-server systemd[1]: /etc/systemd/system/dyndns.service:11: WorkingDirectory= path is not absolute: ~/dyndns
Jun 22 22:43:45 beelink-server systemd[1]: dyndns.service: Unit configuration has fatal error, unit will not be started.
noah@beelink-server:~$

This is the dyndns.service:

[Unit]
Description=Update External IP v4/v6 addresses to a Dynamic DNS server
Wants=network-online.target
After=network-online.target

[Service]
# Set the following USER to your user name.
User=noah
# Set the following WORKDIR to the source program directory (where you
# git cloned)
WorkingDirectory=~/dyndns
ExecStart=~/dyndns/%p

[Install]
WantedBy=default.target

I'm kinda new to this stuff so please help me, I'm trying to run a home web server and I got everything figured out except for the DDNS part, thanks!

service failed: No such file or directory

Hi,

I just installed dyndns on my Ubuntu 20.04 box and tried to run it as a service after configuration, but I get dyndns.service: Failed at step EXEC spawning /apps/dyndns/dyndns: No such file or directory.
This is perplexing, because that file exists, of course:

root@mydroid:/apps/dyndns# ls -l /apps/dyndns/
total 40
-rw-r--r-- 1 root root 1070 May 14 18:45 convtime.py
-rwxr-xr-x 1 root root 9999 May 14 18:45 dyndns
-rw-r--r-- 1 root root  371 May 14 18:45 dyndns.service
-rw-r--r-- 1 root root 3808 May 14 18:45 dyndns.toml
-rw-r--r-- 1 root root  776 May 14 18:45 Makefile
-rw-r--r-- 1 root root 6197 May 14 18:45 README.md
-rw-r--r-- 1 root root   48 May 14 18:45 requirements.txt
drwxr-xr-x 1 root root   46 May 14 19:03 venv
dyndns.service - Update External IP v4/v6 addresses to a Dynamic DNS server
     Loaded: loaded (/etc/systemd/system/dyndns.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-05-14 19:32:53 CEST; 8s ago
    Process: 8568 ExecStart=/apps/dyndns/dyndns (code=exited, status=203/EXEC)
   Main PID: 8568 (code=exited, status=203/EXEC)

May 14 19:32:53 mydroid systemd[1]: Started Update External IP v4/v6 addresses to a Dynamic DNS server.
May 14 19:32:53 mydroid systemd[8568]: dyndns.service: Failed to execute command: No such file or directory
May 14 19:32:53 mydroid systemd[8568]: dyndns.service: Failed at step EXEC spawning /apps/dyndns/dyndns: No such file or directory
May 14 19:32:53 mydroid systemd[1]: dyndns.service: Main process exited, code=exited, status=203/EXEC

What could be the problem?

username and password appear in journals

Rpi3b, bookworm. Client works fine.
This is only minor, but the username and password are in plain text in the config file. They also appear in the journalctl files and the systemctl status dyndns output. Perhaps these could be blanked, or the default logging not show all of this. These can both be seen by user pi, who is allowed sudo so it is not a big deal. For noip.com these are the username/password of the account; you can have 2FA on top of that but it seems a weakness.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.