Get public IPv4 & IPv6 via curl
or wget
using the OpenSource Public IP Address API from https://www.ipify.org.
Your public IPv4 & IPv6 get stored for further use.
curl
is used to send email notifications.
- Internet connection
curl
orwget
(NOTE: email notification only works usingcurl
)
To use scp
to transfer your IP address files to your Static-IP-Server you first need to add your public ssh key
to your Static-IP-Servers authorized ssh keys:
cat ~/.ssh/id_rsa.pub | ssh root@sever 'cat >> .ssh/authorized_keys'
Confirm by entering your password.
You should now be able to ssh into your Static-IP-Server without entering the password.
- Download the
ddns.sh
script:
wget https://raw.githubusercontent.com/andi34/ddns/master/ddns.sh
- Make the script executable:
chmod +x ddns.sh
- Create /etc/ddns folder to store your IP address
sudo -i
mkdir -p /etc/ddns
chmod 711 /etc/ddns
- Change the config depending on your needs using your favourite text editor:
nano ddns.sh
- Run the script:
bash ddns.sh
- Login as "root"
sudo -i
- Create /etc/ddns folder to store your IP address
mkdir -p /etc/ddns
chmod 711 /etc/ddns
- Add a hourly cron job:
cd /etc/cron.hourly
wget https://raw.githubusercontent.com/andi34/ddns/master/etc/cron.hourly/ddns
chmod 755 ddns
cd /usr/local/bin
wget https://raw.githubusercontent.com/andi34/ddns/master/ddns.sh
mv ddns.sh ddns
chmod 755 ddns
- Change the config inside
/usr/local/bin/ddns
depending on your needs using your favourite text editor:
nano /usr/local/bin/ddns
-
Error "curl: (67) Login denied.":
This may be because of your Google account security settings, please turn on less secure apps (https://www.google.com/settings/security/lesssecureapps) and try again.
-
How can i create a public and private key pair so i can use
ssh
andscp
without using a password?Use
ssh-keygen
to create your key pair, for example you can usessh-keygen -t rsa -b 4096 -C "root@localhost"
.
- ?
If you like my work and like to keep me motivated you can buy me a coconut water: