[Dnsmasq-discuss] DNS forwarding steered based on source interface?

Adam Pribyl covex at lowlevel.cz
Fri Apr 19 08:16:55 UTC 2024


On Thu, 18 Apr 2024, Christopher Hill wrote:

> Hi,
>
> I have a question regarding if upstream DNS forwarding can be based on 
> the source interface? Reading the manual I don't believe it is possible..?
>
> The scenario I have is two VLANs that can talk to each other and both 
> use dnsmasqfor local name resolution - this works fine. Each VLAN is 
> configured at the gateway to default route traffic to different VPNs, 
> e.g. VLAN1 out to VPN1, and VLAN2 to VPN2 respectively, and I would like 
> dnsmasq to forward requests originating on VLAN1 to the DNS on VPN1, and 
> the same for VLAN2 forwarding to VPN2.
>
> To illustrate:
>
>              tun1     VPN1   VPN2     tun2
>              10.0.1.1  |       | 10.0.2.1
>                        +---+---+
>                            |
>                           WAN
>                            |
>                    +-------+--------+
>                    |      eth0      |
>           VLAN 1 <-+-eth1      eth2-+-> VLAN 2
>   192.168.1.0/24   |    (gateway)   |   192.168.2.0/24
>                    +----------------+
>
>
> I would like to do something like the following in the dnsmasq 
> configuration on the gateway:
>
>   server=eth1,10.0.1.1 at tun1
>   server=eth2,10.0.2.1 at tun2
>
> i.e. queries arriving on eth1 get sent to 10.0.1.1 via tun1, and queries 
> arriving on eth2 get sent to 10.0.2.1 via tun 2.

What I am using is, that I have two VLANs 1 and 2, for each I have a 
separate config like

/etc/dnsmasq.d/dnsmasq-eth1.1.conf
/etc/dnsmasq.d/dnsmasq-eth2.2.conf

I did not tried to use a different upstream DNS, but I would say it should 
be possible.

> Thanks,
> Chris

Adam Pribyl


More information about the Dnsmasq-discuss mailing list