User Tools

Site Tools


networking:linux:dnsmasq

dnsmasq

Firewall

Disable the firewall on the server or open these ports:

  • Open UDP port 53 (DNS)
    • Also open TCP port 53 if doing zone transfers
  • Open UDP port 67 (DHCP)
  • Open UDP port 69 (TFTP)
  • Open UDP port 4011 (PXE)

Set the Server Hostname

Adjust as necessary.

vim /etc/hosts

127.0.0.1		localhost.localdomain localhost
::1			localhost6.localdomain6 localhost6 

192.168.1.2		hostname.domain.tld hostname

Name Resolution

Set the server to use its own IP first:

vim /etc/resolv.conf

search domain.tld
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4

Configure dnsmasq

This is a sample config file and absoultely must be adapted for your network.

mv /etc/dnsmasq.conf /etc/dnsmasq.conf.dist

vim /etc/dnsmasq.conf

# Add records to /etc/hosts file and restart dnsmasq for local name resolution.
#
# Hosts that use DHCP can also be resolved locally.
#
# Add 'nameserver 127.0.0.1' to /etc/resolv.conf ahead of other nameservers
# in order to resolve names on this (dnsmasq server) host.

#interface=eth0
domain-needed
bogus-priv
filterwin2k
strict-order

# Upstream Nameservers (if not gotten from DHCP)
#
# Cox Name Servers 
#server=68.105.28.12
#server=68.105.29.12
#
# Google Name Servers
server=8.8.8.8
server=8.8.4.4
expand-hosts
domain=domain.tld
dhcp-range=192.168.1.65,192.168.1.199,24h

## DHCP Options
#
# 0.0.0.0 is 'self' (machine running dnsmasq)
#
dhcp-option=1,255.255.255.0                  # subnet mask
dhcp-option=2,-25200                         # time zone offset in seconds
dhcp-option=3,192.168.1.1                    # default gateway
dhcp-option=6,0.0.0.0,8.8.8.8                # DNS servers (self and Google)
dhcp-option=7,0.0.0.0                        # Log Server
dhcp-option=17,192.168.1.2:/tftpboot         # BOOTP rootpath
dhcp-option=42,0.0.0.0                       # NTP Server
dhcp-option=44,0.0.0.0                       # set WINS
dhcp-option=66,"192.168.1.2"                 # TFTP server
dhcp-option=150,"hostname.domain.tld"        # TFTP server address (Cisco?)

# SRV Records for PBX
#
srv-host=_sip._tcp.domain.tld,hostname.domain.tld
srv-host=_sip._udp.domain.tld,hostname.domain.tld

## IP Lease Reservations
#
dhcp-host=08:00:27:fe:73:20,192.168.1.30,pbx
dhcp-host=00:0e:e9:02:cd:04,192.168.1.55,phone
dhcp-host=00:13:20:74:9b:a8,192.168.1.50,mars
dhcp-host=00:0e:08:ef:3d:11,192.168.1.56,ata

# Specify boot file and optionally the TFTP server
#
#dhcp-boot=/tftpboot/pxelinux.0              # Specify boot file and optionally the TFTP server

## TFTP Server
#
#enable-tftp                                 # enable dnsmasq's built-in TFTP server
#tftp-root=/var/lib/tftpboot                 # set the TFTP root directory

Start dnsmasq Automatically

chkconfig dnsmasq on

service dnsmasq start

Polycom Phones

Allow Polycom phones to upload log files to TFTP server:

mkdir -p /var/lib/tftpboot
chmod 777 /var/lib/tftpboot
cd /var/lib/tftpboot
networking/linux/dnsmasq.txt · Last modified: 2015/12/17 20:08 by gcooper