2008-06-05 10:07作者:萧少聪[Scott Siu]
E-Mail:
scottsiuzs@gmail.com
一、方案
系统:Red Hat Enterprise Linux 4 AS 4.0实现:DHCP+DNS
二、笔记
1、生成KEY
# dnssec-keygen -a HMAC-MD5 -b 128 -n USER DHCP_UPDATER
这时当前目录下会生成Kdhcp_updater.+xxx+xxxxx.key及.private两个文件
# cat Kdhcp_updater.+xxx+xxxxx.key
DHCP_UPDATER. IN KEY 0 2 157 qSSpjerAuaPE/X3JJyxSww==
其中qSSpjerAuaPE/X3JJyxSww==下面要用到的
2、DHCP
在dhcpd.conf后加上
# ----------- DDNS -----------------
key DHCP_UPDATER {
algorithm HMAC-MD5;
secret "qSSpjerAuaPE/X3JJyxSww==";
}
zone scott.home. {
primary 127.0.0.1;
key DHCP_UPDATER;
}
ps:PXE安装中option domain-name及option domain-name-servers前面的“#”也 可以去掉了,因为下面我们来设DNS
3、DNS
# rpm -qa | gerp bind
看有没有bind-xx及bind-chroot-xx理论上chroot可以提高安全性但设置时繁琐一点
# rpm -qa | gerp caching-name
看caching-nameserver是否也已经装了,这个不装的话就要自己写named.ca等几个文 件了
# vi /etc/named.conf 在最后加上
key DHCP_UPDATER {
algorithm HMAC-MD5;
secret "qSSpjerAuaPE/X3JJyxSww==";
};
zone "scott.home" IN {
type master;
file "scott.home.zone";
allow-update { key DHCP_UPDATER; };
};
# cd /var/named/chroot/var/named
# cp localdomain.zone scott.home.zone
# chown named:named scott.home.zone
# cd /var/named/chroot/var
# chown named:named named/
# cd /var/named
# ln -s /var/named/chroot/var/named/scott.home.zone
# vi scott.home.zone (修改成你自己的DNS设置,不要抄我)
$TTL 86400
@ IN SOA scott.home. root.scott.home. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS scott.home.
@ IN A 192.168.1.100
4、防火墙iptables
# iptables -F
# iptables -P INPUT DROP
# iptables -A INPUT -i lo -j ACCEPT
# iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -p tcp -m multiport --dports 53,953 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -p udp -m multiport --dports 53,953 -j ACCEPT
# /etc/init.d/iptables save 实际实验中可关闭iptables:service iptables stop
5、启动服务
# /etc/init.d/dhcpd restart
# chkconfig dhcpd on
# /etc/init.d/named restart
# chkconfig named on
6、测试(主要讲讲LINUX,实验过程中发现windows作客户机还不行)
在客户机上加入一个文件/etc/dhclient.conf内容如下
send fqdn.fqdn "test"; //test为本机的hostname
send fqdn.encoded on;
send fqdn.server-update off;
运行dhclient或重新启动
正常的话DNS服务器主机的/var/named/chroot/var/named下会多出一个以jnl结尾的
文件如:scott.home.zone.jnl 这时ping test.scott.home看看能还PING通
测试均已通过,有兴趣的同学可放心实验.
更多精彩,请关注我的博客http://hi.baidu.com/yuhongchun027