External access for Hassio behind CG-NAT?

Sure.

  1. Create a VPS in DigitalOcean (or anywhere else you want).

  2. Create an account at ZeroTier and create a new network. https://www.zerotier.com/

  3. Install their software in your VPS (there are instructions in the download page) https://www.zerotier.com/download.shtml

  4. Join your VPS to the newly created network at zerotier.

  5. Install this Hassio addon: https://github.com/TomCzHen/hassio-addons-repository

  6. Configure it with your network info.

At this point your VPS should be able to ping your Rpi. (You can see the assigned IP in the zerotier admin page).

If that’s the case:

  1. Install NGINX
  2. Configure it as reverse proxy.

The config looks more or less like this:

server {

    server_name yourdomain.com;
    listen 80;
    listen 443 ssl;

    location / {
            proxy_pass         http://YOURZEROTIERIPADDRESS:8123;
            proxy_buffers           32 4m;
            proxy_busy_buffers_size     25m;
            proxy_buffer_size 512k;
            proxy_ignore_headers "Cache-Control" "Expires";
            proxy_max_temp_file_size 0;
            client_max_body_size        1024m;
            client_body_buffer_size     4m;
            proxy_connect_timeout 300;
            proxy_read_timeout 300;
            proxy_send_timeout 300;
            proxy_intercept_errors off;

            # WebSocket support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    }
}

Now accessing the IP address of your VPS (not the IP granted by zerotier) you should reach your hassio installation.

2 Likes