Change DNS Subnet Mask from 255.255.0.0 to 255.255.255.0

Currently my Pi-Hole is publishing and using the subnet mask 255.255.0.0 broadcast 172.16.255.255

This complicates matters and I would like to change the subnet to 255.255.255.0

I have tried creating a file called dhcp-subnet using

echo 'dhcp-option=option:netmask,<PUT_YOUR_SUBNETMASK_HERE>' | sudo tee /etc/dnsmasq.d/11-pihole-dhcp-subnet.conf

However when I try and restart dnsmasq I get "Unit dnsmasq.service not found"

On reboot the subnet remains 255.255.0.0

Any suggestions please.

Thanks.

Understood, but how to I change the Subnet Mask in Pi-Hole?

Thanks.

The subnet mask is assigned at the OS level on the Pi-Hole host, not by Pi-Hole.

In Stretch the interfaces file point to:

Include files from /etc/network/interfaces.d:

source-directory /etc/network/interfaces.d

The interfaces.d folder is empty. This Pi-Hole has been configured only by Pi-Hole setup. New Rasbpian install.

I do not see any functional way to change the DNS Subnet Mask in Raspian configured as a Pi-Hole. Sorry.

01-pihole.conf

###############################################################################
# FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
# #
# IF YOU WISH TO CHANGE THE UPSTREAM SERVERS, CHANGE THEM IN: #
# /etc/pihole/setupVars.conf #
# #
# ANY OTHER CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE #
# OR IN /etc/dnsmasq.conf #
###############################################################################

addn-hosts=/etc/pihole/gravity.list
addn-hosts=/etc/pihole/black.list
addn-hosts=/etc/pihole/local.list
localise-queries
no-resolv
cache-size=10000
log-queries=extra
log-facility=/var/log/pihole.log
local-ttl=2
log-async
server=1.1.1.1#53
server=1.0.0.1#53
server=2606:4700:4700::1111#53
server=2606:4700:4700::1001#53
domain-needed
bogus-priv
interface=eth0

02-pihole-dhcp.conf

##############################################################################
# DHCP SERVER CONFIG FILE AUTOMATICALLY POPULATED BY PI-HOLE WEB INTERFACE. #
# ANY CHANGES MADE TO THIS FILE WILL BE LOST ON CHANGE #
###############################################################################
dhcp-authoritative
dhcp-range=172.16.105.90,172.16.105.129,24h
dhcp-option=option:router,172.16.105.1
dhcp-leasefile=/etc/pihole/dhcp.leases
#quiet-dhcp

domain=DOMUS
#quiet-dhcp6
#enable-ra
dhcp-option=option6:dns-server,[::]
dhcp-range=::100,::1ff,constructor:eth0,ra-names,slaac,24h
ra-param=*,0,0

Edit /etc/dhcpcd.conf and change the subnet. Then reboot.

My uncommented dhcpcd.conf looks like this:

hostname
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
option interface_mtu
require dhcp_server_identifier
slaac private
interface eth0
static routers=172.16.105.1
static domain_name_servers=8.8.8.8
static domain_search=8.8.4.4
noipv6
static ip_address=172.16.105.2/16
static routers=172.16.105.1
static domain_name_servers=127.0.0.1
static ip_address=172.16.105.2/24
static routers=172.16.105.1
static domain_name_servers=127.0.0.1

Remove the lines below prefixed with --- and reboot.

hostname
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
option interface_mtu
require dhcp_server_identifier
slaac private
interface eth0
static routers=172.16.105.1
static domain_name_servers=8.8.8.8
static domain_search=8.8.4.4
noipv6
--- static ip_address=172.16.105.2/16
--- static routers=172.16.105.1
--- static domain_name_servers=127.0.0.1
static ip_address=172.16.105.2/24
static routers=172.16.105.1
static domain_name_servers=127.0.0.1
1 Like

So far so good, I can now see my other network. Thank you for your help. Now my various Pi's can update as well!

Nice!

1 Like

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