Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Systemd Service file for no-ip.com dynamic ip updater
# Simple No-ip.com Dynamic DNS Updater
#
# By Nathan Giesbrecht (http://nathangiesbrecht.com)
#
# 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin)
# 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file
# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl daemon-reload`
# 5) Execute `sudo systemctl enable noip2`
# 6) Execute `sudo systemctl start noip2`
#
# systemd supports lots of fancy features, look here (and linked docs) for a full list:
# http://www.freedesktop.org/software/systemd/man/systemd.exec.html
[Unit]
Description=No-ip.com dynamic IP address updater
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
Alias=noip.service
[Service]
# Start main service
ExecStart=/usr/local/bin/noip2
Restart=always
Type=forking
@boomshadow

This comment has been minimized.

Copy link

boomshadow commented Mar 2, 2017

Thanks, this is exactly what I needed!

@jeandoyon

This comment has been minimized.

Copy link

jeandoyon commented Mar 16, 2017

Thank you!

@audip

This comment has been minimized.

Copy link

audip commented Apr 28, 2017

Thanks

@jorgejch

This comment has been minimized.

Copy link

jorgejch commented Jun 10, 2017

Thx!

@bhundven

This comment has been minimized.

Copy link

bhundven commented Jul 2, 2017

👍

@saulodebaco

This comment has been minimized.

Copy link

saulodebaco commented Jul 12, 2017

Tks a lot!

@aprobinda

This comment has been minimized.

Copy link

aprobinda commented Jul 21, 2017

Thank you!

@aaugusto-ies

This comment has been minimized.

Copy link

aaugusto-ies commented Aug 29, 2017

Thank you! It's perfect: short, concise and to the target!
It worked flawlessly in a Raspeberry Pi 3 with opensuse Leap 43.2

@poppycocker

This comment has been minimized.

Copy link

poppycocker commented Sep 8, 2017

Great work 👍 👍 👍

@janhar

This comment has been minimized.

Copy link

janhar commented Sep 16, 2017

Thanks

@Marenostrum81

This comment has been minimized.

Copy link

Marenostrum81 commented Oct 2, 2017

Many thanks!

@olihey

This comment has been minimized.

Copy link

olihey commented Nov 25, 2017

Thanks

@skjnldsv

This comment has been minimized.

Copy link

skjnldsv commented Dec 26, 2017

Thank you! :)
Works perfectly on rpi B+ under Raspbian!

@ghost

This comment has been minimized.

Copy link

ghost commented Feb 2, 2018

https://bugzilla.redhat.com/show_bug.cgi?id=1431368
Can't gethostbyname for dynupdate.no-ip.com
Can't get our visible IP address from ip1.dynupdate.no-ip.com

for those that have this error on boot, just change replace:
[Unit]
Description=No-ip.com dynamic IP address updater
Wants=network-online.target
After=network-online.target

Thank you for snippets :)

@lptrickmccarty

This comment has been minimized.

Copy link

lptrickmccarty commented Mar 12, 2018

Very awesome!!!! Thank you!!!!

@stantonfinley

This comment has been minimized.

Copy link

stantonfinley commented May 12, 2018

Don't forget to do a "sudo systemctl enable noip2.service" to enable this and create the proper symlinks. Then it will run on reboot.

@krystof1119

This comment has been minimized.

Copy link

krystof1119 commented Jul 11, 2018

Thanks! Wrote this myself WAY too many times... but this one is more reliable, somehow.

@nemet

This comment has been minimized.

Copy link

nemet commented Jul 26, 2018

Thanks!

@robinastedt

This comment has been minimized.

Copy link

robinastedt commented Aug 6, 2018

Thanks! Couldn't get mine to work...

@OdeToSpot

This comment has been minimized.

Copy link

OdeToSpot commented Sep 5, 2018

Thanks! Works like a charm :)

@jwmarcus

This comment has been minimized.

Copy link

jwmarcus commented Oct 2, 2018

Perfect! Worked right out of the box for Ubuntu 18.04 LTS. Thanks for sharing!

@BurhanKhan1

This comment has been minimized.

Copy link

BurhanKhan1 commented Oct 19, 2018

Awesome

@Odel

This comment has been minimized.

Copy link

Odel commented Nov 22, 2018

Thanks!

@oldfellla

This comment has been minimized.

Copy link

oldfellla commented Dec 4, 2018

Thanks dude, that's great for a lazy ass like me :-)
Awesome!

