DNS queries only work on the same interface IP, not on others #2845
Replies: 2 comments 3 replies
-
Just to be clear. Assuming devices:
You say, servers on A:
AFAIK, normally networks on different interfaces of the same device are isolated. Case 2 is unusual to me. Test other servers written in Go and other languages, to see if they work well. We may get more clues. |
Beta Was this translation helpful? Give feedback.
-
I got a tip from a fellow OpnSense expert: This is probably a problem in the code.... When you access 192.168.10.2 from 192.168.7.3 and have a binding only on 0.0.0.0, then dnscrypt-proxy answers with a source ip of the interface address that it originally received the request from, which in this case is 192.168.7.1. The client then dismisses the response, because it expects it from 192.168.10.2, whom it originally asked. This is different with explicit IP bindings, because then the correct sender address can be chosen. BIND and other servers do this explicitely. Caddy will probably do it correctly, just because the requests were done via TCP and other than with UDP, you have a session with explicit source and destination IPs, there. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I observed the following behavior on my OpnSense router:
I use a "listen_addresses = ['[::]:53']" directive (the same is true for '0.0.0.0:53', I assume the service to listen on all interfaces and all addresses.
The router has two interfaces, say "ix0_vlan10" with 192.168.10.2/24 and "ix0_vlan7" with 192.168.7.1/24 as their interface IP.
When I do a DNS query from a client machine on "ix0_vlan10" by calling "nslookup www.ibm.com 192.168.10.2", it will get answered (as expected).
When I do a query from the same client as "nslookup www.ibm.com 192.168.7.1", the request times out.
I can try the same two DNS requests from a client on interface "ix0_vlan7", and this time the request to 192.168.7.1 will get answered, while the one to 192.168.10.2 will not.
Obviously, on the router itself, both requests get answered immediately.
Mind you: there are no interfering firewall rules in place, of that I am sure!
It seems that dnscrypt-proxy answers only on the interface subnet of the target IP. There is a trick to circumvent this: When I use listen_address = [ '192.168.10.2:53','192.168.7.1:53'], the queries work from both interfaces, regardless of the target.
This behavior is most unwelcome - the potential remedy is problematic, because you have to list all interface addresses explicitely, since a "bind all" to 0.0.0.0 or [::] does not work as one could expect.
Maybe this effect is limited to FreeBSD, where every assigned IP for an interface has a route to lo0 - when you use netstat -nr, you will see something like:
Beta Was this translation helpful? Give feedback.
All reactions