




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
BIND+DHCP实现DDNS你已经掌握DNS服务了吗?你也已经掌握DHCP服务了吗?那么好吧,下面,我们将实现一个全新的服务DDNS。在这个服务里,我们将会使用DNS服务和DHCP的组合。学习之前,请再扪心自问:我已经准备好了吗?准备好了!好,那么在动手之前,先让我们来了解一下什么是DDNS。一、 什么是DDNSDDNS,Dynamic Domain Name Server,顾名思义就是动态域名服务器。DDNS,从其名称可以看出,它是DNS服务的一种。DNS服务,一般是基于静态IP的,主要是实现IP和域名的对应解析。而DDNS,言下之意就是实现对域名的动态解析,就是实现动态IP地址到域名的对应。DNS可以为客户端进行名称解析的前提是DNS服务器上有相关的记录。DDNS是将用户的动态IP地址映射到一个固定的域名解析服务上,用户每次连接网络的时候客户端程序就会通过信息传递把该主机的动态IP地址传送给位于服务主机上的服务器程序,服务项目器程序负责提供DNS服务并实现动态域名解析。就是说DDNS捕获用户每次变化的IP地址,然后将其与域名相对应,这样其他上网用户就可以通过域名来进行交流了。既然已经了解了DDNS的特点及其基本原理,那么下面我们来实现这个服务吧,给我们的DNS服务和DHCP服务管理下的网络域内每台机器都分配解析域。二、 DDNS的实现要实现DDNS服务,首先要搭建一台DNS服务器。本例中,我们将使用IP 54以及域名来实现。1. 修改named.conf文件,将不需要的部分注释掉,修改如下:/ Sample named.conf BIND DNS server named configuration file/ for the Red Hat BIND distribution./ See the BIND Administrators Reference Manual (ARM) for details, in:/ file:/usr/share/doc/bind-*/arm/Bv9ARM.html/ Also see the BIND Configuration GUI : /usr/bin/system-config-bind and / its manual./options / Those options should be used carefully because they disable port / randomizationquery-source port 53; query-source-v6 port 53; listen-on port 53 any; ;/ Put files that named is allowed to write in the data/ directory:directory /var/named; / the default dump-file data/cache_dump.db; statistics-file data/named_stats.txt; memstatistics-file data/named_mem_stats.txt; ;logging /* If you want to enable debugging, eg. using the rndc trace command, * named will try to write the named.run file in the $directory (/var/named). * By default, SELinux policy does not allow named to modify the /var/named directory, * so put the default debug log file in data/ : */ channel default_debug file data/named.run; severity dynamic; ;/ All BIND 9 zones are in a view, which allow different zones to be served/ to different types of client addresses, and for options to be set for groups/ of zones./ By default, if named.conf contains no view clauses, all zones are in the / default view, which matches all clients./ / If named.conf contains any view clause, then all zones MUST be in a view; / so it is recommended to start off using views to avoid having to restructure/ your configuration files in the future./view localhost_resolver /* This view sets up named to be a localhost resolver ( caching only nameserver ). * If all you want is a caching-only nameserver, then you need only define this view: */match-clients any; ; match-destinationsany; ; recursion yes; # all views must contain the root hints zone:include /etc/named.root.hints; /* these are zones that contain definitions for all the localhost * names and addresses, as recommended in RFC1912 - these names should * ONLY be served to localhost clients: */include /etc/named.rfc1912.zones;#view internal #/* This view will contain zones you want to serve only to internal clients that connect via your directly attached LAN interfaces - localnets . */#match-clients localnets; ;#match-destinations localnets; ;#recursion yes;/ all views must contain the root hints zone:#include /etc/named.root.hints; / include named.rfc1912.zones;/ you should not serve your rfc1912 names to non-localhost clients. / These are your authoritative internal zones, and would probably/ also be included in the localhost_resolver view above :#zone ernal.zone #type master;#file ernal.zone.db;#;#zone ernal.zone #type slave;#file slaves/ernal.zone.db;#masters /* put master nameserver IPs here */ ; ;/ put slave zones in the slaves/ directory so named can update them#;#zone ernal.zone #type master;#allow-update key ddns_key; ;#file slaves/ernal.zone.db;/ put dynamically updateable zones in the slaves/ directory so named can update them#;#;key ddns_key /此处先留着,等一会儿将生成一个ddns密钥algorithm hmac-md5;secret use /usr/sbin/dns-keygen to generate TSIG keys;#view external #/* This view will contain zones you want to serve only to external clients * that have addresses that are not on your directly attached LAN interface subnets: */#match-clients any; ;#match-destinations any; ;#recursion no;/ youd probably want to deny recursion to external clients, so you dont / end up providing free DNS service to all takers/ all views must contain the root hints zone:#include /etc/named.root.hints;/ These are your authoritative external zones, and would probably / contain entries for just your web and mail servers:#zone my.external.zone #type master;#file my.external.zone.db;#;#;2. 配置区域定义文件named.rfc1912.zones,添加相关记录/ named.rfc1912.zones:/ ISC BIND named zone configuration for zones recommended by/ RFC 1912 section 4.1 : localhost TLDs and address zones/ zone IN type master; file .zone; allow-update none; ; ;zone 0.168.192. IN type master; file 0.168.192.zone; allow-update none; ;3. 创建区域解析文件创建正向解析文件如下:$TTL86400 IN SOA. . ( 2009101901; serial (d. adams) 3H; refresh 15M; retry 1W; expiry 1D ); minimum IN NS. x IN A54 创建反向解析文件如下:$TTL86400 IN SOA. . ( 2009101901; serial (d. adams) 3H; refresh 15M; retry 1W; expiry 1D ); minimum IN NS. 254 IN PTR. 4. 启动named服务并测试(略)5. 生成DDNS密钥进入/var/named/chroot目录,使用如下命令生成一对DDNS密钥:dnssec-keygen -a HMAC-MD5 -b 128 -n USER example 指定加密算法 密钥长度 指定用户名使用此命令生成密钥对后,在当前目录下会看到两个密钥文件,如下:Kexample.+157+23558.key Kexample.+157.23558.private其中,Kexample.+157+23558.key是公钥,Kexample.+157+23558.private是私钥。下面,我们打开文件,查看生成的密钥并记录。rootx chroot#cat Kexample.+157+23558.keyexample. IN KEY 0 3 157 8fsNLoqo7RnRpNpCSMfszQ=rootx chroot#cat Kexample.+157.23558.privatePrivate-key-format: v1.2Algorithm: 157 (HMAC_MD5)Key: 8fsNLoqo7RnRpNpCSMfszQ=我们发现两个密钥是一样的,这并没有什么错误,公钥和私钥主要是用于核对密钥是否一致。随便将哪个密钥记录下来备用。6. 修改named.conf文件,添加DDNS密钥找到named.conf文件中key这个区域,然后修改如下:key example algorithm hmac-md5; secret 8fsNLoqo7RnRpNpCSMfszQ=;7 修改named.rfc1912.zones文件zone IN type master; file .zone; allow-update key example; ; ;zone 0.168.192. IN type master; file 0.168.192.zone; allow-update key example; ;8. 配置dhcpd.conf文件ddns-update-style interim;ignore client-updates;key example algorithm hmac-md5; secret 8fsNLoqo7RnRpNpCSMfszQ=;zone . primary 54; key example;zone 0.168.192.. primary 54; key example;subnet netmask # - default gatewayoption routers;option subnet-mask;#option ;option ;option domain-name-servers54;option time-offset-18000;# Eastern Standard Time#option ntp-servers;#option netbios-name-servers;# - Selects point-to-point node (default is hybrid). Dont change this unless# - you understand Netbios very well#option netbios-node-type 2;range dynamic-bootp 28 54;default-lease-time 21600;max-lease-time 43200;# we want the nameserver to appear at a fixed address#host cent #next-server marvin.redhat.c
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年汽车抵押贷款合同-个人车辆产权质押协议
- 2025年特种化工原料采购及质量保证协议
- 2025年节能环保纸箱定制生产及物流配送一体化服务合同
- 2025综合医院药品器械采购合同-高品质医疗物资全面供应
- 2025年S店高端店面租赁与全方位品牌合作运营协议
- 2025年校园食堂设备租赁与运营管理服务合同
- 2025年度新能源矿产开发与技术服务承包合同
- 2025年度特色茶楼品牌连锁加盟合同:创新模式下的茶馆经营授权
- 2025年区块链专利授权及技术服务合作协议
- 2025年生态农业园区设施租赁与农业科技推广服务协议
- GB/T 4909.4-2009裸电线试验方法第4部分:扭转试验
- GB/T 15155-1994滤波器用压电陶瓷材料通用技术条件
- PDCA质量持续改进案例一:降低ICU非计划拔管发生率
- 企业标准编写模板
- 商场开荒保洁计划书
- 初中道德与法治 九年级(维护祖国统一)初中道德与法治九年级作业设计样例
- 幼儿园绘本故事:《骄傲的大公鸡》 课件
- 江西省赣州市于都县2022-2023学年九年级化学第一学期期中监测试题含解析
- 新冠核酸检测实验室PCR管八联管滤芯吸头等耗材质检和储存程序
- DBJ 53-T-46-2012 云南省城镇道路及夜景照明工程施工验收规程
- 西方文明史(第五版)英文版全书ppt完整版课件整本书电子教案最全教学教程
评论
0/150
提交评论