I have a Linux box that serves as a DHCP, DNS (via pihole-FTL
) and WireGuard servers. I wanted to make the VPN network reachable from the network that device is on. After some research I found option 121 of DHCP, and after consulting the manpages, I added that option to pihole-FTL
's config. After then refreshing the DHCP lease, the route was added on the client, as I expected. However, the default gateway stopped being advertised, and the client could not reach the internet.
Config before:
On the server:
$ rg dhcp-option /etc/dnsmasq.d/
/etc/dnsmasq.d/02-pihole-dhcp.conf
7:dhcp-option=option:router,192.168.1.1
And client after a DHCP refresh:
$ ip r
default via 192.168.1.1 dev enp3s0 proto dhcp src 192.168.1.223 metric 1002
192.168.1.0/24 dev enp3s0 proto dhcp scope link src 192.168.1.223 metric 1002
Config after:
Server:
$ rg dhcp-option /etc/dnsmasq.d/
/etc/dnsmasq.d/02-pihole-dhcp.conf
7:dhcp-option=option:router,192.168.1.1
/etc/dnsmasq.d/03-dhcp-route-wireguard.conf
2:dhcp-option=121,192.168.2.0/24,192.168.1.4
Client after a refresh:
$ ip r
192.168.1.0/24 dev enp3s0 proto dhcp scope link src 192.168.1.223 metric 1002
192.168.2.0/24 via 192.168.1.4 dev enp3s0 proto dhcp src 192.168.1.223 metric 1002
I was going off of this answer, but even though my configuration matches what is shown there, it does not work as I would expect.