Hi, I have two basic requirements in my home-lab:
1. conditional forwarding of DNS requests to different servers, depending on client IP
2. firewall rule with whitelist of IPs, whose domains were resolved by my DNS server
Specific clients should be forwarded to different DNS servers, e.g. the one from VPN (might also be called source IP-based forwarding of DNS requests).
The firewall rule is usually done via ipsets/nftsets (I've read the implementation on FreeBSD are pf tables).
Some thoughts on possible solutions:
- Unbound can act as recursive resolver, but neither supports ipset nor source-based IP forwarding
- dnsmasq supports ipset, but no source-based IP routing; also only DNS forwarder
- BIND to my knowledge supports conditional forwarding of source IPs via views, but no ipset support; also only plugin and not part of core OPNsense
So, what I am doing now is using dnsmasq together with Unbound:
Client -> dnsmasq (forwarder) -> Unbound (rec. res.) -> nameservers (Inet)
I am missing conditional forwarding here. On first sight, we could use BIND:
Client -> dnsmasq (forwarder) -> BIND -> Unbound (rec. res.) -> nameservers (Inet)
But that probably doesn't make so much sense, as BIND gets the source IP from downstream dnsmasq, not the original client IP.
That leaves one remaining solution: spawn an additional dnsmasq instance for conditional forwarding (given two groups of clients).
Having explored OPNsense web GUI, it seems I can only have one instance of dnsmasq though.
Hence, not sure, what is the best solution here. Any thoughts?
1. conditional forwarding of DNS requests to different servers, depending on client IP
2. firewall rule with whitelist of IPs, whose domains were resolved by my DNS server
Specific clients should be forwarded to different DNS servers, e.g. the one from VPN (might also be called source IP-based forwarding of DNS requests).
The firewall rule is usually done via ipsets/nftsets (I've read the implementation on FreeBSD are pf tables).
Some thoughts on possible solutions:
- Unbound can act as recursive resolver, but neither supports ipset nor source-based IP forwarding
- dnsmasq supports ipset, but no source-based IP routing; also only DNS forwarder
- BIND to my knowledge supports conditional forwarding of source IPs via views, but no ipset support; also only plugin and not part of core OPNsense
So, what I am doing now is using dnsmasq together with Unbound:
Client -> dnsmasq (forwarder) -> Unbound (rec. res.) -> nameservers (Inet)
I am missing conditional forwarding here. On first sight, we could use BIND:
Client -> dnsmasq (forwarder) -> BIND -> Unbound (rec. res.) -> nameservers (Inet)
But that probably doesn't make so much sense, as BIND gets the source IP from downstream dnsmasq, not the original client IP.
That leaves one remaining solution: spawn an additional dnsmasq instance for conditional forwarding (given two groups of clients).
Having explored OPNsense web GUI, it seems I can only have one instance of dnsmasq though.
Hence, not sure, what is the best solution here. Any thoughts?
"