|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!比来外洋的办事器当地DNS老是出妨碍,闪断一会儿城市影响营业。因而在机房里找了两台Server,装置上keepalived和dnsmasq实践当地的DNS缓存。
装置历程对照复杂- yum-yinstalldnsmasq*wgethttp://www.keepalived.org/software/keepalived-1.2.9.tar.gztarzxvfkeepalived-1.2.9.tar.gzcdkeepalived-1.2.9./configure--prefix=/usr/local/keepalivedmake&&makeinstallmkdir/etc/keepalivedcp/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--addkeepalivedchkconfig--level35keepalivedon
复制代码
keepalived的设置很复杂,只必要设置一个VIP能够在两台Server之间飘来飘往就能够完成主备了- !ConfigurationFileforkeepalivedglobal_defs{notification_email{***@***.com}notification_email_from***@***.comsmtp_server127.0.0.1smtp_connect_timeout30router_idLVS_DEVEL}vrrp_instancednscache{stateMASTER//另外一台设置BACKUPinte***ceeth1//在哪一个接口长进行办事器形态检测virtual_router_id51priority180//BACKUP呆板上设置100advert_int1//反省距离,单元为秒authentication{auth_typePASSauth_pass1234}virtual_ipaddress{//VIP设置,指定到内网网卡192.168.100.99/24deveth1}}
复制代码
dnsmasq的设置也很复杂- resolv-file=/etc/resolv.dnsmasq.confcache-size=1000conf-dir=/etc/dnsmasq.d
复制代码
将dns地点写进到/etc/resolv.dnsmasq.conf文件中- echo"nameserver8.8.8.8">/etc/resolv.dnsmasq.conf
复制代码
本机和局域网别的全体的办事器dns剖析都用它- echo"nameserver192.168.100.99">/etc/resolv.conf
复制代码
最初找一台局域网Server考证一下,假如能剖析就申明一般了.- nslookupwww.谷歌.cn192.168.100.99
复制代码 此计划只合适小型企业,范围少的情形下利用,剖析量年夜的时分仍是用bind最好。
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们! |
|