目前最新版是2.7.1 ,可去其FTP下载:http://www.thekelleys.org.uk/dnsmasq/
安装过程比较简单
yum -y install dnsmasq* wget http://www.keepalived.org/software/keepalived-1.2.9.tar.gz tar zxvf keepalived-1.2.9.tar.gz cd keepalived-1.2.9 ./configure --prefix=/usr/local/keepalived make && make install mkdir /etc/keepalived cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/ ln -s /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/ ln -s /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/ ln -s /usr/local/keepalived/sbin/keepalived /usr/sbin/ chkconfig --add keepalived chkconfig --level 35 keepalived on
keepalived的配置很简单,只需要配置一个VIP可以在两台Server之间飘来飘去就可以实现主备了
! Configuration File for keepalived global_defs { notification_email { xxx@xxx.com } notification_email_from xxx@xxx.com smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id LVS_DEVEL } vrrp_instance dnscache { state MASTER // 另一台配置BACKUP interface eth1 // 在哪个接口上进行服务器状态检测 virtual_router_id 51 priority 180 // BACKUP机器上配置100 advert_int 1 // 检查间隔,单位为秒 authentication { auth_type PASS auth_pass 1234 } virtual_ipaddress { // VIP设置,指定到内网网卡 192.168.100.99/24 dev eth1 } }
dnsmasq的配置也很简单
resolv-file=/etc/resolv.dnsmasq.conf cache-size=1000 conf-dir=/etc/dnsmasq.d
将dns地址写入到/etc/resolv.dnsmasq.conf文件中
echo "nameserver 8.8.8.8" > /etc/resolv.dnsmasq.conf
本机和局域网其它全部的服务器dns解析都用它
echo "nameserver 192.168.100.99" > /etc/resolv.conf
最后找一台局域网Server验证一下,如果能解析就说明正常了.
nslookup www.google.cn 192.168.100.99
此方案只适合小型企业,规模少的情况下使用,解析量大的时候还是用bind最好。
下面是其它网友的补充:
复制代码 代码如下:
sudo pacman -S --needed dnsmasq
cd /etc
[admin@huangye etc]$ sudo cp -v dnsmasq.conf{,.orig}
`dnsmasq.conf' -> `dnsmasq.conf.orig'
[admin@huangye etc]$ sudo vim dnsmasq.conf
相比来说,dnsmasq的配置简单多了:
复制代码 代码如下:
resolv-file=/etc/dnsmasq.resolv.conf
addn-hosts=/etc/dnsmasq.hosts
local=/localnet/
no-dhcp-interface=eth0
conf-dir=/etc/dnsmasq.d
复制代码 代码如下:
[admin@huangye etc]$ sudo cp -v resolv.conf dnsmasq.resolv.conf
Password:
`resolv.conf' -> `dnsmasq.resolv.conf'
sudo mkdir /etc/dnsmasq.d
sudo touch /etc/dnsmasq.hosts
sudo /etc/rc.d/dnsmasq start
最后,别忘记加入rc.conf DAEMONS,注意要在network后面。
dnsmasq 可从额外的hosts文件读取条目,如可以这样添加正向解析:
echo "IP地址 域名" > /etc/dnsmasq.hosts
另外,重启dnsmasq可以用SIGHUP(可以在修改hosts文件后,让配置生效)
killall -s SIGHUP dnsmasq
查看服务状态:
netstat -tunl
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN
udp 0 0 0.0.0.0:53 0.0.0.0:*
再dig 一下,发现稳定在4ms ,我晕,同样的配置,我在一台ubuntu server 10.04 上面dig 是1ms ,在我本地居然在4ms ,囧
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]