-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unbound does not allow access WireGuard interface despite told to #4142
Comments
You could set LAN IP as server address for the clients? |
You mean setting a LAN IP as DNS server for VPN clients? Yes, the VPN clients can ping hosts in LAN without issue, just of course the reverse DNS lookup does not work in LAN. |
An other option is to bind to a loopback interface and forward the traffic to the service at hand, which detaches the network layer from the service and ensures a more stable setup. I think most of the larger vendors advise this pattern with internal services, to avoid interface dependencies in services. |
Absolutely please do not make DNS depend on VPN :) I can live without VPN but not without DNS. |
not sure what you mean by that comment, but I'm not suggesting to add dependencies, just to remove them. |
Ah sorry for sounded confusing. I am not a native English speaker and I was expressing agreement with your comment :) Would you please be more specific in the suggestion so I can follow it to help testing? Sorry I am not very good at networking :) |
No problem, small miscommunication, I'm not a native speaker either :) The steps I suggest would look a bit like this (haven't tested this out for unbound, but works for other services so should function here too)
Should do the trick, prevents all sorts of strange race conditions when the interface is not yet configured. |
Thank you so much for your detailed instruction! However I must have missed something that I could not make it work. So here is what I have done
I also tried to set the NAT rule on other interfaces including WG (the one I manually assigned for wireguard) but they didn't work either. Would you please help me check if I missed any steps? Thanks :) |
at a first glance it looks good, you can try to capture some traffic on your new interface and the wireguard one to see if it actually matches anything. |
So I used my very limited knowledge to try the following debug. I noticed that if I configure unbound not to run either LO or WG, all DNS request on wg0 53 port went unanswered (without surprise):
But if I enable unbound on LO only, not on WG, the client's request actually got "Refused"
Howver, listening on LO (lo1) has no traffic at all it appears:
I am confused what to do next... it seems the NAT is working as now the DNS request can reach LO but for some reason I could not capture the traffic in tcpdump. But still, unbound refused the request despite it allowed LO in both the web UI and check on access_lists.conf |
the refused suggests a missing policy in unbound. can you try to use another address? if I'm using 127.0.0.0/8 it seems to be captured on lo0 on my end (same netblock). |
Thanks for your suggestion. I tried another loopback with 127.0.1.1/8 (does mask matter?) and still refused and no traffic captured. Actually, I wonder why I cannot forward the port to my LAN address, since my LAN is always up before unbound anyway? I tried this and still got refused, plus, capturing on LAN (igb1) does not yield dns request from my vpn client. I came upon a post that seems to suggest that redirected traffic, if on same machine, is handled directly by OS therefore not actually reaching the target interface. If this is true it might explain why I could not capture the traffic on LO. Sorry if I was too stupid on testing this :) |
127.0.1.1/8 is also in the same range, try something like |
Ah sorry I didn't realize you were suggesting an IP out of the range.
|
not totally what I expected, haven't captured traffic on these lo interfaces lately, but the refused response still points to unbound. I can't help you further at the moment, sorry. |
You already helped me so much, thank you all the same :) |
Unbound binds to addresses, not interfaces. Dynamic interfaces pose an issue then, because you would need to stop and start unbound dynamically, which causes cache loss and general dns resolution disruption. The bind interface feature is a popular request but people often forget that this has side effects that have these annoying operational effects / implementation quirks. In this particular case I assume Unbound simply forgets to load the correct address or is not notified of it. Best to use a manual ACL with listen on any IMO. |
Thanks fichtner, yes adding ACL works perfectly. Before this issue is resolved eventually (if it ever be), could we maybe add some suggestions on the documentation regarding WireGuard over this issue so maybe it can help other users to avoid some hassle :) Thanks! |
Any chance we could get the variables of the ACL you added, like internal/external, action (allow I assume) and especially "network" was it 127.0.0.252, what did you put in there, the tunnel address? |
Just to chime in since I ran into this exact same issue. The 'best' work around for me was to manually add the WireGuard network (i.e. 10.0.0.0/24 which is used by the configured WireGuard 'peers') to the UnBound ACL. @Brainfrazzle This is the UnBound ACL config that I used: |
@QNimbus suggestion worked for me. Was not getting dns responds for all my wireguard clients. The moment I added the range to the access list, it worked. |
This issue has been automatically timed-out (after 180 days of inactivity). For more information about the policies for this repository, If someone wants to step up and work on this issue, |
Thank you very much @QNimbus! This solved my issue. |
Thx, guys - also encountered this problem. Solution with the ACL in Unbound solved the problem also for me. |
Any news on this? I just tried it without the manual ACL and the issue is still present. |
Agree that WireGuard net should be automatically added to the Unbound ACL. Took me a bit to figure this out. |
Is this manual ACL still necessary in order to get the DNS working in a RoadWarrior configuration? I just disabled the old ACL in Unbound and DNS seems to keep working for wireguard clients. |
ACL defaults have been switched to 0.0.0.0/0 a while back. If you need fine grained ACL you’d have to manage those according to your networks attached manually and delete the wildcard, but for most purposes that is overkill. |
Describe the bug
After setting up WireGuard VPN and specify the OPNsense unbound as the DNS server, I noticed that VPN clients cannot resolve DNS names. However if I restart the unbound after the system boots up manually, everything resumes working.
Here is a brief diagram of my interfaces set up.
LAN clients are not affected by this bug.
Firewall log indicated the DNS request successfully made it to the unbound port. The WireGuard interface has already been assigned to interface "WG" (so I have a WG under "interface" and a "WireGuard" and "WG" under firewall rules).
Changing "Services->Unbound DNS->General->Network Interfaces" from "all" to manually picking "LAN WAN WG" does not resolve the bug. Checking access list conf file suggests that the WG interface (whose "address" is 10.252.0.1) is not allowed immediately after the system starts up, but somehow appears after a manual restart of unboud itself.
The Web GUI however successfully lists the WG address as being allowed in "Services->Unbound DNS->General->Allowed list" despite the address is not in the conf file.
Could this be because unbound started "too early" than WG, that it cannot see the interface? I also noticed that my WAN for some reason often has ipv6 address bound very late, potentially 1 or 2 minutes after the system starts. And checking the access list of unbound suggests that the WAN ipv6 address is not in the list neither if it is not bound during the system start up, only appears after a manual unbound restart.
Steps to reproduce the behavior:
Relevant log files
/var/unbound/access_lists.conf
Immediate after boot:
After a manual restart of unbound, notice the last line which is the WG interface. Also the second IPv6 address was on WAN port, which may suffer from the same issue as the WG interface.
ifconfig:
Additional context
This appears to be similar to this issue: #3342, but the difference is that in my case the WG interface is not even showing up in the
/var/unbound/access_lists.conf
file until unbound being restarted.Environment
OPNsense 20.1.7-amd64
Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (4 cores)
Network Intel® I210-AT
The text was updated successfully, but these errors were encountered: