# Update public IP with nsupdate on LeBureau DNS zone

**URL:** <https://forum.yunohost.org/t/update-public-ip-with-nsupdate-on-lebureau-dns-zone/42540>\
**Category:** Tutorials\
**Tags:** english\
**Created:** [June 29, 2026, 6:16pm UTC](https://forum.yunohost.org/t/update-public-ip-with-nsupdate-on-lebureau-dns-zone/42540 "2026-06-29T18:16:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thatoo](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@Thatoo](https://forum.yunohost.org/u/Thatoo)\
**Post date:** [June 29, 2026, 6:16pm UTC](https://forum.yunohost.org/t/update-public-ip-with-nsupdate-on-lebureau-dns-zone/42540/1 "2026-06-29T18:16:56Z")

</div>

If your server is behind a connection that may change its public IP and your registrar is LeBUreau, here is a way to update automatically the DNS zone.

First, create your nsupdate key file /PATH/TO/YOUR/KEY.key based on information given by Lebureau. Its content should look something like :

```auto
key "lebureau_coop_domain_tld" {
    algorithm hmac-sha512;
    secret "A_STRONG_AND_LONG_SECRET";
};

```

then you create a bash script /opt/nsupdate/nsupdate-dynip :

```auto
#!/usr/bin/env bash

ECHO=$(which echo)
NSUPDATE=$(which nsupdate)

# Set the DNS entry you want to update, please notice the final dot.
HOST="sub.domain.tld."

# Set the key provided by your DNS administrator
KEY="/PATH/TO/YOUR/KEY.key"

# Set the DNS server name or IP
SERVER="ns1.lebureau.coop"

# Set the zone to modify, it can be any zone previous key has permissions to modify
ZONE="domain.tld."

# Get your current public IP address
wget --quiet -O NewIP.txt https://ip.yunohost.org
IP=$(cat NewIP.txt)
rm NewIP.txt

# Get the public IP registered in DNS zone
OLDIP=`dig $HOST +short @45.13.107.8`

if ["$IP" != "$OLDIP"];
then
    $ECHO "server $SERVER" > /tmp/nsupdate
    $ECHO "debug yes" >> /tmp/nsupdate
    $ECHO "zone $ZONE" >> /tmp/nsupdate
    $ECHO "update delete $HOST" >> /tmp/nsupdate
    $ECHO "update add $HOST 3600 A $IP" >> /tmp/nsupdate
    $ECHO "send" >> /tmp/nsupdate
fi
$NSUPDATE -k ${KEY} -v /tmp/nsupdate >> /var/log/nsupdate-dynip.log 2>&1

```

Don’t forget to make this file executable : `chmod u+x /opt/nsupdate/nsupdate-dynip`

then, you add to `crontab -e` :  
`*/5 * * * * [-x /opt/nsupdate/nsupdate-dynip] && /opt/nsupdate/nsupdate-dynip`

> based on adocampo work : [nsupdate-dynip/nsupdate-dynip at master · adocampo/nsupdate-dynip · GitHub](https://github.com/adocampo/nsupdate-dynip/blob/master/nsupdate-dynip)
