# Newb Q: How to pull DNSMASQ config into Pi Hole for DHCP reservations

**URL:** <https://discourse.pi-hole.net/t/newb-q-how-to-pull-dnsmasq-config-into-pi-hole-for-dhcp-reservations/26178>\
**Category:** Help\
**Created:** [December 18, 2019, 8:47pm UTC](https://discourse.pi-hole.net/t/newb-q-how-to-pull-dnsmasq-config-into-pi-hole-for-dhcp-reservations/26178 "2019-12-18T20:47:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)\
**Post date:** [December 19, 2019, 12:45am UTC](https://discourse.pi-hole.net/t/newb-q-how-to-pull-dnsmasq-config-into-pi-hole-for-dhcp-reservations/26178/2 "2019-12-19T00:45:52Z")

</div>

Welcome to the Pi-hole community, @ECM56.

Pi-hole is running a tailored version of dnsmasq _FTL_ DNS[™](https://pi-hole.net/trademark-rules-and-brand-guidelines/) ( `pihole-FTL` ), but configuration is very much the same as with the plain vanilla version. As such, its configuration options are identical to [dnsmasq's options](http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html).

> **There are a few caveats, however (click for details)**
>
> Since Pi-hole is also configuring the `dnsmasq` part at its own discretion, you have to make sure your settings won't collide with Pi-hole. Pi-hole's own settings will likely overrule yours, but they may lead to unexpected behavious as well.
> 
> Pi-hole is striving to make installation and maintenance as easy as possible for standard home users who can be only mildly computer literate.  
> As such, Pi-hole assumes that you are running a single subnet for your home network.  
> If your intended network setup comprises several subnets, you could cater for them as usual, in all ways dnsmasq (and your gateway/router/switch, of course) allows, but don't expect these settings to be supported or even reflected fully in Pi-hole's UI.
> 
> Some valid dnsmasq configuration settings may even compromise the UI in ways that'll force you to stick with editing the dnsmasq files manually, forfeiting the use of Pi-holes admin panel for lease configuration.
> 
> For that reason, I would recommend using your router's DHCP server instead of Pi-hole's for more complex network setups.
> 
> Also, while Pi-hole is using the very same configuration files as dnsmasq, the binary has changed. This means you won't be able to run dnsmasq commands or to use all of dnsmasq options on Pi-hole's replacement binary.
> 
> And finally, you should be aware that Pi-hole may alter its configuration files, e.g. based on user interaction via UI, command line (i.e. during a `pihole -r` reconfiguration) or updating (i.e. `pihole -up`).
> 
> * * *

Now that you've been properly cautioned:  
As you assumed, Pi-hole's dnsmasq configuration is located in a bunch of files in `/etc/dnsmasq.d/`  
Read more at [What files does Pi-hole use?](https://discourse.pi-hole.net/t/what-files-does-pi-hole-use/1684) (which covers not only dnsmasq files).

Before trying to import or rather reuse your static leases:  
Please make sure that **DHCP is _disabled_** on Pi-hole.

> **A. Prepare a static lease conf**
>
> First, you'd have to separate your static IP address assignments from the rest of your legacy dnsmasq configuration into a separate file.
> 
> You could then copy that file into Pi-hole's standard static lease file name (note that normally custom configurations should go into custom files, but here we are trying to reuse an existing config):  
> `/etc/dnsmasq.d/04-pihole-static-dhcp.conf`
> 
> You can check whether your dnsmasq configuration is syntactically correct by running
> 
> ```auto
> pihole-FTL dnsmasq-test
> 
> ```
> 
> Sort out errrors until this results in `syntax check OK`.
> 
> * * *

> **B. Check Pi-hole's UI for possible misalignments**
>
> On a client machine, open a browser and go to [Pi-hole's DHCP panel](http://pi.hole/admin/settings.php?tab=piholedhcp) under Settings | DHCP.
> 
> Even though DHCP is disabled, Pi-hole will populate the _Static DHCP leases configuration_ section in the lower half of the screen from its `04-pihole-static-dhcp.conf`.
> 
> Check that the lines there make sense, i.e. an entry should match its heading. If things are mixed up, your configuration contains extra parameters that are not handled by Pi-hole's UI.
> 
> * * *

> **C. Enable DHCP**
>
> If everything in B. looks ok, you are almost done.
> 
> On Pi-hole's DHCP panel, configure and enable DHCP and press _Save_ to restart Pi-Hole as your DHCP server with your existing static leases.
> 
> * * *

However, if you encounter misalignments in step B, you have two choices:

> **1. Recommended: Edit \`04-pihole-static-dhcp.conf\` to get rid of your extra settings.**
>
> Make your lines conform to  
> `dhcp-host=MA:CA:DD:RE:SS,192.168.1.100,laptop`  
> where you replace MAC, IP and name with your correct settings, of course.
> 
> This will allow you to edit static leases via Pi-holes DHCP panel further on.
> 
> When finished editing, resume with step B.
> 
> * * *

> **2. If you are desperate for your extra settings, you can try and keep them.**
>
> BUT: You should refrain from using Pi-hole's DHCP panel UI in the future, and take extra precaution when enabling or disabling DHCP.
> 
> Before starting DHCP, you have to move `04-pihole-static-dhcp.conf` to another location, e.g. your home directory. Otherwise, if you'd enable DHCP and _Save_ those settings, your static lease file may get corrupted.  
> So move it out of the way, then configure DHCP, enable it and press _Save_.  
> Copy `04-pihole-static-dhcp.conf` back into `/etc/dnsmasq.d/`, but this time, use a different name like `04-static-lease-migration.conf` and restart Pi-hole's DNS:
> 
> ```auto
> sudo pihole restartdns
> 
> ```
> 
> Verify with:
> 
> ```auto
> sudo pihole status
> 
> ```
> 
> If this doesn't show you the green lights, you have introduced conflicts in dnsmasq's configuration that you have to deal with.  
> If everything else fails, move or delete `04-static-lease-migration.conf` and restart Pi-hole.
> 
> In that case, rethink if you really need those extra options or whether your router would be better equipped to handle your DCHP configuration.
> 
> * * *

---

_[View the full topic](https://discourse.pi-hole.net/t/newb-q-how-to-pull-dnsmasq-config-into-pi-hole-for-dhcp-reservations/26178)._
