This .NET 8 "worker" background service monitors your public IP address for changes and updates the appropriate DNS records to allow remote access to your home/office network. It performs very basic functions similar to changeip.com, dyndns.com, easydns.com, and no-ip.com.
This service must be run inside your home/office network, not in the cloud.
Since .NET 8 supports a number of operating systems, this app can be run almost anywhere. In our test case we are running this service on a Raspberry PI 4 (4GB) using the Rasberry PI OS Lite (Bullseye). The service ensures that anytime our public IP address changes, our DNS records are automatically updated so that we can always access various services on our network from anywhere in the world.
- IpifyPublicIpProvider - No authentication required and is free.
- HyprsoftPublicIpProvider - Requires an API key and secret.
- HyprsoftDnsProvider - No authentication required and can be used for testing. This provider returns random IP addresses.
- GoDaddyDnsProvider - Requires a GoDaddy API key and secret.
The 'appsettings.json' file is required and here is a sample. This file COULD contain sensitive/secret information. Protect it accordingly!
{
"MonitorSettings": {
"Domains": [ "www.hyprsoft.com" ],
"DnsProviderApiCredentials": {
"ProviderKey": "HyprsoftDnsProvider",
"ApiKey": null,
"ApiSecret": null
},
"PublicIpProviderApiCredentials": {
"ProviderKey": "IpifyPublicIpProvider",
"ApiKey": null,
"ApiSecret": null
},
"CheckIntervalMinutes": 10
}
}
See our Docker Hub for more details. Make sure to adjust your host volume mapping file path for the 'appsettings.json' file.
docker run -it -d --name dnsmonitor --restart always -v C:\Docker\dnsmonitor\appsettings.json:/app/appsettings.json hyprsoft/hyprsoft.dns.monitor:1.3.2-linux-amd64
docker run -it -d --name dnsmonitor --restart always -v /home/pi/dnsmonitor/appsettings.json:/app/appsettings.json hyprsoft/hyprsoft.dns.monitor:1.3.2-linux-arm64
Create a dnsmonitor.service file using:
sudo nano /etc/systemd/system/dnsmonitor.service
This assumes the service binaries have been copied to the '/usr/bin/dnsmonitor' directory.
[Unit]
Description=Hyprsoft Dns Monitor
After=network.target
Require=network.target
[Service]
ExecStart=/usr/bin/dnsmonitor/Hyprsoft.Dns.Monitor
WorkingDirectory=/usr/bin/dnsmonitor/
[Install]
WantedBy=multi-user.target
Start the DNS monitor service:
sudo systemctl enable dnsmonitor.service
sudo systemctl daemon-reload
sudo systemctl start dnsmonitor.service
Troubleshooting
sudo systemctl status dnsmonitor.service
sudo nano /usr/bin/dnsmonitor/app-log.log
schtasks /create /tn "Hyprsoft DNS Monitor" /tr c:\hyprsoft\dnsmonitor\Hyprsoft.Dns.Monitor.exe /sc onstart /ru System
See scheduled tasks for more information.
The architecture allows contributors to easily add additional public IP address and DNS providers by simply deriving from PublicIpProvider or DnsProvider and implementing the GetPublicIPAddressAsync() method or the GetDnsIPAddressAsync() and SetDnsIPAddressAsync() methods.