@fabricioitajuba

This comment has been minimized.

Copy link

fabricioitajuba commented Dec 25, 2018

Thank you!

@jonopare

This comment has been minimized.

Copy link

jonopare commented Jan 23, 2019

👍 👍

@hanhha

This comment has been minimized.

Copy link

hanhha commented Feb 11, 2019

Thank you very much. It saved me several hours as I've ever remember them.

@Plotnus

This comment has been minimized.

Copy link

Plotnus commented Jun 7, 2019

Thanks!

@tedheadster

This comment has been minimized.

Copy link

tedheadster commented Jun 20, 2019

So I think there is a problem. I don't think it re-runs this periodically to update network changes (at least it does not on my machine). Is there a change we can make to do this?

@tedheadster

This comment has been minimized.

Copy link

tedheadster commented Jun 20, 2019

I figured it out. It turns out the noip2 binary defaults to updating only every 30 DAYS (not minutes). Oddly, you have to do this to change the config file default:

pkill noip2 # stop running daemon
/usr/local/bin/noip2 -U 30 # rewrite /usr/local/etc/no-ip2.conf files with new data
/usr/local/bin/noip2 # restart actual daemon; previous step does NOT do this

@Plotnus

This comment has been minimized.

Copy link

Plotnus commented Jun 20, 2019

I think the issue here is that when we go to the no-ip2 website we see that our ip hasn't updated for longer than the interval we set.

This happens because, with default values, noip2 only sends updates when the ip changes.

If you want to change this default behavior, you'll want to change two values in noip2.c

  • change the line #define FORCE_UPDATE 0 to #define FORCE_UPDATE 1
  • change the line #define FORCE_INTERVAL (1440 * 30) to be the time period in minutes that you want to force an update. for example if we want to update every 15 minutes we should change it to #define FORCE_INTERVAL(15)

Once you have done this rerun make clean install.

@DanielFloris

This comment has been minimized.

Copy link

DanielFloris commented Jun 21, 2019

Can anyone help me. When I check status, I always get :

   Loaded: loaded (/etc/systemd/system/noip2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-06-21 12:59:07 BST; 10s ago
  Process: 7405 ExecStart=/usr/local/bin/noip2 (code=exited, status=0/SUCCESS)
 Main PID: 7406 (code=exited, status=255)

Jun 21 12:59:07 raspberrypi systemd[1]: noip2.service: Failed with result 'exit-code'.
Jun 21 12:59:07 raspberrypi systemd[1]: noip2.service: Service hold-off time over, scheduling restart.
Jun 21 12:59:07 raspberrypi systemd[1]: Stopped No-ip.com dynamic IP address updater.
Jun 21 12:59:07 raspberrypi systemd[1]: noip2.service: Start request repeated too quickly.
Jun 21 12:59:07 raspberrypi systemd[1]: Failed to start No-ip.com dynamic IP address updater.
Jun 21 12:59:07 raspberrypi systemd[1]: noip2.service: Unit entered failed state.
Jun 21 12:59:07 raspberrypi systemd[1]: noip2.service: Failed with result 'exit-code'.
@tedheadster

This comment has been minimized.

Copy link

tedheadster commented Jun 21, 2019

@MarkRMonaco

This comment has been minimized.

Copy link

MarkRMonaco commented Jul 15, 2019

Thanks!

@plao

This comment has been minimized.

Copy link

plao commented Aug 13, 2019

Many thanks, Nathan! You have done the trick :-) It works like a charm...

@skewty

This comment has been minimized.

Copy link

skewty commented Aug 23, 2019

In between steps 3 and 4 you are missing a step.

See missing step 4) below:

# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl daemon-reload`
# 5) Execute `sudo systemctl enable noip2`
# 6) Execute `sudo systemctl start noip2`
@NathanGiesbrecht

This comment has been minimized.

Copy link
Owner Author

NathanGiesbrecht commented Aug 25, 2019

In between steps 3 and 4 you are missing a step.

See missing step 4) below:

# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl daemon-reload`
# 5) Execute `sudo systemctl enable noip2`
# 6) Execute `sudo systemctl start noip2`

Thanks!

@flyingstones

This comment has been minimized.

Copy link

flyingstones commented Sep 11, 2019

Thanks! Why noip.com not reffer to here!?!? Just envy???

Great job!

@DesertRider

This comment has been minimized.

Copy link

