# set up dnsmasq

dnsmasq provides DHCP and DNS services for the network

## install & config dnsmasq
m
install with:
```
apt install dnsmasq
```
stop service so it doesn't do anything until it's configured:
```
service dnsmasq stop
```

### config

config file is in `/etc/dnsmasq.conf`. The following settings need to be set:
```
# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/mar.alemor.org/

# 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=lan0

# Set a  domain for a particular subnet
domain=mar.alemor.org,192.168.80.0/24

# 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.82.50,192.168.82.150,12h

# Set the limit on DHCP leases, the default is 150
dhcp-lease-max=150

# Set the DHCP server to authoritative mode. In this mode it will barge in
# and take over the lease for any client which broadcasts on the network,
# whether it has a record of the lease or not. This avoids long timeouts
# when a machine wakes up on a new network. DO NOT enable this if there's
# the slightest chance that you might end up accidentally configuring a DHCP
# server for your campus/company accidentally. The ISC server uses
# the same option, and this URL provides more information:
# http://www.isc.org/files/auth.html
dhcp-authoritative

# If you want to disable negative caching, uncomment this.
no-negcache
```
after you've set the config you want, reload with `service dnsmasq restart`

- hosts in `/etc/hosts` and MAC addresses in `/etc/ethers`

## make interface static

set `192.168.82.1` as the hostname for `medusa.mar.alemor.org`

the LAN interface won't be getting DHCP since it *is* the DHCP, so it has to be defined as static. In `/etc/network/interfaces`, add the block:
```
# LAN interface needs to be manually defined
# 21-bit netmask is 255.255.248.0 in dot notation
auto lan0
iface lan0 inet static
  address 192.168.82.1/21
```

then take the interface down and bring it back up with:
```
ifdown lan0
ifup lan0
```