yum -y install dnsmasq
groupadd -r dnsmasq
useradd -r -g dnsmasq dnsmasq
vi /etc/dnsmasq.conf
listen-address=127.0.0.1,192.168.2.5
port=53
bind-interfaces
user=dnsmasq
group=dnsmasq
pid-file=/var/run/dnsmasq.pid
domain-needed
bogus-priv
no-hosts
dns-forward-max=150
cache-size=1000
neg-ttl=3600
resolv-file=/etc/resolv.dnsmasq
no-poll
vi /etc/resolv.dnsmasq
nameserver 192.168.2.1
vi /etc/resolv.conf
nameserver 127.0.0.1
service dnsmasq start; chkconfig dnsmasq on
Appendix I – Full configuration file
#
# Configuration file for dnsmasq acting as a caching nameserver.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
#
# Updated versions of this configuration file may be available at:
#
# http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/
#
#
# Basic server configuration
#
listen-address=127.0.0.1
port=53
bind-interfaces
user=dnsmasq
group=dnsmasq
pid-file=/var/run/dnsmasq.pid
#
# Logging
#
#log-facility=/var/log/dnsmasq.log
#log-queries
#
# Name resolution options
#
domain-needed
bogus-priv
no-hosts
dns-forward-max=150
cache-size=1000
#no-negcache
neg-ttl=3600
resolv-file=/etc/resolv.dnsmasq
no-poll
Appendix II – Logging to file
Before dnsmasq starts logging to file it is required to set the path to the logfile in the log-facility option inside /etc/dnsmasq.conf.
log-facility=/var/log/dnsmasq.log
To ensure proper rotation of the log file you should use the following logrotate configuration:
/var/log/dnsmasq.log {
monthly
missingok
notifempty
delaycompress
sharedscripts
postrotate
[ ! -f /var/run/dnsmasq.pid ] || kill -USR2 `cat /var/run/dnsmasq.pid`
endscript
create 0640 dnsmasq dnsmasq
}
Save the above configuration in /etc/logrotate.d/dnsmasq
please refer : http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/
setup dnsmasq on CentOS6
精选 转载![](https://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
使用dnsmasq实现自建DNS
使用dnsmasq自建DNS
dnsmasq 自建DNS -
centos6 GPT centos6 gpt分区
1. 引言 操作系统类型:centos7 使用fdisk -l 命令查看剩余空间如下(约12TB): 经实践发现fdisk分区最大支持2TB,较目前情况不适合使
centos6 GPT centos 文件系统 命令行