樹莓派安裝DNSMASQ服務


功能: DNSMASQ是一款高性能的、小型的DNS服務器軟件。
* 緩存域名、IP地址,本地緩存解析的地址。
* DHCP服務

1.安裝

sudo apt-get update
sudo apt-get install dnsmasq

2.配置

(1) 配置/etc/dnsmasq.conf

# dnsmasq.conf for raspberry pi
# /etc/dnsmasq.conf
# http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example

# Set up your local domain here
domain=raspberry.local
resolv-file=/etc/resolv.conf
min-port=4096
server=8.8.8.8
server=8.8.4.4

# Max cache size dnsmasq can give us, and we want all of it!
cache-size=10000

# Below are settings for dhcp. Comment them out if you dont want
# dnsmasq to serve up dhcpd requests.
# dhcp-range=192.168.0.100,192.168.0.149,255.255.255.0,1440m
# dhcp-option=3,192.168.0.1

(2) 配置 /etc/resolv.conf

# Generated by resolvconf
nameserver 127.0.0.1

可以自己增加nameserver ip 地址。

3.使用

啟動:sudo service dnsmasq restart

樹莓派中設置hostname為pi1。
PC機或手機中DNS中設置為:pi1.local


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM