Giter Club home page Giter Club logo

bash-inwx-dyndns's Introduction

INWX DynDNS Script

This is a small bash script, which works as a DynDNS updater. It works only with domains which are registered at inwx.de. It only updates the ip record, if the ip has changed.

Requirements

This script does not require any additional tools. All tools should be available on a regular linux system:

  • curl
  • sed

Installation

  1. Create a new directory in your home folder. E.g. dyndns.
mkdir ~/dyndns
cd ~/dyndns
  1. Clone the files from github
git clone [email protected]:gehaxelt/Bash-INWX-DynDNS.git .
  1. Edit the dnsupdate.sh and fill in your login credentials.
nano dnsupdate.sh
  1. Get the wished dns entry ID from the inwx website and set it in the script. See below how to get the ID.
    When you not have an ID (like IPv6) than use DNSIDsv6=(), an empty array. When you have one ID (like 7654321), use DNSIDsv6=("7654321") and if you have multiple IDs use DNSIDsv6=("7654321" "8901234"), same usage for IPv4.
  2. If desired, enter at UPDATEURLv4="" the URL from which the IPv4 address should be retrieved, same for IPv6.
  3. Edit your crontab. For a 5-minutes update use: */5 * * * * cd /home/$USER/dyndns && bash dnsupdate.sh
crontab -e

How to obtain the DNS entry ID?

First, login to the inwx website. Navigate to "Nameserver" section:

Inwx's nameserver section

Then open the DNS entries for your domain and right-click on the entry you'd like to dynamically update. Choose the "inspect element" menue entry.

DNS entries for a domain

Now you should see the developer tools and a <div>-element. The number in the id-attribute's value after record_div_ is the wanted number.

DNS entry's ID

Copy this ID (here: 206895961) into your script.

Alternatively you can use the INWX API to obtain the record id.

bash-inwx-dyndns's People

Contributors

christiankrausse avatar gehaxelt avatar joker234 avatar peronia avatar strubbl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bash-inwx-dyndns's Issues

Error in for loop

There is an error when you have more than one domain (DNSIDsv4) )to be updated. Only the first ID will be updated, all other will be ignored, because the variable old.ipv4 is updated inside the "for loop", which causes that in the next loop the old.ipv4==new.ipv4.

So please remove line 133 (echo $NEWIPv4 > old.ipv4). I think the same apply for IPv6, but I don't use it.

I put at the end of the script the following lines and it works like this:

if [ ! "$OLDIPv4" == "$NEWIPv4" ]; then echo $NEWIPv4 > old.ipv4 log "IP Address updated to $NEWIPv4" log "###################################################" fi

old.ipv4 / old.ipv6 sollten beim Start angelegt werden

Beim ersten Start bekommt man einen Fehler:

cat: old.ipv4: No such file or directory
cat: old.ipv6: No such file or directory

Da kann mit einem einfachen

touch old.ipv4
touch old.ipv6

unterhalb von APIHOST erledigt werden.

Invalid ident.me SSL certificate

The SSL certificate for ip4.ident.me and ip6.ident.me is invalid.
Seems like the new domains are v4.ident.me and v6.ident.me, both have a valid certificate.

Error when running

Hey!

"Something went wrong updating the IPv4 address. Check the configuration and make sure you're not using Two-Factor-Authentication."

Hm... seems like I am not doing it right... any idea?

#!/bin/bash

# curl -s = silent mode
# if [ -z "$OLDIPv4" ] = true if $OLDIPv4 (a string) is null -> https://stackoverflow.com/a/18096739/11458487
# Configuration ################################################################
USERNAME="xxx"                             # Your username at INWX
PASSWORD="xxx"                 # Your password at INWX
DNSIDsv4=("382507134")                          # The ID of the A record
DNSIDsv6=()                                     # The ID of the AAAA record
SILENT=false                                    # Should the script write a logfile? (true | false)
UPDATEURLv4=""                                  # Your prefered host to get the IPv4 from
UPDATEURLv6=""                                  # Your prefered host to get the IPv6 from

Also why would I want / need two IDs for A record? Is that the problem?

Cheers!

on error updating ipv4 address it does not retry again

