Access Home Assistant Remotely with DuckDNS: Complete Setup Guide

Access Home Assistant Remotely with DuckDNS: Complete Setup Guide

Back to Blog
Remote access to Home Assistant with a DuckDNS domain

If your ISP changes your public IP, the address you use to reach Home Assistant from outside stops working. DuckDNS fixes that with a free name such as yourhome.duckdns.org that always points to your current IP, and the official add-on updates it for you. This guide covers the setup for Home Assistant OS or Supervised, how to check it works, the security basics and what to do if your ISP uses CGNAT.

What you need

  • Home Assistant OS or Supervised, which are the installs that include the add-on store. On Container or Core there is no add-on store: use a DDNS script instead, such as the bash script for Cloudflare, or the options in the free vs paid DDNS comparison.
  • A router where you can forward a port to the Home Assistant machine, which should have a fixed local IP (a DHCP reservation works).
  • A free DuckDNS account.
  • A real public IP. If the WAN address shown by your router differs from the one a “what is my IP” website reports, you are behind CGNAT: read what CGNAT is and how to know if you have it first.

Steps

  1. Create the domain. Sign in at duckdns.org with one of the accounts it offers, type the subdomain you want (for example yourhome) and press “add domain”. Copy the token shown at the top of the page and keep it private: whoever has it can change your domain.
  2. Install the add-on. In Home Assistant open Settings → Add-ons → Add-on store, search for “Duck DNS” and install it. Menu names change between versions, so look for the equivalent entry if yours differs.
  3. Configure it. In the add-on's Configuration tab use this structure, with your own token and domain:
    domains:
      - yourhome.duckdns.org
    token: your-duckdns-token
    aliases: []
    lets_encrypt:
      accept_terms: true
      certfile: fullchain.pem
      keyfile: privkey.pem
    seconds: 300
    The domains field is a list and accept_terms must be true for the add-on to request the Let's Encrypt certificate. seconds is how often it updates your IP.
  4. Start it and read the log. Press Start and check the Log tab: it should report that your IP was updated and that the certificate was issued. If you also want it to start with Home Assistant, enable “Start on boot”.
  5. Tell Home Assistant to use the certificate. In configuration.yaml add:
    http:
      ssl_certificate: /ssl/fullchain.pem
      ssl_key: /ssl/privkey.pem
    Restart Home Assistant afterwards.
  6. Forward the port on the router. The simplest option is to forward external port 443 to port 8123 of the Home Assistant machine, so you can use https://yourhome.duckdns.org without typing a port. If you forward 8123 directly, you will have to type :8123. The details are in opening ports with a dynamic IP and in the Home Assistant port (8123).

Check that it works

  1. Run nslookup yourhome.duckdns.org from a terminal and check it returns your current public IP.
  2. Turn off wifi on your phone and open https://yourhome.duckdns.org over mobile data. Testing from inside your own network may fail even when everything is right, because some routers do not send traffic back to their own public IP.
  3. The browser should show a valid padlock. If it warns about the certificate, the add-on has not issued it yet or Home Assistant is not using it: review steps 3 to 5.

Basic security

Opening a port exposes Home Assistant to the internet, so use a long password, enable two-factor authentication on your user, keep Home Assistant updated and do not expose other ports you do not need. If you prefer not to open any port, a tunnel is an alternative: see remote access without opening ports with a Cloudflare tunnel. And if you would rather use your own domain than a DuckDNS one, Home Assistant remote access with Cloudflare explains that route.

Frequently asked questions

Is DuckDNS free?

Yes, the DuckDNS service is free. If you want your own domain name instead of a duckdns.org one, you would use a domain you control with a client such as SyncMyIP for Cloudflare.

What happens when my IP changes?

The add-on checks your IP every few minutes (the seconds value) and updates DuckDNS. Until it does, the name still points to your previous IP, so there can be a short gap.

Do I need to open port 80 for the certificate?

The add-on gets the certificate through DuckDNS' DNS, so it does not need an inbound port 80 for that. You only need the port you use to reach Home Assistant.

Why can I not open it from inside my house with the domain?

Some routers do not support “loopback” and drop traffic that goes out and comes back to their own public IP. Use the local address at home, or set up a local DNS record for the domain.

Is it safe to leave Home Assistant on the internet?

It is reasonable if you use HTTPS, strong credentials, two-factor authentication and updates. If you want less exposure, use a tunnel or a VPN instead of opening the port.