• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 9 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A shell script that works as Dynamic Update Client (DUC) for noip.com

I'm probably not the first one to do this, but I had a need to use NO-IP's dynamic DNS service so I could easily configure devices and computers to access resources on my LAN when I'm away. For those less familiar with NO-IP, it is a free dynamic DNS service. Most home and small office connections to the Internet have a dynamic IP, which means the IP addresses changes most every time the connection from the router is established. Typically, a domain name requires a static IP address to work. Dynamic DNS allows a domain name (i.e subdomain.example.com) to use a dynamic IP by updating NO-IP with a new IP address when the IP address changes. NO-IP then associates that IP with the domain name so services can be setup against the domain rather than the IP that changes. This makes configuring things easier.

Many routers have a built in NO-IP client, but my router doesn't support NO-IP, and for whatever reason, I could never get the client that NO-IP recommended for a Linux host to work. I downloaded the source and compile it following the instructions, and it appeared to be running, but it never updated my IP address. There was no output to the console or to a log file either to diagnose the problem that I could find, so I decided to go about writing my own, which really wasn't that hard to do using a bash script and a few simple utilities on my Linux box. Here is my how-to guide and documentation for setting this up. I'm running Ubuntu server so I'm using apt and nano, but this should work on anything POSIX based such as Mac OS X, BSD, any flavor of Linux -- even the Raspberry Pi.

The script can be run as a single instance with command line parameters, as a daemon, using crontabs (a utility for running programs on a schedule) or as a Linux service.

This script has one dependency, which is wget. This is usually installed by default on most Linux and BSD distros, but if not use your package manager to install it.

  sudo apt-get install wget

-or-

  sudo yum install wget

Usage:

  no-ip.sh -u=username -p=password -h=host.sample.com -d=true -l=/path/to/logfile.log

Parameters:

-u, --username 

Username to logon to no-ip.com.

-p, --password

Password to logon to no-ip.com.

-h, --hostname

The domain name to update.

-d, --detectip

Tells the script to detect your external IP address. This takes precedence over -i.

-i, --ip

Maually sets the IP address to update. If neither -d or -i are specified, no-ip will use the IP address it detects.

-n, --interval

When running the script as a daemon/service (see Installation), this will update no-ip every n minutes.

-l, --logfile

Sets the path to a log file. This file must be writable.

-c, --config

Sets the path to a config file. This file must be readable. Config file parameters take precedence over command line parameters.

Examples:

no-ip.sh 

Runs the script with the settings in the config file in the default locaion /etc/no-ip/no-ip.conf

no-ip.sh -u=username -p=password -h=host.sample.com -d=true -l=/path/to/logfile.log

Does a one-time update, detecting the UP and logging the results

no-ip.sh -c=/home/username/no-ip.conf

Run the script with the settings in the config file.

no-ip.sh /dev/null 2>&1 &

Runs the script as a daemon with the settings in the config file in the default locaion /etc/no-ip/no-ip.conf.

Config File:

The config file uses a simple syntax to define parameters. Any command line parameter (except --config) can also be specified in the config file. The same rules apply for the config file parameters as caommand line parameters (ie. "detectip" overrides "ip" if both are specified).

Example:

user=username 
password=password 
hostname=hostname.example.com
logfile=/var/log/no-ip.log
interval=10
detectip=true

Installation:

Before installing the script, download and extract the files to your local machine. The instructions assume your are in the no-ip-master folder.

  cd ~
  wget https://github.com/theonemule/no-ip/archive/master.zip
  unzip master.zip
  cd no-ip-master

Method 1: crontabs

Crontabs allows you to specify a schedule to run the script and it will also run the script as the user the crontab is configured for. Make sure that the user has execute permissions on the script, read permissions on the config file, and write permissions to the log file. Crontabs will run the script on a scheduled basis so there is no need to specify an interval.

Here's how to run the script as root.

1.) Create a folder in etc.

sudo mkdir /etc/no-ip

2.) Create a config file.

sudo touch /etc/no-ip/no-ip.conf

3.) Set the parameters with your favorite editor. I use nano. See the Config File section above for details.

sudo nano /etc/no-ip/no-ip.conf

user=username 
password=password 
hostname=hostname.example.com
logfile=/var/log/no-ip.log
detectip=true

4.) Copy no-ip.sh to /usr/sbin

sudo cp no-ip.sh /usr/sbin/no-ip.sh

5.) Make the script executable

sudo chmod +x /usr/sbin/no-ip.sh

6.) Logon as root

sudo -i

7.) Edit root's crontab

crontab -e

8.) Add the entry to the bottom. */10 tells crontab to run the script every time the current time is divisble by 10, or every 10 minutes and save the crontab.

*/10 * * * * /usr/sbin/no-ip.sh

