¥D ¿ï ³æ
 µn¤J
¨Ï¥ÎªÌ¦WºÙ:

±K½X:


§Ñ¤F±K½X?

²{¦b´Nµù¥U!
 ª©­±­·®æ

(10 ­Óª©­±­·®æ)
¯¸ªø³¡¸¨®æ - lutuni ªº¤é»x
 ­q¾\ lutuni ªº¤é»x


DNS(9)


³Ì·sªº¤é»x
2014/10/17

§@ªÌ: lutuni (11:35 pm)
Environment (Àô¹Ò)

Operation-System¡GUbuntu Server 8.041
Deb¡Gbind9 (DNS)

jonny@ubuntu:~$ sudo apt-get install bind9


Hinet ºô°ìµù¥U¡G

DNS Server Name¡Gwww.dadiling.com
IP Address¡G59.125.159.74

DNS Server Name¡Gdns.dadiling.com
IP Address¡G59.125.159.74



Server Configure (¦øªA¾¹³]©w)

1. ¥[¤J¥¿¤Ï¸Ñ³]©w¡Gnamed.conf ·|«ü¥X Server ºÞÁÒªº°Ï°ì(Zone)¦WºÙ¤Î¬ÛÃöÀɮסC©ó include "/etc/bind/named.conf.local"; ¤W¤è¥[¤J¹w·s¼Wªº³]©w

jonny@ubuntu:~$ sudo vim /etc/bind/named.conf
...
sudo vim /etc/bind/named.conf.local
//¼W¥[¥¿¸Ñ°Ï°ì(Zone)

zone "dadiling.com" {
type master;
file "/etc/bind/db.dadiling";
};

//¼W¥[¤Ï¸Ñ°Ï°ì(Zone)
zone "159.125.59.in-addr.arpa" {
type master;
file "/etc/bind/db.159.125.59";
};

include "/etc/bind/named.conf.local";



2. ­×§ï Bind °Ñ¼Æ

1. ³Æ¥÷­ì©l°Ñ¼Æ

jonny@ubuntu:/etc/bind$ sudo cp named.conf.options named.conf.options.bak


2. §ó·s°Ñ¼Æ

jonny@ubuntu:/etc/bind$ sudo vim named.conf.options
options {
directory "/var/cache/bind";
forwarders {
168.95.1.1; 139.175.10.20; 203.133.1.6;
};
allow-query { any; };
allow-transfer { none; };
};



3. «Ø¥ß¥¿¸Ñ°Ï°ì³]©wÀÉ

jonny@ubuntu:/etc/bind$ sudo vim db.dadiling
; BIND reverse data file for local loopback interface

@ IN SOA dlp.dadiling.com. root.dadiling.com. (
2012042701 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)

; define name server

@ IN NS dlp.dadiling.com.

; define name server's IP address

@ IN A 59.125.159.74

; define mail exchanger

@ IN MX 10 dlp.dadiling.com.

; define IP address of a hostname

dlp IN A 59.125.159.74



4. 3. «Ø¥ß¤Ï¸Ñ°Ï°ì³]©wÀÉ

jonny@ubuntu:/etc/bind$ sudo vim db.159.125.59
; BIND reverse data file for local loopback interface

$TTL 604800
@ IN SOA @ root.dns.dadiling.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.dadiling.com.
@ IN NS www.dadiling.com.
74 IN PTR dns.dadiling.com.
74 IN PTR www.dadiling.com.
2014/10/17

§@ªÌ: lutuni (3:30 pm)
[1] For internal zone
This example uses internal address[192.168.1.0/24], domain name[dadiling.com], but please use your own one when you set config on your server.

root@dlp:~#
vim /etc/bind/dadiling.com.lan
------------------------------------------------------------------
$TTL 86400
@ IN SOA dlp.dadiling.com. root.dadiling.com. (
2012042701 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)

; define name server
@ IN NS dlp.dadiling.com.
; define name server's IP address
@ IN A 192.168.1.210
; define mail exchanger
@ IN MX 10 dlp.dadiling.com.
; define IP address of a hostname
dlp IN A 192.168.1.210
-------------------------------------------------------------
[2] For external zone
This example uses external address[59.125.159.70/29], domain name[dadiling.com], but please use your own one when you set config on your server.

