Home assistant is a very versatile home automation solution. However, as it is a system generally hosted within your own network if you want to access on your phone or laptop while out of the house you’ll need to setup a dynamic DNS service.
Also, some smart home devices only work locally within your network. If you can link these devices to Home Assistant then you can control these devices while outside of your network.
Home assistant has a native integration with Duck DNS. The following guide will teach you how to enable external access to your home assistant setup using Duck DNS. Don’t let the name put you off, its a great free service!
- Create a DuckDNS account.
Go to https://duckdns.org and create an account.
2. Create a domain within DuckDNS
Complete the box as shown above with an appropriate name. You may need to be slightly creative as the domain name must not already be in use by another user. I would also keep this generic as to not give away the purpose you are using it for – don’t call it homeassistant256 for example.
Keep the Duck DNS page open as some of the information will be required in a later step.
3. Install the DuckDNS Addon in Home Assistant
Go to Settings > Addons > Addon Store
Search Duck and Click the DuckDNS Addon
4. Configure the DuckDNS Addon
Select the ‘Configuration’ tab from the Duck DNS Installation screen. Click the 3 dots near the top right to edit in yaml.
Copy the token from your Duck DNS Account page and paste next to ‘Token:’ copy the code below and update with your DuckDNS Domain name and Token ID
domains: - yourdomain.duckdns.org token: yourtokenid aliases:  lets_encrypt: accept_terms: true algo: secp384r1 certfile: fullchain.pem keyfile: privkey.pem seconds: 300
4. Add Entries to Config.yaml
Open config.yaml and add the below code.
You may already have an entry for name and internal_url. The internal_url is simply the internal IP for your Home Assistant instance.
homeassistant: name: HomeAssistant external_url: "https://yourduckdnsdomain.duckdns.org:8123" internal_url: "http://your.home.assisatnt.ip:8123" http: server_port: 8123 ssl_certificate: /ssl/fullchain.pem ssl_key: /ssl/privkey.pem ip_ban_enabled: True login_attempts_threshold: 3
The ‘ip_ban_enabled’ & ‘login_attempts-threshold’ is advised to help prevent fraudulent access attempts (it is optional). Don’t forget, DUCK DNS is essentially presenting your Home Assistant installation publicly to the internet.
5. Assign a Static IP to Home Assistant
Please see our guide for this. It is strongly recommended you do this not just for DuckDNS but for other functions of Home Assistant. If you do not assign a static IP, the IP could change causing your configuration to break.
6. Create a Port Forwarding Rule within Your Routers Settings
Log into your routers LAN settings
In the TP Link router used in the example the setting is called ‘virtual servers’ However, often other brands of routers refer to this process as port forwarding.
Find this setting and add an entry for port 8123 to the (static) IP address Home Assistance is using (reference as ‘Internal IP’ in the above image).
Home Assistant operates on port 8123 and so we want to allow all internet traffic hitting our router on that port to be send to the home assistance installation.
You can now access your installation of Home Assistant from outside your network (house). This will also work for the Home Assistant App running on mobile data connections on your smart phone.