#!/bin/sh
NETMASK="255.255.255.0"
DEVICE="eth0"
IP="192.168.10.1"
IPRANGE_FROM="192.168.10.201"
IPRANGE_TO="192.168.10.250"
NETWORK="${IP%.*}"
if ! [ -x /etc/init.d/dnsmasq ]; then
 apt-get update
 apt-get --yes install dnsmasq
fi
ifconfig $DEVICE $IP netmask $NETMASK
/etc/init.d/dnsmasq stop
rm -f /etc/dnsmasq.conf
cat > /etc/dnsmasq.conf <<EOT
dhcp-range=$IPRANGE_FROM,$IPRANGE_TO,$NETMASK
interface=$DEVICE
EOT
/etc/init.d/dnsmasq start
