centos bind centos镜像
centos bind服务 中的dns cache缓存时间可以更改吗,如何更改
Option中有下面两个参数,分别定义否定应答和肯定应答在缓存中的生存周期:
max-ncache-ttl
为降低网络流量和提升服务器存储否定回答的性能。 max-ncache-ttl以秒为单位设定这
些回答的保存时间.默认max-ncache-ttl是10800秒(3小时)。 max-ncache-ttl不能超过7
天,如果设成一个更大的值,则将会被自动减为7天。
max-cache-ttl
max-cache-ttl设定了服务器储存普通(肯定)答案的最大时间。默认值一周(7天)
下载中心有bind9的管理员手册,可以多参考一下
CentOS7实现DNSDHCP动态更新详解
windows域里有一个功能,dhcp把新分发的ip数据发给DNS服务器,这样只要知道一个人的电脑名字就可以很方便的远程。
linux当然也能很好的实现类似的功能。man 5 dhcpd.conf有详细描述。
昨天运维帮组织线下的沙龙,又拍云的运维总监邵海杨先生分享了一句“千金难买早知道”。是啊,就在实现动态更新的功能上,在网上找了不少博客,照着做又遇到各种问题,最后不不知道到底什么原理实现的。早知道认真看一下man,问题早解决了,对实现的原理也理解得深些。所以,在这个信息爆炸的时代,很多时候真的互联网没有让人更聪明,反而大量的信息经常把人淹没了。技术,还是需要静下心来去钻研的。
dhcp和dns的基本配置资料比较完善,此处不再赘述。有心的朋友认真看一下man 5 dhcpd.conf,瞧一眼下面配置中标红的部分,相信就能搞定了。
另外分享一个dns chroot的流程,先安装 bind,调通named,然后再安装bind-chroot
执行/usr/libexec/setup-named-chroot.sh/var/named/chroot on
停用named,启用named-chroot即可
systemctl disabled named; systemctl stop named
systemctl enable named-chroot;systemctl start named-chroot
[root@pxe~]# cat/etc/dhcp/dhcpd.conf
ddns-update-style interim;
ddns-updates on;
do-forward-updates on;
allow client-updates;
allow bootp;
allow booting;
#allow client-updates;
option space Cisco_LWAPP_AP;
option Cisco_LWAPP_AP.server-address code 241= array of ip-address;
option space pxelinux;
option pxelinux.magic code 208= string;
option pxelinux.configfile code 209= text;
option pxelinux.pathprefix code 210= text;
option pxelinux.reboottime code 211= unsigned integer 32;
option architecture-type code 93= unsigned integer 16;
subnet 192.168.1.0 netmask 255.255.255.0{
authoritative;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name"it.lab";
option domain-name-servers 192.168.1.200;
range dynamic-bootp 192.168.1.100 192.168.1.199;
key SEC_DDNS{
algorithm hmac-md5;
secret 7ObhTIhKeDFMR2SbbS5s8A==;
};
ddns-domainname"it.lab";
zone it.lab.{
primary 192.168.1.200;
key SEC_DDNS;
}
zone 1.168.192.in-addr.arpa.{
primary 192.168.1.200;
key SEC_DDNS;
}
default-lease-time 600;
max-lease-time 7200;
class"pxeclients"{
match if substring(option vendor-class-identifier, 0, 9)="PXEClient";
next-server 192.168.1.200;
if option architecture-type= 00:07{
filename"uefi/syslinux.efi";}
else{
filename"bios/pxelinux.0";}
#filename"pxelinux.0";}
}
}
[root@pxe~]# cat/etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver(as a localhost DNS resolver only).
//
// See/usr/share/doc/bind*/sample/ for example named configuration files.
//
options{
listen-on port 53{ 127.0.0.1;192.168.1.200;};
listen-on-v6 port 53{::1;};
directory"/var/named";
dump-file"/var/named/data/cache_dump.db";
statistics-file"/var/named/data/named_stats.txt";
memstatistics-file"/var/named/data/named_mem_stats.txt";
allow-query{ any;};
/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
- If you are building a RECURSIVE(caching) DNS server, you need to enable
recursion.
- If your recursive DNS server has a public IP address, you MUST enable access
control to limit queries to your legitimate users. Failing to do so will
cause your server to become part of large scale DNS amplification
attacks. Implementing BCP38 within your network would greatly
reduce such attack surface
*/
recursion no;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key*/
bindkeys-file"/etc/named.iscdlv.key";
managed-keys-directory"/var/named/dynamic";
pid-file"/run/named/named.pid";
session-keyfile"/run/named/session.key";
};
logging{
channel default_debug{
file"data/named.run";
severity dynamic;
};
};
zone"." IN{
type hint;
file"named.ca";
};
include"/etc/named.rfc1912.zones";
include"/etc/named.root.key";
key SEC_DDNS{
algorithm hmac-md5;
secret 7ObhTIhKeDFMR2SbbS5s8A==;
};
zone"it.lab" IN{
type master;
file"it.lab.forward";
allow-update{ key SEC_DDNS;};
};
zone"1.168.192.in-addr.arpa" IN{
type master;
file"1.168.192.reverse";
allow-update{ key SEC_DDNS;};
};
centos2003是什么版本
centos2003的版本是:CentOS 7.8版本,并且众所周知,CentOS由 Red Hat Enterprise Linux的源代码重新编译而成,因此 CentOS 7.8的上游版本正是本月初发布的 Red Hat Enterprise Linux 7.8。
centos2003主要变更是:已使用 Python 3,安装 python3组件将提供 Python 3.6解释器,bind已升级为 9.11,chrony已升级为 3.4。
自 1503发行版(abrt>= 2.1.11-19.el7.centos.0.1)开始,CentOS-7可以直接向反馈错误,可在找到更多关于此功能的数据。
如果准备在 Anaconda采用安全性配置文件,很多组件已获得重要更新,ImageMagick已从 6.7.8升级为 6.9.10。
基于redis的IP地址快速查询的方法是:
为了提高查询速度,我们引入redis,redis是目前热门的Nosql数据库,很多大的公司都在用,具体的用法大家可以查查资料。
redis中有一种数据结构是有序集合 sortset,我的IP数据库可以转化为sortset存储,一个sortset中存储所有的IP记录,结构为value中存储IP的开始,结束,省份等,分别依照逗号隔开,score中存放的是IP的结束值。
比如我们查询一个IP,IP转化为长整型的数字为 2,然后我们查询的时候就通过sortset的zrangebyscore ranges 2+inf LIMIT 0 1这样我们就查询出来大于2的第一条记录。
这样我们查询出来记录为“1,5,中国移动,北京市”然后我们在判断一下我们要查询的地址在不在 1,5之间,2在1,5之间,所以查出来了2对应的IP地址为中国移动北京市。
再比如我们要查询的IP地址数字为 8,通过zrangebyscore ranges 8+inf LIMIT 0 1我们查询到了 10,20,中国联通,上海市,但是8不在10,20之间,所以查询不到此IP对应的地址。