Using DDNS to Achieve Remote Access to Devices on an Internal Network
Using DDNS and Port Forwarding to achieve remote access to devices on an internal network
Introduction
- Recently, I got into an AI drawing software called
stable-diffusion-webui
. Due to its heavy reliance onGPU
, I could only use my home computer for this purpose (which has a 6-year-old GTX 1060😥). However, as I work remotely, I decided to explore the realm of Dynamic Domain Name System (DDNS) to achieve remote control of my home computer and other network devices.
This tutorial (memo) serves two purposes: to showcase achievements and to provide guidance for others with similar needs. Many tutorials I found didn't explain DDNS clearly or how to use it.
DDNS (Dynamic Domain Name System) is a service that maps the dynamic IPv4 address of a home network to a fixed domain name resolution service.
Cloudflare is a globally renowned DNS service provider.
DDNS-GO is an excellent DDNS resolution service tool. Many thanks to the author for solving my crucial problem.
Public IP - I must say, the service level of the telecom company is impressive. They provided me with a public
IP
within half a day. Although there are many ways to bypass the publicIP
for accessing the internal network, through my testing, using more advanced methods like remote connection services and tunneling tools, the most straightforward method still offers the best cost-effectiveness and user experience.
Getting Started
Before we begin, let me briefly explain my home network layout. There is a weak current box with a fiber optic modem in bridge mode, a main router responsible for dialing, a
K2P
router in the bedroom inAP
mode, an old laptop acting as a secondary router (secondary route), which is installed withPVE
,PVE
usesopenWRT
, and a desktop computer. I forgot to draw it onvisio
.Don't ask me why I don't use
DHCP
onopenWRT
. I tried many times but couldn't connect to the internet. It might be because the network port is bound to theMAC
address. I don't know how to unbind it. So, I can only bind theMAC
of my computer on the main router to connect to the internet. (Maybe it's not the reason; even binding theWAN
port address onopenWRT
doesn't allow me to connect to the internet.) My home network environment is really too complicated😥
Let's Begin
- Download
DDNS-GO
to your local machine and unzip it. Then, use administrator privileges to navigate to the root directory.
Installation
.\ddns-go.exe -s install
Uninstall
.\ddns-go.exe -s uninstall
After installation, you can see the
ddns-go
service in the services, and set it to start automatically.Open
http://127.0.0.1:9876
, you can see thatddns-go
supports many dynamic resolution service providers as shown below.Go to
cloudflare
and get theAPI
token, which is theToken
in the image below. Pay attention to selecting all regions for zone resources.Return to
DDNS-GO
as shown in the image below. Configure it as shown below. If you have a public network, only selectIPv4
. If you don't have a public network, selectIPv6
(I have both, so I selected both; you can do the same without any issues). Enter your domain name after the hostname. For information on how to obtainIPv6
, I'll do a detailed tutorial next time. (I recommend a handy CF domestic API that can accurately obtain your localIP
address, regardless of whether you use a scientific Internet access tool).After clicking saveOnce saved successfully, you will see the A record (IPv4 address) or AAAA record (IPv6 address) that you have resolved on Cloudflare in your domain's DNS service, and you can also see the successful resolution prompt in
ddns-go
.At this point, you have finally successfully resolved your dynamic IP. Set up port forwarding services on the main router and secondary router, and you can access your home devices anytime, anywhere.