Method 2: Linux Service (written for Debian-based distros. This will vary for other distros)

Make sure root has execute permissions on the script, read permissions on the config file, and write permissions to the log file.

1.) Create a folder in /etc.

sudo mkdir /etc/no-ip

2.) Create a config file.

sudo touch /etc/no-ip/no-ip.conf

3.) Set the parameters with your favorite editor. I use nano. See the Config File section above for details.

sudo nano /etc/no-ip/no-ip.conf

user=username 
password=password 
hostname=hostname.example.com
logfile=/var/log/no-ip.log
interval=10
detectip=true

4.) Copy no-ip.sh to /usr/sbin

sudo cp no-ip.sh /usr/sbin/no-ip.sh

5.) Make the script executable

sudo chmod +x /usr/sbin/no-ip.sh

6.) Copy no-ip-service to init.d

sudo cp no-ip-service /etc/init.d/no-ip-service

7.) Make no-ip-service executable

sudo chmod +x /etc/init.d/no-ip-service

8.) Start the service

sudo service no-ip-service start

9.) Add the service to start at boot.

update-rc.d no-ip-service defaults

More Repositories

1

docker-waf

An NGINX and ModSecurity based Web Application Firewall for Docker
Dockerfile
257
star
2

simple-openvpn-server

A setup script and simple web UI for setting up an OpenVPN Server
Shell
228
star
3

dos-game

A Dockerfile for running Docker based DosBox games streamed to a browser client.
JavaScript
77
star
4

docker-dynamic-dns

A tiny Docker based dynamic DNS client for Duck DNS, NO-IP, and DynDNS
Shell
41
star
5

dockercon-demos

C#
39
star
6

nginx-rtmp

A containerize NGINX server with the RTMP plugin to allow live streams to multiple providers such as Twitch, Facebook, or YouTube simultaneously from a single source.
Shell
38
star
7

aks-demos

Azure Kubernetes Services (AKS) Demos
JavaScript
28
star
8

retroarch-docker

A Docker container for hosting RetroArch playable in a browser through NoVNC.
JavaScript
26
star
9

docker-opengl-turbovnc

A dockerfile for OpenGL with TurboVNC -- Readme forthcoming.
24
star
10

gphoto-webui

A PHP Web UI for gphoto2
JavaScript
23
star
11

docker-proxy-server

Docker Proxy Server With Content Filter Built on Squid and SquidGuard
Shell
16
star
12

x86box-docker

A container image for running x86box in a Docker container and streaming the results back to the browser.
JavaScript
14
star
13

qemu-docker

Run VMs in a Docker Container and Connect To Them With a Browser!
JavaScript
12
star
14

azure-blog-storage-ftp-server

An virtual machine based front end to supply SFTP services for Azure Blob Storage
HCL
12
star
15

fahclient-azure-vm

Installs a VM to run the Folding@Home client on a Linux VM on Azure
Shell
11
star
16

blobcaster

Blobcaster: Using Azure Blob Storage to Host a Podcast
HTML
11
star
17

tagging-samples

Sample Azure Policies to enforce tagging on resources.
6
star
18

azure-function-captcha

An Azure Function implementing a CAPTCHA with logging and email.
HTML
6
star
19

jekyll-paypal-cart

An eCommerce Site Using Jekyll and PayPal.
JavaScript
5
star
20

nextcloud-azure

Automated deployments scripts for Nextcloud on Azure using Blob Storage
Shell
5
star
21

macos-docker

Run a MacOS (OSX) Virtual Machine in a Docker Container
Shell
4
star
22

llmworkshop

A repo for cpde and slides for the LLM workshop.
HTML
3
star
23

psrd

A remote desktop client/server app implemented in PowerShell
PowerShell
2
star
24

azure-iot-architecture

JavaScript
2
star
25

azure-gaming-pc

An ARM Template for creating a remote gaming PC on Azure!
2
star
26

JekyllManager

A Lightweight Manager for Jekyll-based websites
HTML
1
star
27

graph-api-sample

Sample Code for Cosmos DB Graph API https://youtu.be/98PtbE4f4B8
C#
1
star
28

jitsi-install

A Shell Script to setup Jitsi on Ubuntu 22.04 with an Azure ARM Template
Shell
1
star
29

ce2c

Python
1
star
30

dailydadjokes

The GitHub backend for Daily Dad Jokes 4U -- a personal learning exercise in GH Actions and GH Pages.
HTML
1
star
31

python-lab

Source code for a Python Lab with Visual Studio Code
HTML
1
star
32

web-pubsub-demo

A demo app for Azure Web Pub Sub
HTML
1
star
33

llm-workshop

Python
1
star
34

nl2sql

A quick demo on how to translate natural language to SQL queries using GPT.
Python
1
star