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 boomshadow commented Mar 2, 2017

Thanks, this is exactly what I needed!

@jeandoyon

This comment has been minimized.

Copy link

@jeandoyon jeandoyon commented Mar 16, 2017

Thank you!

@audip

This comment has been minimized.

Copy link

@audip audip commented Apr 28, 2017

Thanks

@jorgejch

This comment has been minimized.

Copy link

@jorgejch jorgejch commented Jun 10, 2017

Thx!

@bhundven

This comment has been minimized.

Copy link

@bhundven bhundven commented Jul 2, 2017

👍

@saulodebaco

This comment has been minimized.

Copy link

@saulodebaco saulodebaco commented Jul 12, 2017

Tks a lot!

@asanfilov

This comment has been minimized.

Copy link

@asanfilov asanfilov commented Jul 21, 2017

Thank you!

@aaugusto-ies

This comment has been minimized.

Copy link

@aaugusto-ies 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 poppycocker commented Sep 8, 2017

Great work 👍 👍 👍

@janhar

This comment has been minimized.

Copy link

@janhar janhar commented Sep 16, 2017

Thanks

@Marenostrum81

This comment has been minimized.

Copy link

@Marenostrum81 Marenostrum81 commented Oct 2, 2017

Many thanks!

@olihey

This comment has been minimized.

Copy link

@olihey olihey commented Nov 25, 2017

Thanks

@skjnldsv

This comment has been minimized.

Copy link

@skjnldsv skjnldsv commented Dec 26, 2017

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

@ghost

This comment has been minimized.

Copy link

@ghost 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 lptrickmccarty commented Mar 12, 2018

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

@stantonfinley

This comment has been minimized.

Copy link

@stantonfinley 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 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 nemet commented Jul 26, 2018

Thanks!

@robinastedt

This comment has been minimized.

Copy link

@robinastedt robinastedt commented Aug 6, 2018

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

@OdeToSpot

This comment has been minimized.

Copy link

@OdeToSpot OdeToSpot commented Sep 5, 2018

Thanks! Works like a charm :)

@jwmarcus

This comment has been minimized.

Copy link

@jwmarcus 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 BurhanKhan1 commented Oct 19, 2018

Awesome

@Odel

This comment has been minimized.

Copy link

@Odel Odel commented Nov 22, 2018

Thanks!

@oldfellla

This comment has been minimized.

Copy link

@oldfellla 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 fabricioitajuba commented Dec 25, 2018

Thank you!

@jonopare

This comment has been minimized.

Copy link

@jonopare jonopare commented Jan 23, 2019

👍 👍

@hanhha

This comment has been minimized.

Copy link

@hanhha 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 Plotnus commented Jun 7, 2019

Thanks!

@tedheadster

This comment has been minimized.

Copy link

@tedheadster 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 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 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 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 tedheadster commented Jun 21, 2019

@MarkRMonaco

This comment has been minimized.

Copy link

@MarkRMonaco MarkRMonaco commented Jul 15, 2019

Thanks!

@plao

This comment has been minimized.

Copy link

@plao 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 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 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 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 DesertRider commented Oct 16, 2019

Works great!

Thanks for the clean & simple solution!

@danilomagrini

This comment has been minimized.

Copy link

@danilomagrini 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 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 santiagocarod commented Dec 10, 2019

Thanks!

@saqibj

This comment has been minimized.

Copy link

@saqibj saqibj commented Mar 29, 2020

Thank you, folks!

@folax

This comment has been minimized.

Copy link

@folax folax commented Apr 20, 2020

Thank you. It's work fine.

@JamesCordell

This comment has been minimized.

Copy link

@JamesCordell JamesCordell commented May 1, 2020

yessss thanks

@amunozf

This comment has been minimized.

Copy link

@amunozf amunozf commented May 8, 2020

Very good. Thanks.

@oregonpillow

This comment has been minimized.

Copy link

@oregonpillow 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 nag-audio commented Jun 17, 2020

very good! thnx

@syafiqfaiz

This comment has been minimized.

Copy link

@syafiqfaiz 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 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 ***********@gmail.com
configured for:
	host  **********.com
Updating every 5 minutes via /dev/wlx281878338e41 with NAT enabled.

So it might be still working fine. Not sure.

@seba13680

This comment has been minimized.

Copy link

@seba13680 seba13680 commented Jul 13, 2020

You are the fucking Best¡ Greetings from Argentina¡

@amiltonjr

This comment has been minimized.

Copy link

@amiltonjr amiltonjr commented Sep 11, 2020

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 :)

I tried to do it on my Raspberry Pi 3B running Raspbian Buster to avoid setting 0.0.0.0 as my IP address but it seems not to be working...

A temporary fix I did was calling the following on my sudo's crontab:

@reboot sh -c "sudo noip2 -i $(curl -sS ifconfig.me)"

@cahilld

This comment has been minimized.

Copy link

@cahilld cahilld commented Sep 25, 2020

Hi

I'm following along with this tutorial:
https://www.youtube.com/watch?v=HTLwGTkBFy4&list=PLjwDNSlPlIIunYlhIRuftmmPmMZlze6WJ&index=13
4mins30seconds

Im getting the following when I run
sudo systemctl enable noip2
error:
/etc/systemd/system$ sudo systemctl enable noip2 Failed to execute operation: No such file or directory

I noticed there is an extra step here to do with the daemon which Ive done but am not really getting it an was hoping it would just work.

Anyone got any ideas, or know how to check if its running properly? I left it at the default 30
Cheers

Answer:
I got this fixed by killing the process with the -K switch(kill proc id didnt do anything as it auto restarted each time) in the readme in noip folder(Dont know why they didnt just put it on the website) and then doing the daemon step later.

Not sure if its 100% right yet because I have to wait for the name servers to replicate around, but Im passed the roadblock of not being able to get tthe service runnign and the restart launch not working. Hope someone else gets

@RoyKas

This comment has been minimized.

Copy link

@RoyKas RoyKas commented Sep 26, 2020

Hi,

I experience a different behavior:
When run from command line noip2 forks and stays running as a daemon. I can see it using 'ps aux'.
When run as a systemd service, is does not fork and using type=forking does not work for me.
I had to switch to type=simple. But now noip2 exits after updating the IP.
It seems it is expecting to be run as a systemd timer.
How can noip2 behave so differently depending on how you call it...?

@Fixmetal

This comment has been minimized.

Copy link

@Fixmetal Fixmetal commented Oct 4, 2020

Nice job it works and helps by just copy/pasting 👍

@barracuda7

This comment has been minimized.

Copy link

@barracuda7 barracuda7 commented Oct 14, 2020

Thank you works perfectly. cheers

@aktasch

This comment has been minimized.

Copy link

@aktasch aktasch commented Oct 18, 2020

Thank you very much

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.