root@dlp:~#
vim /etc/bind/dadiling.com.wan

@ IN SOA dlp.dadiling.com. root.dadiling.com. (
2012042701 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)

; define name server
@ IN NS dlp.dadiling.com.
; define name server's IP address
@ IN A 59.125.159.74
; define mail exchanger
@ IN MX 10 dlp.dadiling.com.
; define IP address of a hostname
dlp IN A 59.125.159.74
------------------------------------------------------------------
Reverse resolution
create zone files that servers resolve domain names from IP address.

[3] For internal zone
This example uses internal address[10.0.0.0/24], domain name[server.world], but please use your own one when you set config on your server.
root@dlp:~#
vim /etc/bind/1.168.192.db
------------------------------------------------------------------
$TTL 86400
@ IN SOA dlp.dadiling.com. root.dadiling.com. (
2012042701 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
; define name server
@ IN NS dlp.dadiling.com.
; define the range of this domain included
@ IN PTR dadiling.com.
@ IN A 255.255.255.0
; define hostname of an IP address
210 IN PTR dlp.dadiling.com.

[4] For external zone
This example uses external address[172.16.0.80/29], domain name[server.world], but please use your own one when you set config on your server.
root@dlp:~#
vi /etc/bind/70.159.125.59.db
$TTL 86400
@ IN SOA dlp.dadiling.com. root.dadiling.com. (
2012042701 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)

; define name server
@ IN NS dlp.dadiling.com.
; define the range of this domain included
@ IN PTR dadiling.com.
@ IN A 255.255.255.248
# define hostname of an IP address
74 IN PTR dlp.dadiling.com.
2014/10/17

§@ªÌ: lutuni (2:46 pm)
[1] Install BIND
root@dlp:~# aptitude -y install bind9 bind9utils

[2] Configure BIND This example is done with grobal IP address [ 59.125.159.70/29 ], Private IP address [ 192.168.1.0/24 ], Domain name [ dadiling.com ]. However, Please use your own IPs and domain name when you set config on your server. ( Actually, [59.125.159.70/29] is for private IP address, though. )

root@dlp:~# vim /etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
# make it comment
#
include "/etc/bind/named.conf.default-zones";
# add
include "/etc/bind/named.conf.internal-zones";
include "/etc/bind/named.conf.external-zones";

root@dlp:~# vim /etc/bind/named.conf.internal-zones
# create new

# define for internal section
view "internal" {

match-clients {
localhost;
192.168.1.0/24;
};
zone "." {
type hint;
file "db.root";
};

# set zone for internal

zone "dadiling.com" {
type master;
file "dadiling.com.lan";
allow-update { none; };
};

# set zone for internal *note

zone "1.169.192.in-addr.arpa" {
type master;
file "1.169.192.db";
allow-update { none; };
};
zone "localhost" {
type master;
file "db.local";
};
zone "127.in-addr.arpa" {
type master;
file "db.127";
};
zone "0.in-addr.arpa" {
type master;
file "db.0";
};
zone "255.in-addr.arpa" {
type master;
file "db.255";
};
};

root@dlp:~# vim /etc/bind/named.conf.external-zones

# create new
# define for external section

view "external" {

match-clients { any; };

# allo any query

allow-query { any; };

# prohibit recursion

recursion no;

# set zone for external

zone "dadiling.com" {
type master;
file "dadiling.com.wan";
allow-update { none; };
};

# set zone for external *note

zone "70.159.125.59.in-addr.arpa" {
type master;
file "70.159.125.59.db";
allow-update { none; };
};
};

# *note : For How to write for reverse resolving, Write network address reversely like below 10.0.0.0/24
network address
⇒ 192.168.1.0

range of network
⇒ 192.168.1.0 - 192.168.1.255

how to write
⇒ 1.168.192.in-addr.arpa
59.125.159.70/29
network address
⇒ 59.125.159.70

range of network
⇒ 59.125.159.70 - 59.125.159.78
how to write
⇒ 70.159.125.59.in-addr.arpa
2010/03/23

§@ªÌ: lutuni (8:16 am)
Ubuntu Server¤W©Ò´£¨ÑªºDNS Server®M¥ó¬Obind
±µµÛ§Ú­Ì¶}±Ò¤@­Óterminal
¨Ã¿é¤J¤U¦C«ü¥O:
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. sudo apt-get install bind9

