Connect a local Cloudflare tunnel to you network in a few easy steps.
Setup your own domain name (e.g. that-is-a.win
) to use the Clodflare nameservers, if you do aready not have one, you can get cheap domains from Porkbun.
Add your domain to Cloudflare and update the nameservers to the ones you received from Cloudflare.
Download and extract cloudflared
from Cloudflare.
To connect a tunnel routing the default set of services (see here):
& .\cloudflared\connect-tunnel.ps1 -CloudflaredPath 'C:\path\to\cloudflared.exe' -HostName 'that-is-a.win'
To route other services, provide your own services using the -DefaultServices
parameter:
& .\cloudflared\connect-tunnel.ps1 -CloudflaredPath 'C:\path\to\cloudflared.exe' -HostName 'that-is-a.win' -Service 'http://192.168.2.100:8080' -DefaultServices @(
@{
domain = 'www'
service = 'http://192.168.2.100:8080'
}
@{
domain = 'router'
service = 'http://192.168.2.1'
}
)
Or include additional services (in addition to the default services) using the -AdditionalServices
parameter:
& .\cloudflared\connect-tunnel.ps1 -CloudflaredPath 'C:\path\to\cloudflared.exe' -HostName 'that-is-a.win' -Service 'http://192.168.1.100:8080' -AdditionalServices @(
@{
domain = 'something'
service = 'http://192.168.1.254'
}
)
If using this with Home Assistant you need to do one more thing. Since Home Assistant blocks requests from unknown proxies/reverse proxies, you need to tell your instance to trust your local network by adding something like this to your configuration.yaml
:
http:
use_x_forwarded_for: true
trusted_proxies:
- 192.168.1.0/24