Dnsmasq 一個輕量且易於設定的 DNS Cache + DHCP 的伺服器,在一般的 Embedded Linux Router 或 DD-WRT之類的都可以發現他的存在,同時也提供綁定MAC,支援BOOTP與TFTP
安裝 Dnsmasq
emerge dnsmasq
建立 /etc/dnsmasq.resolv.conf
nano /etc/dnsmasq.resolv.conf
內容可參考台灣各ISP的DNS
或自行指定所要使用的 DNS Server
修改設定檔
nano /etc/dnsmasq.conf
編輯以下內容
resolv-file=/etc/dnsmasq.resolv.conf #指定所使用的resolv檔案位址
interface=eth0 #指定 Dnsmasq 監聽的網卡
dhcp-range=192.168.1.101,192.168.1.200,8h #指定發放的IP範圍與租約期限
修改 /etc/resolv.conf
nano /etc/resolv.conf
nameserver 127.0.0.1 # 改成所有DNS 要求由Dnsmasq代理
PS:如果你使用 pppoe 請修改 pppoe 設定,不要讓pppoe更改/etc/resolv.conf
啟動Dnsmasq
sudo /etc/init.d/dnsmasq start
設定開機時自動啟動
rc-update add dnsmasq default
以下為DHCP額外選項
dhcp-option=1,255.255.255.0 #指定 Subnet mask
dhcp-option=3,192.168.1.254 #指定 Gateway
dhcp-option=6,192.168.1.254 #指定 DNS
dhcp-option=44,192.168.1.254 #指定 WINS
沒有留言:
張貼留言