Ubuntu 14.04 LTS Server 安裝 dnsmasq DHCP Server

dnsmasq 也是一套 DHCP Server,除此之外,也可以用來做為 caching DNS proxy 和 TFTP Server。

參考網頁:Dnsmasq – Community Help Wiki

1. 查詢 dnsmasq套件相關訊息
$ sudo apt-cache search dnsmasq | grep ^dnsmasq
dnsmasq-base – Small caching DNS proxy and DHCP/TFTP server
dnsmasq-utils – Utilities for manipulating DHCP leases
dnsmasq – Small caching DNS proxy and DHCP/TFTP server

2. 進行安裝
$ sudo apt-get install  dnsmasq dnsmasq-utils -y
[@more@]3. 備份原設定檔
$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.$(date +%F)

4. 修改設定檔
$ sudo vim /etc/dnsmasq.conf
domain-needed
bogus-priv
local=/computerclassroom.tces.ilc.edu.tw/
expand-hosts
domain=computerclassroom.tces.ilc.edu.tw
interface=eth1
dhcp-range=eth1,192.168.5.1,192.168.5.200,12h
listen-address=127.0.0.1
server=168.95.1.1
server=140.111.66.1
log-queries
log-dhcp

5. 執行 dnsmasq 服務
$ sudo service dnsmasq start
 * Starting DNS forwarder and DHCP server dnsmasq                                    [ OK ]

6. 檢查是否有正常啟動
$ netstat -au | grep :bootps
udp        0      0 *:bootps                *:*

感覺 dnsmasq 的設定比較簡單,但比較沒有辦法像 isc-dhcp-server 一樣做到比較細微的設定,如:針對某一台電腦給予固定的 IP。

移除 dnsmasq
$ sudo apt-get remove –purge dnsmasq dnsmasq-base dnsmasq-utils libmnl0 libnetfilter-conntrack3