OPNsense Forum

English Forums => Virtual private networks => Topic started by: RaymondFFX on April 21, 2025, 11:05:11 PM

Title: Installing and configuring Tailscale for selfhosted services (Split DNS)
Post by: RaymondFFX on April 21, 2025, 11:05:11 PM
I spent quite a bit of time getting this to work so I figured I would share it here in case others have also struggled with this.

I have an OPNsense install working as my main firewall/router. In my home network I have a bunch of self hosted services. They are all accessed through a public domain name so I can use Lets Encrypt for TLS certificates. Some of them though, I want to only be accessible through Tailscale. This is where the problem comes in.

If you use a public domain name and are not at home, the traffic will, by default, be routed through your public IP-address. The reverse proxy or service will think it is just a random outside IP and drop the connection. To access the services through Tailscale, you need to set-up split DNS.

I'm going to list the steps I took. I can't think of a reason this wouldn't work with the old tailscale ports install but I did it with the new Tailscale plug-in so I will list those steps too.

Optional - if Tailscale was already installed

Installing and configuring Tailscale

The OPNsense part should now be done.
Now for the Tailscale portion
The OPNsense machine should now be visible in the Tailscale admin dashboard



You should now be able to access your hosted services through Tailscale.
Whether you are connected to Tailscale or not, have enabled the Exit Node or not.

As far as the webserver or proxy is concerned, the traffic is originating from the OPNsense IP so you can base access restrictions around that. In the firewall logs DNS requests are shown correctly with the Tailscale IP of the requester. Routing of traffic itself I believe is handled by Tailscale internally and only shows up as outgoing traffic from the firewall IP to the service on the interface the service is connected to.

Hope this helps anyone running into this problem in the future! :)
Title: Re: Installing and configuring Tailscale for selfhosted services (Split DNS)
Post by: hoer.live on June 01, 2025, 07:41:47 PM
Thanks Raymond,

that was really helpful. I've successfully managed to get it to work except the combination of internal (split) DNS (active directory domain DNS servers here) and running OPNSense as an exit node.
I have the following setup:

I have the following findings (using Windows clients, connected over mobile hotspot):

In both cases, nslookup uses by default the magicdns server (100.100.100.100). Without an active exit node, DNS resolves internal names correctly, with an active exit node it does not. If i do "nslookup - <internaldns-server>" internal names do resolve correctly, even with an active exit node - so it is definitely not a firewall issue (internal DNS servers are reachable from the tailnet)...

It seems more like enabling the exit node on the (Windows) client breaks (split) DNS resolving... 
I suspect, I am missing some small bit - I've been chasing this for a few days now without success. 
Any hints would be highly appreciated!

Thanks!