DesertRider commented Oct 16, 2019

Works great!

Thanks for the clean & simple solution!

@danilomagrini

This comment has been minimized.

Copy link

danilomagrini commented Oct 30, 2019

Why the service run as "nobody"? How to make it run as "root"?

root 5409 0.0 0.0 21224 2748 ? S 01:33 0:00 /lib/systemd/systemd-udevd
root 5410 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd
root 5411 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd
nobody 5412 0.0 0.0 4832 1956 ? Ss 01:33 0:00 /usr/local/bin/noip2
root 5413 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd
root 5414 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd

@NathanGiesbrecht

This comment has been minimized.

Copy link
Owner Author

NathanGiesbrecht commented Oct 30, 2019

Why the service run as "nobody"? How to make it run as "root"?

root 5409 0.0 0.0 21224 2748 ? S 01:33 0:00 /lib/systemd/systemd-udevd
root 5410 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd
root 5411 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd
nobody 5412 0.0 0.0 4832 1956 ? Ss 01:33 0:00 /usr/local/bin/noip2
root 5413 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd
root 5414 0.0 0.0 21224 2744 ? S 01:33 0:00 /lib/systemd/systemd-udevd

I don't think it needs to run as a privileged user as it's not updating anything on your own system. But if you're having problems I'd suggest checking out the SystemD service file docs https://www.freedesktop.org/software/systemd/man/systemd.exec.html

@santiagocarod

This comment has been minimized.

Copy link

santiagocarod commented Dec 10, 2019

Thanks!

@saqibj

This comment has been minimized.

Copy link

saqibj commented Mar 29, 2020

Thank you, folks!

@folax

This comment has been minimized.

Copy link

folax commented Apr 20, 2020

Thank you. It's work fine.

@JamesCordell

This comment has been minimized.

Copy link

JamesCordell commented May 1, 2020

yessss thanks

@amunozf

This comment has been minimized.

Copy link

amunozf commented May 8, 2020

Very good. Thanks.

@oregonpillow

This comment has been minimized.

Copy link

oregonpillow commented May 23, 2020

Awesome!! I would like to add, for anyone running a VPN on boot as well (using OpenVPN), perhaps you want the noip2 service to wait until VPN is connected before updating address. In this case just change the Requires and After:

[Unit]
Description=No-ip.com dynamic IP address updater
Requires=sys-devices-virtual-net-tun0.device
After=sys-devices-virtual-net-tun0.device

[Install]
WantedBy=multi-user.target
Alias=noip.service

[Service]
# Start main service
ExecStart=/usr/local/bin/noip2
Restart=always
Type=forking
@nag-audio

This comment has been minimized.

Copy link

nag-audio commented Jun 17, 2020

very good! thnx

@syafiqfaiz

This comment has been minimized.

Copy link

syafiqfaiz commented Jul 3, 2020

I am getting error here.

➜  system sudo systemctl status noip2
● noip2.service - No-ip.com dynamic IP address updater
     Loaded: loaded (/etc/systemd/system/noip2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2020-07-03 21:42:24 +08; 20s ago
    Process: 23625 ExecStart=/usr/local/bin/noip2 (code=exited, status=0/SUCCESS)
   Main PID: 23626 (code=exited, status=255/EXCEPTION)

Jul 03 21:42:24 pop-os systemd[1]: noip2.service: Scheduled restart job, restart counter is at 5.
Jul 03 21:42:24 pop-os systemd[1]: Stopped No-ip.com dynamic IP address updater.
Jul 03 21:42:24 pop-os systemd[1]: noip2.service: Start request repeated too quickly.
Jul 03 21:42:24 pop-os systemd[1]: noip2.service: Failed with result 'exit-code'.
Jul 03 21:42:24 pop-os systemd[1]: Failed to start No-ip.com dynamic IP address updater.

what I did wrong?

@mfoglio

This comment has been minimized.

Copy link

mfoglio commented Jul 5, 2020

Same issue here.

Hover running:
sudo noip2 -S
Output:

1 noip2 process active.

Process 1009, started as noip2, (version 2.1.9)
Using configuration from /usr/local/etc/no-ip2.conf
Last IP Address set 0.0.0.0
Account foglio.matteo@gmail.com
configured for:
	host  k8s-mfoglio.ddns.net
Updating every 5 minutes via /dev/wlx281878338e41 with NAT enabled.

So it might be still working fine. Not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.