OPNsense Forum

English Forums => Virtual private networks => Topic started by: praetorianer777 on October 28, 2020, 07:41:55 pm

Title: DNS Server and openVPN
Post by: praetorianer777 on October 28, 2020, 07:41:55 pm
Hey guys,

I am having some trouble with the DNS stuff...
I successfully created the openvpn server on opnsense.
I also get clients to connect to it and all traffic goes over the server.
I have access to my home network but only while using the ip adress.
IPconfig on Windows shows, that my DNS server in my home network is published to the client.
What is wrong here?
Title: Re: DNS Server and openVPN
Post by: Gauss23 on October 28, 2020, 08:49:47 pm
Hey guys,

I am having some trouble with the DNS stuff...
I successfully created the openvpn server on opnsense.
I also get clients to connect to it and all traffic goes over the server.
I have access to my home network but only while using the ip adress.
IPconfig on Windows shows, that my DNS server in my home network is published to the client.
What is wrong here?

What DNS servers are this? Maybe they block requests from outside their subnet?
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 28, 2020, 09:02:05 pm
I am using a Pihole... but I didn't find settings for this except this, which is enabled (see attachment).
Title: Re: DNS Server and openVPN
Post by: Gauss23 on October 28, 2020, 09:06:40 pm
Is the client following you "Redirect gateway" rule? Some clients ignore it or make it optional.

Do you have a firewall rule allowing VPN clients traffic to your 192.168.1.0/24 network? Are you able to ping the DNS servers from the VPN client?

Enable logging on the rules for OpenVPN and check in live view if you see the requests.
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 28, 2020, 09:17:20 pm
WHen I check my public IP with the client, it has the same as my router at home, this seems working...
A ping to my Pihole is also successful
My home network is 192.168.1.0/24 and the VPN network 10.10.0.0/24
I attached the logs, only one IPv6 packet was denied
192.168.1.26 is the IP of the opnsense server, 192.168.1.3 the pihole and 192.168.1.1 the fritzbox...
Title: Re: DNS Server and openVPN
Post by: Gauss23 on October 28, 2020, 09:38:43 pm
So the Fritzbox is the default Gateway for all your devices in 192.168.1.0/24?
From the logs it looks like your VPN client is source natted with the IP of the OPNsense. At least I can't see a request coming from your OpenVPN client. Why is that?
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 28, 2020, 09:41:43 pm
That is correct, the fritzbox is the default gateway...
and I have absolutely no idea what's the problem :(
I sticked to the official road warrior tutorial
Title: Re: DNS Server and openVPN
Post by: Gauss23 on October 28, 2020, 09:52:18 pm
Did you enable logging for the OpenVPN rule?

Do you see any traffic from the 10.10.0.0/24 network?

Please send screenshots of:
Firewall Floating rules
Firewall OpenVPN rules
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 28, 2020, 10:00:33 pm
Ok, I forgot to enable logging for the openvpn rules ...
But there are no floating firewall rules!
DNS requests are transported but not resolved at client side
Title: Re: DNS Server and openVPN
Post by: Gauss23 on October 28, 2020, 10:09:37 pm
Default route/gateway of the piHole is definitely the OPNsense?
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 28, 2020, 10:16:34 pm
The gateway for the pihole is the fritzbox (192.168.1.1), but there I added a static route (see attachment)
Ping from Pihole to client is also possible
Title: Re: DNS Server and openVPN
Post by: Gauss23 on October 28, 2020, 10:20:12 pm
On the OpenVPN client, are you able to open a command window and start nslookup?

Then change servers: 192.168.1.1 and make a query
change to 192.168.1.3 and make a query again.

And at last you could change to 1.1.1.1 and start another query.

What are the results?

I really can't see why this is not working. Your setup seems to be right.

Unfortunately you still did not send a screenshot of the OpenVPN Firewall section.
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 28, 2020, 10:23:44 pm
I forgot sry, attached the firewall section and the nslookup
-> the client also has a fritzbox
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 29, 2020, 01:11:55 pm
Hmm,

I connected my laptop over my smartphone hotspot and here it works... :<
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 29, 2020, 03:03:08 pm
I found the solution in this post: https://superuser.com/questions/966832/windows-10-dns-resolution-via-vpn-connection-not-working
You have to set the metric of the vpn network adapter to a lower value than the normal adapter! :D:D
Thanks anyway for your help Gauss23 ;)
Title: Re: DNS Server and openVPN
Post by: praetorianer777 on October 29, 2020, 03:15:33 pm
One last question, is it possible to realize name resolution from my lan to the vpn clients? When yes, how?