I understand that you want to setup a DHCP and DNS server on a pi to serve local hostnames.
First you want to make sure that it will be the only one DHCP server on your lan. This is important if you want local name resolution to work properly and avoid double ip assignment. Then, as your pi is not your network gateway, it will also have to give your main gateway (router) address in the answer to an ip request.
This is a very basic dnsmasq.conf that should work:
Code: Select all
# interface to listen on
interface=eth0
# upstream DNS servers (google ones or your ISP's)
server=8.8.8.8
server=8.8.4.4
# range of addresses to lease
dhcp-range=192.168.0.5,192.168.0.100,255.255.255.0,1h
# gateway (router) address
dhcp-option=option:router,192.168.0.1
Now, be careful because if the pi running dnsmasq crashes, the hosts on you LAN would have no DHCP server to get an ip lease from. No ip, no route, no internet, no lan. In that case, make sure you can either restart the DHCP on your main router with a factory reset or otherwise, or have a direct access (keyboard + monitor or serial) to your pi for troubleshooting.
Last side note, don't forget to restart dnsmasq after every change in its conf file and make sure every host on your lan have a different hostname otherwise the local name resolution will not work as expected.