sudo apt-get install bind9


±µ¤U¨Ó½Ð´£¨Ñ¨ãºÞ²zÅv­­±K½X¨Ã¦^µªY¶i¦æ®M¥óªº¦w¸Ë
¦w¸Ë§¹¦¨¤§«á´N­n¨Ó³]©w¤F
­º¥ý½s¿è/etc/bind/named.conf.local
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. sudo vim /etc/bind/named.conf.local

sudo vim /etc/bind/named.conf.local


¨Ò¦p§Ú­Ì¥Ó½Ð¤F¤@­Óºô°ì¥s§@dadiling.com
¥B§Ú­Ì¥Ó½Ðªº¯u¹êIP¬O59.125.159.74
¦]¦¹­n·s¼W©³¤Uªº¤º®e¨ìnamed.conf.local¤¤
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. zone "dadiling.com" {
2. type master;
3. file "/etc/bind/dadiling.com.hosts";
4. };
5. zone "159.125.59.in-addr.arpa" {
6. type master;
7. file "/etc/bind/159.125.59.rev";
8. };

zone "dadiling.com" {
type master;
file "/etc/bind/dadiling.com.hosts";
};
zone "159.125.59.in-addr.arpa" {
type master;
file "/etc/bind/159.125.59.rev";
};


±µ¤U¨Ó­n²£¥Í¥¿¦Vºô°ì¦WºÙÀÉ®×¥B·s¼W¤@µ§¥D¾÷¬ö¿ý(mail.dadiling.comªº¯u¹êIP¹ïÀ³¨ì59.125.159.74)
½Ð°õ¦æ¤U¦C«ü¥O:
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. sudo vim /etc/bind/dadiling.com.hosts

sudo vim /etc/bind/dadiling.com.hosts


·s¼W¤º®e¦p¤U:
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. $ttl 38400
2. dadiling.com. IN SOA mail1. dadiling.com. (
3. 1255760316
4. 10800
5. 3600
6. 604800
7. 38400 )
8. dadiling.com. IN NS mail1.
9. mail.dadiling.com. IN A 59.125.159.74

$ttl 38400
dadiling.com. IN SOA mail1.dadiling.com. (
1255760316
10800
3600
604800
38400 )
dadiling.com. IN NS mail1.
mail.dadiling.com. IN A 59.125.159.74


±µ¤U¨Ó­n²£¥Í¤Ï¦Vºô°ì¦WºÙÀÉ®×¥B·s¼W¤@µ§¤Ï¦VIP¬ö¿ý(¯u¹êIP 59.125.159.74¹ïÀ³¨ìmail.dadiling.com)
½Ð°õ¦æ¤U¦C«ü¥O:
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. sudo vim /etc/bind/159.125.59.rev

sudo vim /etc/bind/159.125.59.rev


·s¼W¤º®e¦p¤U:
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. $ttl 38400
2. 159.125.59.in-addr.arpa. IN SOA mail1.dadiling.com. (
3. 1255760379
4. 10800
5. 3600
6. 604800
7. 38400 )
8. 159.125.59.in-addr.arpa. IN NS mail1.
9. 74.159.125.59.in-addr.arpa. IN PTR mail.

$ttl 38400
159.125.59.in-addr.arpa. IN SOA mail1.dadiling.com. (
1255760379
10800
3600
604800
38400 )
159.125.59.in-addr.arpa. IN NS mail1.
74.159.125.59.in-addr.arpa. IN PTR mail.



³Ì«á°õ¦æ¤U¦C«ü¥O­«·s±Ò°Êbind DNSªA°È
À˵ø­ì©lÀɽƻs¨ì°Å¶Kï¦C¦LÃö©ó

1. sudo /etc/init.d/bind9 restat

sudo /etc/init.d/bind9 restat


´N§¹¦¨bind DNS Serverªº¦w¸Ë¤F

°Ñ¦Ò¸ê®Æ¡Ghttps://help.ubuntu.com/9.04/serverguide/C/dns-installation.html
2010/03/22

§@ªÌ: lutuni (2:08 pm)
¦w¸Ë
[½s¿è] ¦p¦ó¦bUbuntu¤W¦w¸ËDNS BIND

§A¥i¥Hª½±µ¦b©R¥O¦C¤W¿é¤J¤U¦C«ü¥O¡G

sudo apt-get install bind


[½s¿è] ¦p¦ó¦bFedora¤W¦w¸ËDNS BIND

§A¥i¥Hª½±µ¦b©R¥O¦C¤W¿é¤J¤U¦C«ü¥O¡G

yum -y install bind

[½s¿è] ¦p¦ó¦bDebian¤W¦w¸ËDNS BIND

§A¥i¥Hª½±µ¦b©R¥O¦C¤W¿é¤J¤U¦C«ü¥O¡G

apt-get install bind9


[½s¿è] ³]©w
[½s¿è] Ubuntuªº³]©w

config ³]©wÀɪº©ñ¸m¸ô®|¦p¤U¡G

/etc/bind/named.conf

[½s¿è] Fedoraªº³]©w

config ³]©wÀɪº©ñ¸m¸ô®|¦p¤U¡G

/var/named/chroot/etc/named.conf

[½s¿è] Debianªº³]©w

config ³]©wÀɪº©ñ¸m¸ô®|¦p¤U¡G

/etc/bind/named.conf

[½s¿è] named.conf Àɮפº®e

named.conf ÀÉ®×¥D­nªº¤º®e¥]§t4­Ó³¡¤À¡A¤À§O¬°:

1.options

2.Ãö©ó .(root) ªº¤º®e

3.Ãö©ó localhost ªº¥¿¤Ï¸Ñ

4.Ãö©ó¨ä¥L domain ªº¥¿¤Ï¸Ñ

¤@­Ó§¹¾ãªº named.conf ªºÀɮצp¤U:

acl internals { 192.168.10.0/24; };
options {
directory "/var/named";
allow-transfer{ 192.168.11.7;
internals;
};
};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." { //.(root) ªº¤º®e
type hint;
file "root.servers";
};
zone "localhost"{ //localhost ªº¥¿¸Ñ
type master;
file "master.localhost";
};
zone "0.0.127.in-addr.arpa"{ //localhost ªº¤Ï¸Ñ
type master;
file "localhost.rev";
};
zone "twnic.com.tw"{ //¨Ï¥ÎªÌdomainªº¥¿¸Ñ
type master;
file "twnic.hosts";
};
zone "10.168.192.in-addr.arpa"{ //¨Ï¥ÎªÌdomainªº¤Ï¸Ñ
type master;
file "twnic.rev";
};

master.localhostÀÉ®×½d¨Ò¦p¤U:

$TTL 86400 ; 24 hours could have been written as 24h
$ORIGIN localhost.
; line below = localhost 1D IN SOA localhost root.localhost
@ 1D IN SOA @ root (
2002022401 ; serial
3H ; refresh
15 ; retry
1w ; expire
3h ; minimum
)
@ 1D IN NS @
1D IN A 127.0.0.1

localhost.revÀÉ®×½d¨Ò¦p¤U:

$TTL 86400 ;
; could use $ORIGIN 0.0.127.IN-ADDR.ARPA.
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
3h ; Refresh
15 ; Retry
1w ; Expire
3h ) ; Minimum
IN NS localhost.
1 IN PTR localhost.

[½s¿è] ¦p¦ó¨Ï¥Î
[½s¿è] ¦p¦ó±Ò°Ê BIND Server

FOR Redhat / Fedora

