# Pihole DHCP: push a static route to clients

**URL:** <https://discourse.pi-hole.net/t/pihole-dhcp-push-a-static-route-to-clients/20617>\
**Category:** Help\
**Created:** [June 9, 2019, 12:13pm UTC](https://discourse.pi-hole.net/t/pihole-dhcp-push-a-static-route-to-clients/20617 "2019-06-09T12:13:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [June 9, 2019, 2:45pm UTC](https://discourse.pi-hole.net/t/pihole-dhcp-push-a-static-route-to-clients/20617/2 "2019-06-09T14:45:52Z")

</div>

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`.

```auto
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.
[..]

```

* * *

```auto
pi@noads:~ $ dnsmasq --help dhcp
Known DHCP options:
[..]
121 classless-static-route
[..]

```

* * *

```auto
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

```

* * *

```auto
pi@noads:~ $ sudo service pihole-FTL reload
pi@noads:~ $

```

* * *

```auto
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

```

* * *

```auto
deHakkelaar@laptop:~$ sudo dhclient -r wlan0; sudo dhclient wlan0
Killed old client process
deHakkelaar@laptop:~$

```

* * *

```auto
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

```

---

_[View the full topic](https://discourse.pi-hole.net/t/pihole-dhcp-push-a-static-route-to-clients/20617)._
