Dnsmasq Setup Notes
First use Iptables to force all 53 traffic to 5353 on a device with 2 NICs. One that runs as DHCP client outwards, and serves as DHCP server inwards. TODO is to set up logging, and a LAMP (Apache,MySQL,PHP) web installation to manage and admin the custom hosts file, based on data from log file(s).
Relevant /etc/dnsmasq.conf settings:
/etc/dnsmasq.conf # Listen on this specific port instead of the standard DNS port # (53). Setting this to zero completely disables DNS function, # leaving only DHCP and/or TFTP. port=5353 # If you don't want dnsmasq to read /etc/resolv.conf or any other # file, getting its servers from this file instead (see below), then # uncomment this. no-resolv # Add other name servers here, with domain specs if they are for # non-public domains. server=184.108.40.206 # If you want dnsmasq to listen for DHCP and DNS requests only on # specified interfaces (and the loopback) give the name of the # interface (eg eth0) here. # Repeat the line for more than one interface. interface=eth1 # If you don't want dnsmasq to read /etc/hosts, uncomment the # following line. no-hosts # or if you want it to read another file, as well as /etc/hosts, use # this. addn-hosts=/etc/dnsmasq.hosts # On systems which support it, dnsmasq binds the wildcard address, # even when it is listening on only some interfaces. It then discards # requests that it shouldn't reply to. This has the advantage of # working even when interfaces come and go and change address. If you # want dnsmasq to really bind only the interfaces it is listening on, # uncomment this option. About the only time you may need this is when # running another nameserver on the same machine. bind-interfaces # Uncomment this to enable the integrated DHCP server, you need # to supply the range of addresses available for lease and optionally # a lease time. If you have more than one network, you will need to # repeat this for each network on which you want to supply DHCP # service. dhcp-range=192.168.50.2,192.168.50.100,12h
2 NIC Setup - /etc/network/interfaces:
auto lo iface lo inet loopback iface eth0 inet dhcp iface eth1 inet static address 192.168.50.1 netmask 255.255.255.0 network 192.168.50.0 broadcast 192.168.50.255
A normal interfaces static setup would look like this:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.50.1 netmask 255.255.255.0 gateway 192.168.50.1 dns-nameservers 220.127.116.11 18.104.22.168