Skip to content

Instantly share code, notes, and snippets.

@MichaelRyom
Created March 29, 2018 14:11
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelRyom/a558b71a83a5a7428c1b577ef9c8c52e to your computer and use it in GitHub Desktop.
Save MichaelRyom/a558b71a83a5a7428c1b577ef9c8c52e to your computer and use it in GitHub Desktop.
#!/bin/bash
#Source https://michaelryom.dk/custom-ddns-on-ubiquiti-usg/
cat << 'EOF' > /etc/cron.hourly/ddns
#!/bin/bash
IP=$(curl -s -L "http://ipv4.myip.dk/api/info/IPv4Address" | sed -e 's/^"//' -e 's/"$//')
curl -s -L "https://api.unoeuro.com/ddns.php?apikey=<API key>&domain=<Domain>&hostname=<Sub domain>&myip=$IP" | logger
EOF
chmod +x /etc/cron.hourly/ddns
@adrianmihalko
Copy link

On my USG I have two WAN. Do you have an idea how it would be possible to get WAN2 public ip?

@adrianmihalko
Copy link

IP=$(ip address show pppoe0 | grep 'inet ' | awk '{print $2}')

@bjesuiter
Copy link

THIS IS AWESOME! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment