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
@nag-audio
Copy link

nag-audio commented Jun 17, 2020

very good! thnx

@syafiqfaiz
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
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 ***********@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
Copy link

seba13680 commented Jul 13, 2020

You are the fucking Best¡ Greetings from Argentina¡

@amiltonjr
Copy link

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
Copy link

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
Copy link

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
Copy link

Fixmetal commented Oct 4, 2020

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

@barracuda7
Copy link

barracuda7 commented Oct 14, 2020

Thank you works perfectly. cheers

@aktasch
Copy link

aktasch commented Oct 18, 2020

Thank you very much

@iudexus
Copy link

iudexus commented Oct 27, 2020

I was so close, but no cigars..... now my noip2.service purrs like a kitten. Thank you!

@msdos
Copy link

msdos commented Dec 15, 2020

I was having this error as well in a Raspbian installation:

Can't gethostbyname for dynupdate.no-ip.com
Can't get our visible IP address from ip1.dynupdate.no-ip.com

Found a workaround, just add to noip2.service file:

[Service]
ExecStartPre=/bin/sh -c 'until ping -c1 google.com; do sleep 1; done;'

After rebooting, now it works. systemctl status noip2.service:

Dec 15 02:51:35 msdos sh[674]: ping: google.com: Temporary failure in name resolution
Dec 15 02:51:36 msdos sh[674]: ping: google.com: Temporary failure in name resolution
Dec 15 02:51:37 msdos sh[674]: PING google.com() 56 data bytes
Dec 15 02:51:37 msdos sh[674]: 64 bytes from (): icmp_seq=1 ttl=119 time=10.7 ms
Dec 15 02:51:37 msdos sh[674]: --- google.com ping statistics ---
Dec 15 02:51:37 msdos sh[674]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
Dec 15 02:51:37 msdos sh[674]: rtt min/avg/max/mdev = 
Dec 15 02:51:37 msdos systemd[1]: Started No-ip.com dynamic IP address updater.
Dec 15 02:51:37 msdos noip2[1030]: v2.1.9 daemon started with NAT enabled
Dec 15 02:51:41 msdos noip2[1030]: mydns.ddns.net was already set to xxx.xxx.xxx.xxx

Not exactly "pretty" but with all due respect, I've spent three hours using noip2.service files from the whole internet, from centos to slackware to arch linux with no solution.

@kingdavid72
Copy link

kingdavid72 commented Jan 2, 2021

thank you so much
Wants=network-online.target
After=network-online.target
two lines fixed my problem

@NetMango
Copy link

NetMango commented Jan 20, 2021

Works perfectly wit TurnKey GNU/Linux 16.0 (Debian 10/Buster). Thank you.

@rst0git
Copy link

rst0git commented Feb 26, 2021

On RHEL, where SELinux is enabled, you might need to run:

restorecon /etc/systemd/system/noip2.service

@jwo-21
Copy link

jwo-21 commented Mar 13, 2021

Many thanks for this well-tuned solution Nathan!

@harrisclinton
Copy link

harrisclinton commented Mar 20, 2021

On Ubuntu 20.04 I still get the

Can't gethostbyname for dynupdate.no-ip.com
Can't get our visible IP address from ip1.dynupdate.no-ip.com

on boot, despite trying

Wants=network-online.target
After=network-online.target

If anyone knows a more permanent solution than the one above from msdos, I'd love to try it.

Adding that line

[Service]
ExecStartPre=/bin/sh -c 'until ping -c1 google.com; do sleep 1; done;'

eliminates the error and eventually results in getting the correct IP, but it takes no less than 2 minutes and 10 seconds of trying to ping Google before there's a response. Should my network be taking that long to start up? Once it's running, the ping works at one try if I restart the service. It's just startup that takes literally minutes.

@belangp
Copy link

belangp commented Mar 30, 2021

Simple and works like a charm. Thank you!

@Sokoloft
Copy link

Sokoloft commented Apr 29, 2021

Thanks. Worked great!

@requa3r0
Copy link

requa3r0 commented May 11, 2021

thanks all good.
Dont forget to pkill noip2.....then check with noip2 -S
to seen no instances of the program is running, before launching the service

@AndiSusanto15
Copy link

AndiSusanto15 commented Jun 24, 2021

thank you

@gustavozantut
Copy link

gustavozantut commented Aug 1, 2021

<3

@LingxiaoShawn
Copy link

LingxiaoShawn commented Aug 31, 2021

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

works for me! Thank you.

@bralandealmeida
Copy link

bralandealmeida commented Sep 8, 2021

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'.

Thanks. Works for me!

If anyone has the mentioned problem, make sure to kill all NOIP processes before starting the service. Or restart the machine.

ps aux | grep noip

@cr45hmurphy
Copy link

cr45hmurphy commented Oct 8, 2021

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'.

Thanks. Works for me!

If anyone has the mentioned problem, make sure to kill all NOIP processes before starting the service. Or restart the machine.

ps aux | grep noip

Thank you for this! Was racking my brain for over an hour on this one.

@EDIflyer
Copy link

EDIflyer commented Nov 21, 2021

Thanks for this, @NathanGiesbrecht - unfortunately no matter what I do I can't get things to work without the 0.0.0.0 error on my Pi4...

Nov 21 16:32:15 pi400 systemd[1]: Starting No-IP Dynamic DNS Update Client...
Nov 21 16:32:15 pi400 noip2[528]: v2.1.9 daemon started with NAT enabled
Nov 21 16:32:15 pi400 noip2[519]: Can't gethostbyname for dynupdate.no-ip.com
Nov 21 16:32:15 pi400 noip2[519]: Can't get our visible IP address from ip1.dynupdate.no-ip.com
Nov 21 16:32:15 pi400 noip2[519]: ! Last_IP_Addr = 0.0.0.0, IP =
Nov 21 16:32:15 pi400 systemd[1]: Started No-IP Dynamic DNS Update Client.

I've tried various options in the [Unit] settings but all to no avail...

Wants=network-online.target
After=network-online.target

Wants=network-online.target systemd-resolved.service
After=network-online.target systemd-resolved.service

After=network.target
After=syslog.target

BindsTo=NetworkManager.service
After=network.target systemd-resolved.service NetworkManager.service

After=network.target systemd-resolved.service

The only thing that worked in the end was the workaround from @msdos - I just changed it from google.com to no-ip.com to make it feel a tiny bit less hacky! Presumably an issue in Rasperry Pi OS/Debian where it's reporting network as being online before it isn't?

@frock81
Copy link

frock81 commented Jan 15, 2022

Thanks.

@revathskumar
Copy link

revathskumar commented Mar 19, 2022

with wireguard this worked for me

Wants=wg-quick@wg0.service network-online.target
After=wg-quick@wg0.service network-online.target

@mihairaducu
Copy link

mihairaducu commented Mar 23, 2022

[Service]
ExecStartPre=/bin/sh -c 'until ping -c1 google.com; do sleep 1; done;'

Man, you saved me a lot of time. Thanks

@beterhans
Copy link

beterhans commented May 19, 2022

thanks you so much no i can use it.

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