Dynamic DNS, getting it working - Day 5

Mapping out my dynamic DNS process
Raspberry Pi logo.
| Raspberry Pi Logo |

Project Scope and ToDos

  1. Be able to host a server
  2. Be able to build node projects
  3. Be able to handle larger projects
  • Be able to run continually

Day 4

Ok, I had to reset the device's OS to a 64-bit version because I want to do some applications that require it.

Now I want to use it as a web host, but that means a Dynamic DNS mapping.

I took a look at options and I think I can use the new registrar I've been trying out, Porkbun, directly. I use GoDaddy for most of my domains (yes I know) but their API doesn't seem to allow for you to create keys with restricted access to particular domains, it is all or nothing. Porkbun apparently allows you to limit access to particular domains. So let's try that.

Everything I've read seems to indicate that DDClient is the way to go, but thus far I haven't gotten it to work. Let's see what the deal is.

I can find the Porkbun API down in the footer.

That lets me create the key and secret for the API. Now I can see the API docs.

So I'm going to test out the API to make sure my keys work:

curl --request GET \
--url https://api.porkbun.com/api/json/v3/ping \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/10.3.0' \
--cookie BUNSESSION2=xxxx \
--data '{
"secretapikey": "xxxxx",
"apikey": "xxxxxx"
}
'

Ok, that worked! I got back:

{
"status": "SUCCESS",
"yourIp": "xxxx",
"xForwardedFor": "xxxx"
}

So I know my keys work!

I wasn't able to get this working with GoDaddy, but that means I configured it incorrectly. So I need to know how to re-configure the config file with whereis ddclient.

Ok, that wasn't where it was, but running it did give me an error that told me where the file was. Going to try to alter the file via sudo nano /etc/ddclient.conf .

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

protocol=porkbun \
use=web, web=ipify-ipv4 \
login='xxxx' \
password='xxxx' \

Huh, Porkbun isn't a protocol. Let's look and see how I activate it.

Ah, well it needs a different configuration:

##
## Porkbun (https://porkbun.com/)
##
# protocol=porkbun
# apikey=APIKey
# secretapikey=SecretAPIKey
# root-domain=example.com
# host.example.com,host2.sub.example.com
# example.com,sub.example.com

Oh, apparently the package manager version is not up to date. I checked:

ddclient ---

and it is 3.10.0.

Looks like I'm not the only one with this problem.

Let's remove the package from apt-get sudo apt-get remove ddclient.

I found something useful, Porkbun has their own walkthrough! But wait... it points at depreciated tech. Ok, so build DDClient locally instead I guess!

I will get the latest from the GitHub tags.

wget https://github.com/ddclient/ddclient/archive/refs/tags/v3.11.2.tar.gz

tar xvfa v3.11.2.tar.gz

cd ddclient-3.11.2/

sudo mkdir /etc/ddclient

sudo touch /etc/ddclient/ddclient.conf

Ok, stuff isn't working. Let's try and pull it from GitHub. It says first you have to configure the project, but I don't have the needed package to run autoreconf so

sudo apt-get install autoconf

Ok! So now: sudo ./autogen

Now I can run this?

./configure \
--prefix=/usr \
--sysconfdir=/etc/ddclient \
--localstatedir=/var

Yes!

Then these commands from the ReadMe:

make
make VERBOSE=1 check
sudo make install

Now I can configure sudo nano /etc/ddclient/ddclient.conf.

Then down the readme we go!

cp sample-etc_systemd.service /etc/systemd/system/ddclient.service
systemctl enable ddclient.service
systemctl start ddclient.service

Then I can sudo run the service manually to determine what is going on!

sudo ddclient -daemon=0 -debug -verbose -noquiet

Hmm, it sure is taking a while to get to https://checkip.dyndns.org/ :/

Doesn't look like it works? Not great! Let's investigate the options for the reading the data out of the router. Looks like it won't work for my router.

Instead let's look at other protocols.

We can change the config to try to use a different protocol, now:

use=web, web=ipify-ipv4 # via web

Ok, that is finding the IP properly! But it isn't setting it into the domain.

Looks like I need to delete the ALIAS record set into the domain by default in Porkbun and replace it with an A record. Then the system can use that. I can also map the IP to subdomains.

protocol=porkbun
apikey=xxxx
secretapikey=xxxx
www.my.domain
on-root-domain=yes my.domain

And hey, that brings me to my home router >.<

I can, however, access the service on the port it is running on via the domain once I've set up port forwarding for that port, so I'm getting close!

It looks like my particular Verizon router may just not allow me to open port 80. Ok, let's try to go on with setting up the task that will keep the static IP up to date for now. At some point in the future I may want to figure out an HTTPS cert as well, once I got everything mapped.

Ok, no, the setup instructions do activate the daemon on the server for ddclient and set it up to come back online when the system restarts. That's good, it should keep my Raspberry Pi connected to the domain.

I think this is a good place to stop, nifty to get this work!