If its for local network needs and didn't using real domain name(actually with real domain is almost the same) you can setup BIND like this (I'm DNS newbie so you must also read docs created from professionals ) . This is just sample setup :
/etc/named.conf
Code:
logging {
channel all {
file "/var/log/named.log" versions 4 size 20m;
severity debug 5;
print-time yes ;
print-severity yes;
print-category yes;
};
category default {
all;
};
};
options {
directory "/var/cache/bind";
recursion yes;
allow-query { any; };
};
// required zone for recursive queries
zone "." {
type hint;
file "/etc/bind/root.servers";
};
// required local host domain
zone "localhost" in{
type master;
file "/etc/bind/localhost.master";
allow-update{none;};
};
// localhost reverse map
zone "0.0.127.in-addr.arpa" in{
type master;
file "/etc/bind/localhost.rev";
allow-update{none;};
};
//your domain here
zone "site.com" {
type master;
file "/etc/bind/site.com";
};
//your domain reverse zone - PTR
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/0.168.192.in-addr.arpa";
};
This are zone files I put here only that for localhost, but you can get the the idea how to create you domain zones:
/etc/bind/localhost.master
Code:
$TTL 604800
@ IN SOA localhost. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
/etc/bind/localhost.rev
Code:
$TTL 604800
@ IN SOA localhost. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
1.0.0 IN PTR localhost.
If you are using your bind for recursive queries you will need root.servers - you can find it via google its public.
Or as melk600 said you can use dnsmasq it has simpler setup
Setup is something like this-per host :
Code:
dhcp-host=4C:00:10:52:0B:87,192.168.168.96
address=/site.com/192.168.168.96
In few words first line says give to 4C:00:10:52:0B:87(MAC address ) this ip 192.168.168.96
Second line says :
For this IP 192.168.168.96 name is site.com
Also you have global options like
Code:
#your resolv.conf - where are described ISP nameservers
resolv-file=/root/loadbal_routing/resolv.conf.ext
#interface to listen for queries
interface=eth0
#dont listen here
except-interface=lo
# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
no-hosts
#dhcp pool range
dhcp-range=192.168.168.1,192.168.168.190,255.255.255.0,12h
#where to store leases
dhcp-leasefile=/var/state/dnsmasq/dnsmasq.leases
#if you want logging
log-queries
You can setup multiple names to respond from one IP in BIND zone cofiguration
like this:
Code:
@ IN A 192.168.168.1
but on this IP also responds
www IN CNAME site.com.
ftp IN CNAME site.com.
git IN CNAME site.com.
So
www.site.com, ftp.site.com and git.site.com will have same ip address 192.168.168.1