chkconfig «ü¥O¯àÀ°±z³]©w¦b¶}¾÷®É±Ò°ÊBIND:

chkconfig named on

¦b¶}¾÷«á±Ò°Ê,Ãö³¬,­«·s±Ò°ÊBINDªº«ü¥O¦p¤U:

/etc/init.d/named start
/etc/init.d/named stop
/etc/init.d/named restart


FOR Debian / Ubuntu

sysv-rc-conf «ü¥O¯àÀ°±z³]©w¦b¶}¾÷®É±Ò°ÊBIND:

sysv-rc-conf bind on

¦b¶}¾÷«á±Ò°Ê,Ãö³¬,­«·s±Ò°ÊBINDªº«ü¥O¦p¤U:

/etc/init.d/bind start
/etc/init.d/bind stop
/etc/init.d/bind restart

[½s¿è] ¦p¦ó´ú¸Õ DNS ¬O§_¥¿±`¹B§@

The Host Command

host «ü¥O±µ°Ñ¼Æ¡A¥Î¨Ó¬d¸ß¥¿¤Ï¸Ñ¨ÃÅã¥Ü¥Xµ²ªG¡A¥Îªk¦p¤U

¨Ï¥Î host ¬d¸ß¥¿¸Ñ

host www.linuxhomenetworking.com

¨Ï¥Î host ¬d¸ß¤Ï¸Ñ

host 65.115.71.34

The nslookup Command

nslookup «ü¥O±µ°Ñ¼Æ¡A¥Î¨Ó¬d¸ß¥¿¤Ï¸Ñ¨ÃÅã¥Ü¥Xµ²ªG¡A¥Îªk¦p¤U

¨Ï¥Î nslookup ¬d¸ß¥¿¸Ñ

nslookup www.linuxhomenetworking.com

¨Ï¥Î nslookup ¬d¸ß¤Ï¸Ñ

nslookup 65.115.71.34

[½s¿è] ¦p¦ó³]©w sub-domain

sub-domain ªº©w¸q¬°:

zone (domain) name = example.com
domain host name = bill.example.com
sub-domain name = us.example.com
sub-domain host name = ftp.us.example.com

­Y­n³]©w sub-domain¡A¨ä named.conf ÀÉ¥i°Ñ¦Ò¤U­±ªº³]©w:

// named.conf file fragment
....
options {
....
// stop everyone
allow-transfer {"none";};
....
};
zone "example.com" in{
type master;
file "master/master.example.com";
// explicitly allow slave
allow-transfer {192.168.0.4;};
};

master.example.com ÀÉ¥i°Ñ¦Ò¤U­±ªº³]©w:

; zone fragment for 'zone name' example.com
; name servers in the same zone
$TTL 2d ; zone default TT = 2 days
$ORIGIN example.com.
@ IN SOA ns1.example.com. hostmaster.example.com. (
2003080800 ; serial number
2h ; refresh = 2 hours
15M ; update retry = 15 minutes
3W12h ; expiry = 3 weeks + 12 hours
2h20M ; minimum = 2 hours + 20 minutes
)
; main domain name servers
IN NS ns1.example.com.
IN NS ns2.example.com.
; mail servers for main domain
IN MX 10 mail.example.com.
; A records for name servers above
ns1 IN A 192.168.0.3
ns2 IN A 192.168.0.4
; A record for mail servers above
mail IN A 192.168.0.5
; other domain level hosts and services
bill IN A 192.168.0.6
....
; sub-domain definitions
$ORIGIN us.example.com.
IN MX 10 mail
; record above could have been written as
; us.example.com. IN MX 10 mail.us.example.com.
; A record for subdomain mail server
mail IN A 10.10.0.28
; the record above could have been written as
; mail.us.example.com. A 10.10.0.28 if it's less confusing
ftp IN A 10.10.0.29
; the record above could have been written as
; ftp.us.example.com. A 10.10.0.29 if it's less confusing
....
; other subdomain definitions as required

[½s¿è] ¦p¦ó³]©w forwarding DNS

Forwarding DNS ¥D¾÷¥D­n°µ¬°¤@­Ó¤¤¶¡¶Ç»¼¸ê®Æªº¨¤¦â¡A±N¥Î¤áºÝ©Ò»Ý­n¬d¸ßªº¸ê°TÂà¥æµ¹¨ä¥¦¦Xªkªº DNS ¥D¾÷¥N¬°¬d¸ß¡A¦]¦¹ forwarding DNS ¥»¨­¨Ã¨S¦³´£¨Ñ¥D¾÷¦WºÙ»P IP ¥¿¤Ï¸Ñªº³]©wÀÉ¡C

­n³]©w¤@¥x DNS ¬° forwarding ¡A½Ð½s¿è¥D­n³]©wÀÉ named.conf ¦p¤U:

options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
forward only;
forwarders {
192.168.0.1;
};
};
include "/etc/rndc.key";

¨ä¤¤¦U°Ñ¼Æªº·N¸q:

forward only

«ü¥Ü³o¥x DNS ¥u°µ¬° forwarding DNS¡C

forwarders

³]©w§â§Ú­Ìªº¬d¸ß forward µ¹­þ¥x DNS ¨ÓÀ°§Ú­Ì¥N¬d¡A¥i³]©w¦h¥x forwarders ¡C
2010/03/22

§@ªÌ: lutuni (10:58 am)
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA fluxtek.com. root.www.fluxtek.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS www.fluxtek.com.
225 IN PTR www.fluxtek.com.
225 IN PTR mail.fluxtek.com.
2010/03/22

§@ªÌ: lutuni (12:26 am)
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

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 "163.71.210.in-addr.arpa" {
type master;
file "/etc/bind/db.210.71.163";
};

include "/etc/bind/named.conf.local";
zone "www.fluxtek.com" {
type forward;
forwarders {
210.71.163.225 port 80;
192.168.1.52 port 80;
};
};
2010/03/21

§@ªÌ: lutuni (11:52 pm)
Environment (Àô¹Ò)

Operation-System¡GUbuntu Server 8.041
Deb¡Gbind9 (DNS)

jonny@ubuntu:~$ sudo apt-get install bind9


Hinet ºô°ìµù¥U¡G

DNS Server Name¡Gwww.hjz.com.tw
IP Address¡G122.xxx.xxx.41

DNS Server Name¡Gdns.hjz.com.tw
IP Address¡G122.xxx.xxx.41



Server Configure (¦øªA¾¹³]©w)

1. ¥[¤J¥¿¤Ï¸Ñ³]©w¡Gnamed.conf ·|«ü¥X Server ºÞÁÒªº°Ï°ì(Zone)¦WºÙ¤Î¬ÛÃöÀɮסC©ó include "/etc/bind/named.conf.local"; ¤W¤è¥[¤J¹w·s¼Wªº³]©w

jonny@ubuntu:~$ sudo vi /etc/bind/named.conf
...
//¼W¥[¥¿¸Ñ°Ï°ì(Zone)
zone "hjz.com.tw" {
type master;
file "/etc/bind/db.hjz";
};

//¼W¥[¤Ï¸Ñ°Ï°ì(Zone)
zone "205.117.122.in-addr.arpa" {
type master;
file "/etc/bind/db.205.117.122";
};

include "/etc/bind/named.conf.local";



2. ­×§ï Bind °Ñ¼Æ

1. ³Æ¥÷­ì©l°Ñ¼Æ

jonny@ubuntu:/etc/bind$ sudo cp named.conf.options named.conf.options.bak


2. §ó·s°Ñ¼Æ

jonny@ubuntu:/etc/bind$ sudo vi named,conf.options
options {
directory "/var/cache/bind";
forwarders {
168.95.1.1; 139.175.10.20; 203.133.1.6;
};
allow-query { any; };
allow-transfer { none; };
};



3. «Ø¥ß¥¿¸Ñ°Ï°ì³]©wÀÉ

jonny@ubuntu:/etc/bind$ sudo vi db.hjz
; BIND reverse data file for local loopback interface

$TTL 604800
@ IN SOA hjz.com.tw. dns.hjz.com.tw. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.hjz.com.tw.
@ IN NS www.hjz.com.tw.
@ IN MX 10 122.xxx.xxx.41
@ IN A 122.xxx.xxx.41
www IN A 122.xxx.xxx.41



4. 3. «Ø¥ß¤Ï¸Ñ°Ï°ì³]©wÀÉ

jonny@ubuntu:/etc/bind$ sudo vi db.xxx.xxx.122
; BIND reverse data file for local loopback interface

$TTL 604800
@ IN SOA @ root.dns.hjz.com.tw. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.hjz.com.tw.
@ IN NS www.hjz.com.tw.
41 IN PTR dns.hjz.com.tw.
41 IN PTR www.hjz.com.tw.



5. ­«¶} DNS Server

jonny@ubuntu:~$ sudo /etc/init.d/bind9 restart
[sudo] password for jonny:
* Stopping domain name service... bind [ OK ]
* Starting domain name service... bind [ OK ]
2010/03/21

§@ªÌ: lutuni (11:52 pm)
Environment (Àô¹Ò)

Operation-System¡GUbuntu Server 8.041
Deb¡Gbind9 (DNS)

jonny@ubuntu:~$ sudo apt-get install bind9


Hinet ºô°ìµù¥U¡G

DNS Server Name¡Gwww.etype.idv.tw
IP Address¡G123.204.51.114

DNS Server Name¡Gdns.etype.idv.tw
IP Address¡G123.204.51.114



Server Configure (¦øªA¾¹³]©w)

1. ¥[¤J¥¿¤Ï¸Ñ³]©w¡Gnamed.conf ·|«ü¥X Server ºÞÁÒªº°Ï°ì(Zone)¦WºÙ¤Î¬ÛÃöÀɮסC©ó include "/etc/bind/named.conf.local"; ¤W¤è¥[¤J¹w·s¼Wªº³]©w

jonny@ubuntu:~$ sudo vim /etc/bind/named.conf
...
//¼W¥[¥¿¸Ñ°Ï°ì(Zone)
zone "etype.idv.tw" {
type master;
file "/etc/bind/db.etype";
};

//¼W¥[¤Ï¸Ñ°Ï°ì(Zone)
zone "51.204.123.in-addr.arpa" {
type master;
file "/etc/bind/db.51.204.123";
};

include "/etc/bind/named.conf.local";



2. ­×§ï Bind °Ñ¼Æ

1. ³Æ¥÷­ì©l°Ñ¼Æ

jonny@ubuntu:/etc/bind$ sudo cp named.conf.options named.conf.options.bak


2. §ó·s°Ñ¼Æ

jonny@ubuntu:/etc/bind$ sudo vim named,conf.options
options {
directory "/var/cache/bind";
forwarders {
168.95.1.1; 139.175.10.20; 203.133.1.6;
};
allow-query { any; };
allow-transfer { none; };
};



3. «Ø¥ß¥¿¸Ñ°Ï°ì³]©wÀÉ

jonny@ubuntu:/etc/bind$ sudo vim db.etype
; BIND reverse data file for local loopback interface

$TTL 604800
@ IN SOA etype.idv.tw. dns.etype.idv.tw. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.etype.idv.tw.
@ IN NS www.etype.idv.tw.
@ IN MX 10 123.204.51.114
@ IN A 123.204.51.114
www IN A 123.204.51.114



4. 3. «Ø¥ß¤Ï¸Ñ°Ï°ì³]©wÀÉ

jonny@ubuntu:/etc/bind$ sudo vim db.51.204.123
; BIND reverse data file for local loopback interface

$TTL 604800
@ IN SOA @ root.dns.etype.idv.tw. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.etype.idv.tw.
@ IN NS www.etype.idv.tw.
114 IN PTR dns.etype.idv.tw.
114 IN PTR www.etype.idv.tw.



5. ­«¶} DNS Server

jonny@ubuntu:~$ sudo /etc/init.d/bind9 restart
[sudo] password for jonny:
* Stopping domain name service... bind [ OK ]
* Starting domain name service... bind [ OK ]