You can use the classless-static-route
DHCP option but you will need to push the default route as well through this option.
In below example, 10.0.0.1
is my router and I am adding a route to 206.189.252.0/24
via 10.0.0.99
.
pi@noads:~ $ man dnsmasq
[..]
-O, --dhcp-option=[tag:<tag>,[tag:<tag>,]][encap:<opt>,][vi-
encap:<enterprise>,][vendor:[<vendor-class>],][<opt>|option:<opt-
name>|option6:<opt>|option6:<opt-name>],[<value>[,<value>]]
Specify different or extra options to DHCP clients. By default,
dnsmasq sends some standard options to DHCP clients, the netmask
and broadcast address are set to the same as the host running
dnsmasq, and the DNS server and default route are set to the
address of the machine running dnsmasq. (Equivalent rules apply
for IPv6.) If the domain name option has been set, that is sent.
This configuration allows these defaults to be overridden, or
other options specified. The option, to be sent may be given as
a decimal number or as "option:<option-name>" The option numbers
are specified in RFC2132 and subsequent RFCs. The set of option-
names known by dnsmasq can be discovered by running "dnsmasq
--help dhcp". For example, to set the default route option to
192.168.4.4, do --dhcp-option=3,192.168.4.4 or --dhcp-option =
option:router, 192.168.4.4 and to set the time-server address to
192.168.0.4, do --dhcp-option = 42,192.168.0.4 or --dhcp-option
= option:ntp-server, 192.168.0.4 The special address 0.0.0.0 is
taken to mean "the address of the machine running dnsmasq".
Data types allowed are comma separated dotted-quad IPv4
addresses, []-wrapped IPv6 addresses, a decimal number, colon-
separated hex digits and a text string. If the optional tags are
given then this option is only sent when all the tags are
matched.
[..]
pi@noads:~ $ dnsmasq --help dhcp
Known DHCP options:
[..]
121 classless-static-route
[..]
pi@noads:~ $ echo 'dhcp-option=option:classless-static-route,0.0.0.0/0,10.0.0.1,206.189.252.0/24,10.0.0.99' | sudo tee /etc/dnsmasq.d/99-my-settings.conf
pi@noads:~ $ sudo service pihole-FTL reload
pi@noads:~ $
deHakkelaar@laptop:~$ ip r
default via 10.0.0.1 dev wlan0
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.220
deHakkelaar@laptop:~$ sudo dhclient -r wlan0; sudo dhclient wlan0
Killed old client process
deHakkelaar@laptop:~$
deHakkelaar@laptop:~$ ip r
default via 10.0.0.1 dev wlan0
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.220
206.189.252.0/24 via 10.0.0.99 dev wlan0