Skip to content

andi34/ddns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Get public IPv4 and public IPv6 address

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.

⚙️ Requirements

  • Internet connection
  • curl or wget (NOTE: email notification only works using curl)

🔧 Usage

Prerequisites

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.

Run the script manually

  1. Download the ddns.sh script:

wget https://raw.githubusercontent.com/andi34/ddns/master/ddns.sh

  1. Make the script executable:

chmod +x ddns.sh

  1. Create /etc/ddns folder to store your IP address
sudo -i
mkdir -p /etc/ddns
chmod 711 /etc/ddns
  1. Change the config depending on your needs using your favourite text editor:

nano ddns.sh

  1. Run the script:

bash ddns.sh

Setup cron job

  1. Login as "root"

sudo -i

  1. Create /etc/ddns folder to store your IP address
mkdir -p /etc/ddns
chmod 711 /etc/ddns
  1. 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
  1. Change the config inside /usr/local/bin/ddns depending on your needs using your favourite text editor:

nano /usr/local/bin/ddns

❓ Troubleshooting

  • 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 and scp without using a password?

    Use ssh-keygen to create your key pair, for example you can use ssh-keygen -t rsa -b 4096 -C "root@localhost".

❔ TO-DO

  • ?

🎉 Donation

If you like my work and like to keep me motivated you can buy me a coconut water:

Donate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages