# Set RESOLVCONF=no to not run resolvconf
RESOLVCONF=yes
server:/# mkdir /var/lib/dns/dev
server:/# mkdir -p /var/lib/dns/var/cache/bind
server:/# mkdir -p /var/lib/dns/var/run/bind/run
server:/# mknod /var/lib/dns/dev/random c 1 8
server:/# chmod 666 /var/lib/dns/dev/null /var/lib/dns/dev/random
server:/# chown -R bind:bind /var/lib/dns/var/*
server:/# chown -R bind:bind /var/lib/dns/etc/bind
server:/# chown bind:bind /var/lib/named/etc/bind/myzones.conf
type master;
file "/etc/bind/db.ex";
};
server:/# chown bind:bind /var/lib/dns/etc/bind/db.ex
@ IN SOA server root.server (
2009032601 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
@ IN NS server
server A 192.168.0.1 ; адрес сервера для 1-й сети
server A 192.165.15.1 ; адрес сервера для 2-й сети
server:/# chown bind:bind /var/lib/dns/etc/bind/local.rev
@ IN SOA server.ex. root.server.ex. (
2009032601 ; serial
604800 ; refresh
86400 ; retry
2419200 ; expire
604800 ; negative cache TTL
)
@ IN NS server.ex.
1.0.168 IN PTR server.ex.
1.15.165 IN PTR server.ex.
directory "/var/cache/bind";
version "SecurityDNS v.USSR";
allow-recursion { "net"; };
allow-query { any; };
//auth-nxdomain no; # conform to RFC1035
listen-on-v6 { none; }; # отключил поддержку IPv6
};
192.168.0.0/24;
192.165.15.0/24;
127.0.0.1;
212.98.185.103;
212.98.160.50;
212.98.160.65;
};
controls {
inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys {rndc-key;};
};
type master;
file "/etc/bind/local.rev";
};
192.168.0.0/24;
192.165.15.0/24;
127.0.0.1;
212.98.185.103;
212.98.160.50;
212.98.160.65;
};
include "/etc/bind/named.conf.options";
include "/etc/bind/rndc.key";
controls {
inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys {rndc-key;};
};
zone "." {
type hint;
file "/etc/bind/db.root";
};
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
zone "192.in-addr.arpa" {
type master;
file "/etc/bind/local.rev";
};
include "/etc/bind/myzones.conf";
nameserver 127.0.0.1
192.165.15.1 server.ex server
/sbin/iptables -A OUTPUT -p tcp -m tcp -o lo --dport 953 --sport 1024:6553 -j ACCEPT
# разрешаю доступ DNS-серверу наружу
/sbin/iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
/sbin/iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
server:/# rndc reload
> set q=any
> localhost
Server: 127.0.0.1
Address: 127.0.0.1#53
localhost
origin = localhost
mail addr = root.localhost
serial = 2
refresh = 604800
retry = 86400
expire = 2419200
minimum = 604800
localhost nameserver = localhost.
Name: localhost
Address: 127.0.0.1
localhost has AAAA address ::1
> 127.0.0.1
Server: 127.0.0.1
Address: 127.0.0.1#53
1.0.0.127.in-addr.arpa name = localhost.
> google.ru
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
google.ru mail exchanger = 10 smtp2.google.com.
google.ru mail exchanger = 10 smtp3.google.com.
google.ru mail exchanger = 10 smtp4.google.com.
google.ru mail exchanger = 10 smtp1.google.com.
Name: google.ru
Address: 72.14.221.104
Name: google.ru
Address: 74.125.77.104
Name: google.ru
Address: 216.239.59.104
google.ru
origin = ns1.google.com
mail addr = dns-admin.google.com
serial = 2009033100
refresh = 21600
retry = 3600
expire = 1209600
minimum = 300
google.ru nameserver = ns3.google.com.
google.ru nameserver = ns1.google.com.
google.ru nameserver = ns4.google.com.
google.ru nameserver = ns2.google.com.
Authoritative answers can be found from:
google.ru nameserver = ns1.google.com.
google.ru nameserver = ns3.google.com.
google.ru nameserver = ns2.google.com.
google.ru nameserver = ns4.google.com.
ns2.google.com internet address = 216.239.34.10
ns3.google.com internet address = 216.239.36.10
ns4.google.com internet address = 216.239.38.10
; <<>> DiG 9.5.1-P1 <<>> @server.ex google.com
; (2 servers found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28297
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 300 IN A 74.125.67.100
google.com. 300 IN A 209.85.171.100
google.com. 300 IN A 74.125.45.100
;; AUTHORITY SECTION:
google.com. 345600 IN NS ns1.google.com.
google.com. 345600 IN NS ns3.google.com.
google.com. 345600 IN NS ns4.google.com.
google.com. 345600 IN NS ns2.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 172741 IN A 216.239.32.10
ns2.google.com. 172740 IN A 216.239.34.10
ns3.google.com. 172740 IN A 216.239.36.10
ns4.google.com. 172740 IN A 216.239.38.10
;; Query time: 107 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Mon Jan 1 00:39:58 2001
;; MSG SIZE rcvd: 212
serverd:/etc/init.d# dig @server.ex google.com
; <<>> DiG 9.5.1-P1 <<>> @server.ex google.com
; (2 servers found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27974
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 273 IN A 74.125.45.100
google.com. 273 IN A 74.125.67.100
google.com. 273 IN A 209.85.171.100
;; AUTHORITY SECTION:
google.com. 345573 IN NS ns1.google.com.
google.com. 345573 IN NS ns4.google.com.
google.com. 345573 IN NS ns3.google.com.
google.com. 345573 IN NS ns2.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 172714 IN A 216.239.32.10
ns2.google.com. 172713 IN A 216.239.34.10
ns3.google.com. 172713 IN A 216.239.36.10
ns4.google.com. 172713 IN A 216.239.38.10
;; Query time: 2 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Mon Jan 1 00:40:25 2001
;; MSG SIZE rcvd: 212
И на машине входящей в сеть под управлением Windows XP:
Microsoft Windows XP [Версия 5.1.2600]
(С) Корпорация Майкрософт, 1985-2001.
C:\Documents and Settings\Администратор>nslookup
Default Server: server.ex
Address: 192.168.0.1
> set q=any
> server.ex
Server: server.ex
Address: 192.168.0.1
server.ex internet address = 192.165.15.1
server.ex internet address = 192.168.0.1
ex nameserver = server.ex





































