کد:
http://blogs.techrepublic.com.com/opensource/?p=751&tag=rbxccnbtr1
PART 1 - Named
Running a home DNS server is not without its benefits. The same holds true for running a home DHCP server. The two together provide an easy way to reference individual systems using DNS names for the local network, and the ability to dynamically allocate local IP addresses as systems come and go. On Linux, there are a number of DNS and DHCP servers, but two that work hand-in-hand are ISC’s BIND and DHCPd. Together, you can create a system where a client system obtains an IP via DHCP and will automatically have a DNS name assigned to it.
In other words, if you connect a laptop to the local network, you need do nothing more than configure it to use DHCP; once it has connected, any other computer in the network will be able to ping or connect to it by merely using its hostname. This is commonly known as dynamic DNS. In this tip I’ll look at configuring the BIND side of a dynamic DNS service, and in a following tip I’ll configure the DHCP side and put it all together. The configuration here is used on a CentOS 5.3 system, but with some potential path changes, it should work on any Linux distribution.
Configuring BIND for dynamic DNS service
To begin with, you must configure BIND by editing /etc/named/named.conf on most Linux distributions. Configuring BIND entirely is beyond the scope of this tip, so we’ll concentrate on the bits required to make dynamic DNS work. This will assume you already have a local network set up; in this example the local domain name is “home.lan” and the network address space is the local 192.168.10.0 network.
By default, most distributions create /etc/rndc.key as part of the installation, so ensure the following is in /etc/named/named.conf:
کد:
include "/etc/rndc.key"; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { rndckey; }; };
کد:
key "rndckey" { algorithm hmac-md5; secret "[dns-keygen output]"; };
Returning to /etc/named/named.conf, your zone statements should look similar to this:
کد:
zone "home.lan" { type master; file "master/home.lan"; allow-update { key "rndckey"; }; notify yes; }; zone "168.192.in-addr.arpa" { type master; file "reverse/168.192"; allow-update { key "rndckey"; }; notify yes; };
In the next tip, we will look at configuring the DHCP side of our project
کامنت