How to put my Hassio on my own domain?

Hi,

I have a domain and would like Hassio to load on a sub domain but it’s not working, below is what I have done:

  • Looked up IP on my home pc from www.whatismyip.com (ha is running on a virtual server on home windows 10 pc)
  • In the Cpanel of my host I created a sub domain and set it to redirect back to above ip
  • Set the base URL in configuration.yaml
  • I have port forwarding 8123-8123 set

I can access hassio on its allocated IP internally.

If I browse http://mysubdomain.myurl:8123 no luck…

What am I doing wrong?

I’m just keeping it simple without SSL at this stage.

Thanks

1 Like

I’d like to know how this works too.
And how to add the ssl on the next step.

I do this, but the requirements are a little more than just setting up a domain name.

Firstly, you need to be running your own DNS server, or your router/modem that is doing DNS needs to be capable of routing internal traffic back into the LAN when it detects local traffic trying to connect to the external IP address of the local network.

The router I have isn’t quite smart enough for that, so I do things slightly differently.

I have my network update a free no-ip address. This network name never changes, but the IP is dynamic, so this is the first requirement.

On my personal domain I create a subdomain that I call my “home domain.” Then in this subdomain I have a CNAME record that points to my no-ip address. This means that I can use my personal domain hostname to connect to my home network from anywhere on the internet. It allows for a few other benefits but that’s outside the scope.

So cname.sub.domain,com points to hostname.no-ip,com

(A little secret, you can make the CNAME be “cname.sub” to save you setting up a new subdomain on your external domain. Also, yes, I am aware of the commas. New user. Apparently I can’t post links to domains yet)

That’s great for outside your network, but unless your router is as described above, your local devices on the inside of your network won’t work.

To resolve this, you need to run a local DNS server that becomes the primary DNS for your local network. I haven’t done this with a Pi-Hole.

Essentially, you need to create a local DNS server that is going to be authorative to your local network for your subdomain. I set it up to be authorative for my sub.domain,com and forward for everything else.

You then need to adjust your DHCP settings in your router (or whatever device is doing DHCP) to make this new DNS server the primary DNS server for devices on your network. Make the previously configured DNS server the secondary in your DHCP settings. This is often the router itself.

Then, once I have that working, I create A (ipv4) and AAAA (ipv6) records for that CNAME hostname that points to the internal IP address of my Home Assistant setup.

So from inside you’d see cname.sub.domain,com point to your local network IP address of your HA.
From the outside, you’d see cname.sub.domain,com point to the external IP address determined by (in my case) no-ip,com.

Insert the usual port forwarding rules as you are already aware of them.

If you’re running on something a bit stronger than a Raspberry Pi, I recommend setting your DNS up as a Docker container. That makes security upgrades and the rest a lot easier. I am old fashioned and still use bind9 myself, but there are a lot of choices when it comes to DNS servers. I’m sure others can recommend something they might prefer.

I know this is a massive wall of text, so if you’d like me to elaborate on or clarify anything, just let me know.

2 Likes

Thank you for your detailed response and explanation of your setup, greatly appreciated.

I am now succefully using duckdns but interestingly have come accross the issue of local traffic having to go outside the local network to resolve the ip, a little annoying. I am getting around that by simply allowing an exception in my browser, not ideal but it works.

So to make hassio appear on a domain name at say here.there.com, its a CNAME record change at the domain name registrar thats needed? Rather than a redirect at the domain name host, is that correct?

So to make hassio appear on a domain name at say here.there.com, its a CNAME record change at the domain name registrar thats needed? Rather than a redirect at the domain name host, is that correct?

Yes. A CNAME says that the IP address of here.there,com is defined by by your DuckDNS hostname. That way you can update the DuckDNS hostname’s IP address without having to also update your domain’s settings at your registrar every time as well.

As an alternative work around, if you don’t want to setup a local DNS server, you could update the hosts file of all the devices that stay in your local LAN so they can get the local IP address of HA. But doing it in the hosts file means they won’t be able to work outside the LAN.