[Dnsmasq-discuss] Does dnsmasq support policy routing instead of default kernel routing?
Peter Tirsek
peter at tirsek.com
Mon Apr 14 18:48:54 UTC 2025
On Mon, 14 Apr 2025, Nitesh Divecha via Dnsmasq-discuss wrote:
> Is it possible for dnsmasq to honor policy routing (e.g., via ip
> rule) for outbound DNS queries, or to bind its source IP explicitly
> so Linux routing decisions follow the correct table?
This sounds like more of a sysadmin issue than a dnsmasq issue.
According to the manpage for ip rule, a rule with iif lo will match all
locally generated traffic. Try that (ip rule add iif lo table natlan).
ip rule add - insert a new rule
iif NAME
select the incoming device to match. If the interface is
loopback, the rule only matches packets originating from this
host. This means that you may create separate routing tables
for forwarded and local packets and, hence, completely separate
them.
--
Peter Tirsek
More information about the Dnsmasq-discuss
mailing list