HOWTO: Setup dnsmasq on Fedora as DNS DHCP and tftp for PXE
17/07/11
Categories: Fedora, Installing and Configuration, Network Management, Systems Administration, Apache Web Server
HOWTO: Setup dnsmasq on Fedora as DNS DHCP and tftp for PXE
Description
This description shamelessly take from the dnsmasq home page.The dnsmasq DHCP server supports static address assignments and multiple networks. It automatically sends a sensible default set of DHCP options, and can be configured to send any desired set of DHCP options, including vendor-encapsulated options. It includes a secure, read-only, TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP.
Dnsmasq supports IPv6 for DNS and TFTP, but not DHCP. Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS server. It loads the contents of /etc/hosts so that local hostnames which do not appear in the global DNS can be resolved and also answers DNS queries for DHCP configured hosts.
Installing dnsmasq is just a case of using yum.
Installation
sudo yum install dnsmasq
sudo chkconfig dnsmasq --list
sudo chkconfig dnsmasq on
sudo chkconfig dnsmasq on
/etc/dnsmasq.conf
Edit /etc/dnsmasq.conf
domain-needed
bogus-priv
no-resolv
no-poll
server=208.67.222.222
server=208.67.220.220
local=/example.com/
address=/doubleclick.net/127.0.0.1
no-hosts
addn-hosts=/etc/dnsmasq.d/static/hosts.conf
expand-hosts
domain=example.com
dhcp-range=192.168.0.20,192.168.0.50,72h
dhcp-option=option:router,192.168.0.1
dhcp-option=option:ntp-server,192.168.0.5
dhcp-option=19,0 # ip-forwarding off
dhcp-option=44,192.168.0.5 # set netbios-over-TCP/IP aka WINS
dhcp-option=45,192.168.0.5 # netbios datagram distribution server
dhcp-option=46,8
bogus-priv
no-resolv
no-poll
server=208.67.222.222
server=208.67.220.220
local=/example.com/
address=/doubleclick.net/127.0.0.1
no-hosts
addn-hosts=/etc/dnsmasq.d/static/hosts.conf
expand-hosts
domain=example.com
dhcp-range=192.168.0.20,192.168.0.50,72h
dhcp-option=option:router,192.168.0.1
dhcp-option=option:ntp-server,192.168.0.5
dhcp-option=19,0 # ip-forwarding off
dhcp-option=44,192.168.0.5 # set netbios-over-TCP/IP aka WINS
dhcp-option=45,192.168.0.5 # netbios datagram distribution server
dhcp-option=46,8
What these lines will do for you.
- domain-needed This tells dnsmasq to never pass short names to the upstream DNS servers. If the name is not in the local /etc/hosts file then "not found" will be returned.
- bogus-priv All reverse IP (192.168.x.x) lookups that are not found in /etc/hosts will be returned as "no such domain" and not forwarded to the upstream servers.
- no-resolv Do not read resolv.conf to find the servers where to lookup dns.
- no-poll Do not poll resolv.conf for changes
- server=208.67.222.222
server=208.67.220.220 Set one or more DNS servers to use when addresses are not local. These are open DNS servers. - local=/example.com/ Our local domain, queries in these domains are answered from /etc/hosts or the static-hosts files.
- address=/doubleclick.net/127.0.0.1 Use this force an address for the specified domains. e.g to block adverts force doubleclck.net to localhost
- no-hosts This options stops dnsmasq using the local /etc/hosts file as a source for lookups .
- addn-hosts=/etc/dnsmasq.d/static/hosts.conf Force dnsmasq to use this file for lookups. It is in the same format as /etc/hosts.
- expand_hosts So we can see our local hosts via our home domain without having to repeatedly specify the domain in our /etc/hosts file.
- domain This is your local domain name. It will tell the DHCP server which host to give out IP addresses for.
- dhcp-range This is the range of IPs that DHCP
will serve: 192.168.0.20 to 192.168.0.50, with a lease time of 72 hours.
The lease time is how long that IP will be linked to a host. (All most
)
- dhcp-option=option:router,192.168.0.1 When a host is requesting an IP address via DHCP also tell it the gateway to use.
- dhcp-option=option:ntp-server,192.168.0.5 When a host is requesting an IP address via DHCP also tell it the NTP to use.
Starting and stopping the service
sudo service dnsmasq start
sudo service dnsmasq stop
sudo service dnsmasq restart
sudo service dnsmasq stop
sudo service dnsmasq restart
Useful links
PS:
this article come from
版权声明
本博客所有的原创文章,作者皆保留版权。转载必须包含本声明,保持本文完整,并以超链接形式注明作者Saturn和本文原始地址:
https://ndtm-idea.blogspot.com/2012/05/howto-setup-dnsmasq-on-fedora-as-dns.html
0 comments:
Post a Comment