I’ve been thinking about finally getting myself a proper domain for my server, but a friend told me that to get one I either need a VPS with a public ip (which just takes all the fun out of selfhosting) or purchase a static ip, which is beyond what I’m willing to spend for a hobby. Do I have any good options or should I just let it go?

Also, if this isn’t the correct community for this, I’d appreciate being pointed to the right one, thank you

Update: after reading the comments the two main options I’m considering now are either a cheap VPS to use as proxy for my network via wireguard, or DynamicDNS. I’ll see if I can figure out the rest from here, thank you!

  • tburkhol@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    If you only need it to be accessible inside your home, then you just need to run your own DNS. Have your dhcp point at your DNS and your DNS declare itself the master for your domain.

    To get full functionality, you’ll probably want to have your registrar point to the public IP you get from your ISP as the domain’s authoritative name server.You should be able to script it to update the registrar when your ISP changes your IP, but that usually happens infrequently enough to do manually. Obviously can’t do that if you’re behind CGNAT.

    To get Lets Encrypt certificates, you can do the DNS challenge. If your ISP gives you a (even inconsistent) public IP, you can do fancy ‘views’ with your selfhosted DNS, where it responds with private IPs inside your network and your ISP-given IP outside your network. I have certbot set up to expose my DNS & web server just before it starts its renewal process, then close the firewall after. Once you have the certificate, you can move it to where ever it will actually be used.

  • Ada@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    Our setup uses a domain pointed at a dynamic (but stable) IP with a script to update it periodically

  • marud@piefed.marud.fr
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    If you already have a domain name and don’t want to switch to something else, know that some DNS registrar have an API to handle the domains. For a short period of time I had to rely on this and had a little python script to get my current IP and apply it to every A record in my DNS zone.
    It worked well (but then I took an arrow in the knee had static IP)

  • entheo@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    I believe cloudflare has some sort of tunneling option but I’ve never really looked into it, it might get around that.

    • Dave@lemmy.nz
      link
      fedilink
      English
      arrow-up
      0
      ·
      5 months ago

      It does, yeah. If you aren’t averse to cloudflare then it’s a great option.

      From memory I think it’s limited to http/https traffic, but that’s normally not an issue, just have all your services behind a reverse proxy.

  • nikki@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    i have a little program for dynamic dns running in docker that checks every few seconds for an IP change and swaps my DNS records if it gets rerolled.

    works well on my home network, I can use my domain for all my private services local and remote through wireguard :)

  • Svinhufvud@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    It is very much possible to have a dynamic IP and a usable domain.

    Both Cloudflare and desec.io (for example) have APIs that you can hit everytime your public IP changes.

    I have a script that checks every minute whether my public IP has changed from the last check, and if it has, an API call will be sent.

    With a scheme like this, your downtime will be minimal, if ever even noticed.

  • UnpledgedCatnapTipper@piefed.blahaj.zone
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    I run a variety of self hosted things via my domain on a dynamic IP. I just have dynamic dns set up to check my current public IP periodically, and update the dns entry if it changes.

  • Brickfrog@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    but a friend told me that to get one I either need a VPS with a public ip (which just takes all the fun out of selfhosting) or purchase a static ip

    Neither of those are requirements. Just buy a domain at a registrar that allows you to dynamically update an IP address with a domain you have there. Look into DDNS update scripts and/or your own internet router, many routers have that feature built-in already.

  • Encrypt-Keeper@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    What are you asking? You can just buy a domain whenever you want. You can use it on your server without a VPS or static IP.

    Are you asking us how to make your services reachable at that domain publicly over the internet?

  • TrippinMallard@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    You can use Netbird Cloud’s reverseproxy to point your domain to a device on your wireguard mesh.

    That way your home server can be under 3x NATs and dynamic IP and you’ll still be fine.

    Later if you want to own the netbird you can self host it on a VPS if you’re willing to migrate all devices to your self hosted wireguard mesh.

  • grue@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    I have a domain, but all I use it for so far is email (with an email provider, not my own mail server, hosted locally or otherwise). I’d still call that “usable,” though.

  • mic_check_one_two@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    What you’re looking for is called Dynamic DNS. I use Cloudflare for my DNS (which feels a little like making a deal with the devil) and Cloudflare-DDNS to automatically update my DNS records when my WAN IP changes. Basically, the container checks the current WAN IP, checks the current Cloudflare DNS records, and pushes a change if they don’t match. It runs every few minutes, and then rests again until the next check. I’m sure other DNS providers have similar ways to set up DDNS.

    It’s not a 100% foolproof thing, because your WAN IP changing will take a few minutes to update. But a few minutes of downtime is much better IMO, when the alternative is needing to manually VPN into my server (if the VPN even still works, since the WAN IP changed), and troubleshoot it every time the IP address changes.

    • Joelk111@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      5 months ago

      You can configure it to run as often as you want (well, I’m not sure about cloudflare, but with other services you can, like DuckDNS)