setup dnsmasq on CentOS6
2016-04-25 21:18
579 查看
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/
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/
相关文章推荐
- Linux下用dnsmasq做dns cache server的配置方法
- 路由器 DNSMasq 替代 hosts,支持Android、iPhone、PC
- 使用CentOS搭建网关路由器
- 使用dnsmasq搭建wifi热点DHCP服务器的最简方法
- 【Raspberry Pi 3试用体验】+ 搭建本地DNS服务器
- Neutron dhcp-agent 之 dnsmasq
- 最新dnsmasq安装部署详解(centos6)
- dnsmasq 小巧且方便地用于配置DNS和DHCP的工具
- dnsmasq(内网DNS)
- DNS域名解析优化之dnsmasq篇(占座贴,待完成)
- DNS域名解析优化之tinydns/djbdns篇——测试篇 推荐
- Dnsmasq 解析域名到内网IP
- 用dnsmasq搭建小型的内网DNS 推荐
- zimbra 邮件系统
- 手把手CentOS6 + DNSMasq + apache + kickstart 网络安装 CentOS7
- 使用dnsmasq提供DNS和DHCP服务
- 测试配置yum仓库的http镜像
- centos7.3安装dnsmasq
- OpenWrt DNS问题排查