[SOLVED] Howto add classless-static-route to DHCP

I have searched your forum and all over the place, had a look here:
but to no avail.

I have pi-hole setup on a VLAN on 10.6.40.0/24 on my network. I have the Pi-hole setup as the DHCP Server for this VLAN.
I have a router with two WANs, WAN1 goes out to a router at 192.168.1.1 and WAN2 to a router which has address 172.16.1.1
I am trying to make the pi-hole use WAN2 for all Internet Traffic and local traffic to stay with the 10.6.40.1 Gateway

I have tried this
dhcp-option=option:classless-static-route,0.0.0.0/0,10.6.40.1,0.0.0.0/0,172.16.1.1
in a file
/etc/dnsmasq.d/99-my-settings.conf
I have also got conditional forwarding setup for local addresses as well on the pi-hole.
but this does not work as shown by a traceroute call to gentoo.org

Any ideas how to achieve this?

It is not entirely clear what you are trying to achieve, but it seems likely that your issue is related to networking rather than Pi-hole.

So are you trying to make Pi-hole send outbound packets through a specific gateway?
Or are you looking for a way to have Pi-hole's DHCP clients use a specific gateway?

Note that Pi-hole is not involved in routing at all.
The only traffic it will see is DNS requests from those devices that have been configured to use it, and DHCP broadcasts from the very network segment it is connected to (when acting as DHCP server).

Pi-hole will forward DNS requests to one of the IP addresses of its configured upstreams DNS servers.
It is unknown to Pi-hole and also completely irrelevant for Pi-hole's operation which gateway those requests will be routed through.

That will configure Pi-hole's DHCP server to instruct a DHCP client to use a certain route.
It doesn't change anything for the machine running Pi-hole by default, and whether that route would be operational for a client at all would depend on the configuration of your three different routers.

If you were indeed looking for a way to have Pi-hole's DHCP clients use a specific gateway, note that Pi-hole's DHCP server already will provide such a gateway to its clients, as configurable via Pi-hole's DHCP settings pane.

Whether your clients will be able to communicate with that gateway would again depend on your routers' configuration.

So either way, you'd have to configure your routers correctly before you start experimenting with pushing additional routes to your clients.

You should consider to consult other forums specialising in routing/networking for answers as well.

Thank you @Bucking_Horn for your swift reply.
I now realise I will have to do the routing in the router itself.
Thanks you for your help.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.