I run the dnsupdate.sh as cronjob every 5 minutes. This week updating my ip address at inwx went wrong one night. Although it failed updating my DNS, it did not try again on a later scheduled run of the dnsupdate.sh script. Therefore my DNS was not updated until the next day when my IP address changed again.

The error log message was:

Di 5. Sep 02:17:11 UTC 2017 | Something went wrong updating the IPv4 address. Check the configuration and make sure you're not using Two-Factor-Authentication.

I would expect that the dnsupdate.sh tries to update the DNS again if it failed before. Is there some mechanism to force that behaviour?

script error

I do use Archlinux and get a error

LANG=C ./dnsupdate.sh
Sat Dec 31 21:38:49 UTC 2016 | Updating IPv4...
sed: -e expression #1, char 154: unknown option to `s'
Sat Dec 31 21:38:49 UTC 2016 | Something went wrong updating the IPv4 address. Check the configuration and make sure you're not using Two-Factor-Authentication.

Updating problem

Has there be something changed at INWX?

After reviewing my logs, the "Something went wrong updating the IPv4 address" came more frequent in the last time. At "Mi 13. Sep 12:30:18 UTC 2017" I had the last succesful update to INWX.
The API URL from inwx.de seems to be up "https://api.domrobot.com/xmlrpc/"

Mi 13. Sep 12:25:14 UTC 2017 | Something went wrong updating the IPv4 address. Check the configuration and make sure you're not using Two-Factor-Authentication.
Mi 13. Sep 12:30:03 UTC 2017 | Updating IPv4...
Mi 13. Sep 12:30:18 UTC 2017 | Updated IPv4: (empty) -->

Edit: It seems to be https://ip4.nnev.de/ is currently down, enabling the v4.pool and v6.pool seem to fix at least the ipv4 updating problem. Updating the v6 IP is still failing over the pool variant.

Edit2: fixed the typo in the IPv6 Pool checking section.

LICENSE?

I think we should include a LICENSE file, so everyone can feel free to fork, change and redistribute the script as one like. I think I am okay with nearly all license models which hold us not liable for our code. This may help: https://choosealicense.com/

Multi ID does not work

Hey,
I´ve added 2 DomainIDs to my config, but it just updates the first.
Maybe a little bug in the script?

DNSIDsv4=("7654321" "8901234")

curl -s https://v4.ident.me >> empty

Hi!
i got a empty result from
curl -s https://v4.ident.me
and
curl -s https://v6.ident.me

The DNS is on 127.0.0.1

The LOG since 2020-11-06 1105am to now
... Mon Nov 9 14:16:10 CET 2020 | Entry ---------, v4 starts Mon Nov 9 14:16:11 CET 2020 | No IPv4 pool (v4.pool file) found. Using https://ip4.ident.me/ Mon Nov 9 14:16:11 CET 2020 | Updating IPv4 to Mon Nov 9 14:16:11 CET 2020 | Something went wrong updating the IPv4 address. Check the configuration and make sure you're not using Two-Factor-Authentication.

regards ;)

Die Ausgabe von curl wird nicht geprüft

Die Ausgabe des curl (POST) Befehls wird nicht geprüft. Falls https://api.domrobot.com/xmlrpc/ down ist, bekommt man keinen Fehler. Auch wenn man eine falsche Konfiguration angibt.

Idealerweise sollte dann ein nicht-null Fehlercode zurückgegeben werden.

IDs

Hello,

where do I obtain an "ID" for the A / AAAA entry of my domain? In the INWX interface I see no id beside the domain name.

Perhaps you can provide an example / guide?

Thanks

Special characters

After a while of debugging "Something went wrong updating the IPv4 address. Check the configuration and make sure you're not using Two-Factor-Authentication." and displaying the "$RET" Value from inwx, I found out I was getting an Authentication error.
I believe to have fixed this by changing my password to a longer one not containing special Characters potentially escaping the string or interfering otherwise. Maybe it would be possible to add a warning for this

curlmyip.com does not work

Hey gehaxelt,

your inwx solution worked nicely for me until recently.
curlmyip.com does not work anymore.
May you update your code with an alternative?

best,
karlson

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.