You sure can. You can see someone doing just that here successfully:
Comment on [question] Help me access my local homeserver using a public domain name
Mitchie151@lemmy.world 16 hours ago
You can’t point to 192.168.X.X that’s your local network IP address. You need to point to your public IP address which you can find by just searching ‘what is my IP’. Note that you can’t be behind CGNAT for this, and either need a static IP or dynamic DNS configuration. Be aware of the risks involved exposing your home server to the internet in this manner.
TheHobbyist@lemmy.zip 14 hours ago
Mitchie151@lemmy.world 9 hours ago
Okay sure, for a specific use case yes you can point a record to a private IP, however this explicitly doesn’t expose your homelab to the web as OP is trying to achieve.
slazer2au@lemmy.world 15 hours ago
That’s not true at all. That is exactly how I have my setup. A wildcard record at Porkbun pointing to the private IP of my home server so when I am home I have zero issues accessing things.
HelloRoot@lemy.lol 15 hours ago
Which can not be 192.168.X.X
read: en.wikipedia.org/wiki/IP_address#Private_addresse…
slazer2au@lemmy.world 15 hours ago
And yet, that is exactly what I am doing and it is working.
Rfc1918 address are absolutely usable with DNS in this fashion.
If I were to try to access it while I wasn’t home it absolutely wouldn’t work but that is not what I do.
HelloRoot@lemy.lol 15 hours ago
Then you don’t need to pay porkbun and can just selfhost a DNS with that entry like technitium.com/dns/