-
[CentOS 5.2] DNS 설정 & Hostname 변경Operation System/Linux ( CentOS ) 2009. 7. 2. 16:06
------------------------------------------------------------------------------
hostname 변경
vi /etc/sysconfig/network
Networking = yes
Networking_IPV6= yes
Hostname = [원하는 호스트 주소]
------------------------------------------------------------------------------
Dns Setting
# cat /etc/hosts
# cat /etc/resolv.conf
nameserver 164.124.101.2 -- 데이콤에서 사용하는 nameserver IP
nameserver 168.126.63.1 -- 코넷에서 사용하는 nameserver IP[root@localhost src]# rpm -qa bind | grep bind
bind-9.3.4-10.P1.el5
bind-libs-9.3.4-10.P1.el5
bind-utils--9.3.4-10.P1.el5
ypbind-1.19-11.el5
[root@localhost src]# rpm -qa ypbind*
ypbind-1.19-11.el5
[root@localhost src]# rpm -qa bind|grep bind
bind-9.3.4-10.P1.el5
[root@localhost src]# rpm -qa | grep caching-nameserver
[root@localhost src]# yum -y install caching-nameserver*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
... 중략 ...
Installing : caching-nameserver [1/1]Installed: caching-nameserver.i386 30:9.3.4-10.P1.el5
Complete!
[root@localhost src]# host
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] hostname [server]
-a is equivalent to -v -t *
-c specifies query class for non-IN data
-C compares SOA records on authoritative nameservers
-d is equivalent to -v
-l lists all hosts in a domain, using AXFR
-i IP6.INT reverse lookups
-N changes the number of dots allowed before root lookup is done
-r disables recursive processing
-R specifies number of retries for UDP packets
-t specifies the query type
-T enables TCP/IP mode
-v enables verbose output
-w specifies to wait forever for a reply
-W specifies how long to wait for a reply
-4 use IPv4 query transport only
-6 use IPv6 query transport only
-s a SERVFAIL response should stop query
[root@localhost src]# vi /etc/named.caching-nameserver.conf
//
// named.caching-nameserver.conf
...중략...
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { 127.0.0.1; };
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";// Those options should be used carefully because they disable port
// randomization
query-source port 53;
query-source-v6 port 53;//allow-query { localhost; };
allow-query { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
// match-clients { localhost; };
// match-destinations { localhost; };
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
:wq!
[root@localhost src]# cd /var/named
[root@localhost named]# ls -al
i?ⓒe³? 96
drwxr-x--- 5 root named 4096 7i?” 1 23:42 .
drwxr-xr-x 24 root root 4096 6i?” 15 21:45 ..
drwxr-x--- 5 root named 4096 7i?” 1 23:42 chroot
drwxrwx--- 2 named named 4096 1i?” 21 21:27 data
-rw-r----- 1 root named 198 1i?” 21 21:27 localdomain.zone
-rw-r----- 1 root named 195 1i?” 21 21:27 localhost.zone
-rw-r----- 1 root named 427 1i?” 21 21:27 named.broadcast
-rw-r----- 1 root named 1892 1i?” 21 21:27 named.ca
-rw-r----- 1 root named 424 1i?” 21 21:27 named.ip6.local
-rw-r----- 1 root named 426 1i?” 21 21:27 named.local
-rw-r----- 1 root named 427 1i?” 21 21:27 named.zero
drwxrwx--- 2 named named 4096 1i?” 21 21:27 slaves
[root@localhost log]# /etc/rc.d/init.d/named start
Starting named: [ OK ]
[root@localhost log]# tail /var/named/data/named.run
zone 0.in-addr.arpa/IN/localhost_resolver: loaded serial 42
zone 0.0.127.in-addr.arpa/IN/localhost_resolver: loaded serial 1997022700
zone 255.in-addr.arpa/IN/localhost_resolver: loaded serial 42
zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN/localhost_resolver:loaded serial 1997022700
zone localdomain/IN/localhost_resolver: loaded serial 42
zone localhost/IN/localhost_resolver: loaded serial 42
running
[root@localhost log]# cd /var/named/
[root@localhost named]# ls -al
total 96
drwxr-x--- 5 root named 4096 Jul 2 22:12 .
drwxr-xr-x 20 root root 4096 Jul 2 22:08 ..
drwxr-x--- 5 root named 4096 Jul 2 22:12 chroot
drwxrwx--- 2 named named 4096 Jul 2 22:18 data
-rw-r----- 1 root named 198 Jan 21 21:27 localdomain.zone
-rw-r----- 1 root named 195 Jan 21 21:27 localhost.zone
-rw-r----- 1 root named 427 Jan 21 21:27 named.broadcast
-rw-r----- 1 root named 1892 Jan 21 21:27 named.ca
-rw-r----- 1 root named 424 Jan 21 21:27 named.ip6.local
-rw-r----- 1 root named 426 Jan 21 21:27 named.local
-rw-r----- 1 root named 427 Jan 21 21:27 named.zero
drwxrwx--- 2 named named 4096 Jan 21 21:27 slaves
[root@localhost named]# vi /etc/named.rfc1912.zones
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca";
};zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.local";
allow-update { none; };
};zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};zone "example.co.kr" IN {
type master;
file "example.co.kr.zone";
allow-update { none; };
};
:wq!
[root@localhost named]# cat named.ca; <<>> DiG 9.5.0b2 <<>> +bufsize=1200 +norec NS . @a.root-servers.net
;; global options: printcmd
;; Got answer:
...중략...
;; WHEN: Tue Feb 26 15:05:57 2008
;; MSG SIZE rcvd: 615
[root@localhost named]# lftp ftp.internic.net
lftp ftp.internic.net:~> ls
drwxr-xr-x 2 ftp ftp 4096 Jul 1 00:34 domain
lftp ftp.internic.net:/> cd domain/
cd ok, cwd=/domain
lftp ftp.internic.net:/domain> ls
-rw-r--r-- 1 ftp ftp 457 Jul 2 01:10 INTERNIC_ROOT_ZONE.signatures
-rw-r--r-- 1 ftp ftp 693 Jul 2 01:10 INTERNIC_ROOT_ZONE.signatures.asc
-rw-r--r-- 1 ftp ftp 690 Jul 2 00:52 arpa.zone.gz
...중략...-rw-r--r-- 1 ftp ftp 72 Mar 24 02:11 named.root.sig
-rw-r--r-- 1 ftp ftp 20870 Jul 2 01:10 root.zone.gz
-rw-r--r-- 1 ftp ftp 33 Jul 2 01:10 root.zone.gz.md5
-rw-r--r-- 1 ftp ftp 65 Jul 2 01:10 root.zone.gz.sig
lftp ftp.internic.net:/domain> get named.cache
2941 bytes transferred in 12 seconds (243b/s)
lftp ftp.internic.net:/domain> quit
[root@localhost named]# cat named.cache
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
...중략...
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
M.ROOT-SERVERS.NET. 3600000 AAAA 2001:DC3::35
; End of File
[root@localhost named]# vi named.rev
$TTL 86400
@ IN SOA example.co.kr. example.localhost (
2009070200 ; serial
1H ; Refresh
10M ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS example.co.kr.
162 IN PTR example.co.kr.
:wq!
[root@localhost named]# vi example.co.kr.zone
$TTL 86400
@ IN SOA exma. example.co.kr. (
2009070200 ; serial
1H ; Refresh
10M ; Retry
1W ; Expire
86400 ) ; Minimum
IN NS example.co.kr
IN A 192.168.0.2
IN MX 10 192.168.0.2
NS IN A 192.168.0.24
www IN A 210.93.84.64
mail IN CNAME www
ftp IN CNAME @
* IN CNAME @
:wq!
[root@localhost named]# /etc/rc.d/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@localhost named]# tail /var/log/messages
Jul 3 00:52:08 localhost named[1636]: command channel listening on ::1#953
Jul 3 00:52:08 localhost named[1636]: zone 0.in-addr.arpa/IN/localhost_resolver: loaded serial 42
...중략...
notifies (serial 2009070200)
[root@localhost named]#
-------------------------------------------------------------------------------
CentOS 5.2에서 DNS설정하는 방법에 대해서 알아보았습니다.
적색 부분으로 표시되어 있는 부분은 직접 수정을 해줘야되는 부분이며, 마지막에 named.rev 파일과 example.co.kr.zone 파일을 직접 만들어줘야됩니다.
참고서적 : CentOS 5.2 리눅스 구축관리실무
리눅스 서버관리 실무바이블(下)'Operation System > Linux ( CentOS )' 카테고리의 다른 글
[CentOS 5.2] ProFTP 설정하기 (0) 2009.07.18 [CentOS 5.2] APM Setup (0) 2009.07.03 [ Linux ] Fedora Core 10 .. Virtual PC 2007 sp1 (0) 2009.01.04 [ Linux ] 리눅스 기본 명령어 (0) 2009.01.03 [ Linux ] 실무에서 자주 사용되는 쉘 스크립트 #6 (요일별 차등백업 프로그램) (0) 2009.01.03