Sep 192012
 

DNS 관련일을 하게 되면 자연적으로 도메인과 많은 관련성이 있습니다.

특히 도메인을 이해하기 위해서는 Registry-Registrar 개념과 DNS 위임구조를 알아야 합니다.
도메인의 위임정보를 알기 위해서 WHOIS라는 서비스를 제공하고 있습니다.

아주 오래된 프로토콜로 TCP 43번 포트로 제공하고 있는 프로토콜입니다.
(DNS가 53번이므로 외우기도 쉽습니다.)

해당 프로토콜에 대해서는 영문위키를 보면 금방 이해를 할수 있으며, 간단히 telnet 으로도 확인이 가능합니다.
Socket에서 TCP Client 정도만 제작가능하시면 바로 제작이 가능합니다.

http://en.wikipedia.org/wiki/Whois

이러한 WHOIS 정보는 TLD별로 제공이 되고 있으며, 아래와 같은 규칙을 가지고 있습니다.

whois-servers.net provides DNS alias records (CNAME) for TLD WHOIS servers of the form .whois-servers.net.

[stone@localhost ~]$ telnet com.whois-servers.net 43
Trying 199.7.49.74...
Connected to com.whois-servers.net (199.7.49.74).
Escape character is '^]'.
netpia.com

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

   Domain Name: NETPIA.COM
   Registrar: NETPIA.COM, INC.
   Whois Server: whois.ibi.net
   Referral URL: http://www.ibi.net
   Name Server: NS.NETPIA.COM
   Name Server: NS2.NETPIA.COM
   Status: clientDeleteProhibited
   Status: clientTransferProhibited
   Updated Date: 10-mar-2012
   Creation Date: 01-apr-1998
   Expiration Date: 31-mar-2013

>>> Last update of whois database: Mon, 17 Sep 2012 15:01:00 UTC <<<

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar.  Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability.  VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.Connection closed by foreign host.
[stone@localhost ~]$

보다 확실한 방법은 IP와 주소 정보를 관할하는 IANA의 WHOIS 서버를 통해서 확인을 하면 보다 확실합니다.

The IANA whois server at whois.iana.org provides information on each TLD including the whois server.

[stone@localhost~]$ telnet whois.iana.org 43
Trying 192.0.47.59...
Connected to whois.iana.org (192.0.47.59).
Escape character is '^]'.
kr
% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object

domain:       KR

organisation: Korea Internet & Security Agency (KISA)
address:      12F, Daedong Bldg, 109 Jungdae-ro, Songpa-gu
address:      Seoul  138-950
address:      Korea, Republic Of

contact:      administrative
name:         Kilnam Chon
organisation: Korea Network Information Center (KRNIC)
address:      12F, Daedong Bldg, 109 Jungdae-ro, Songpa-gu
address:      Seoul  138-950
address:      Korea, Republic Of
phone:        +82 10 8581 3514
fax-no:       +82 2 405 5419
e-mail:       chonkn@gmail.com

contact:      technical
name:         Director of Internet Technology Team
organisation: Korea Internet & Security Agency (KISA)
address:      12F, Daedong Bldg
address:      109 Jungdae-ro, Songpa-gu
address:      Seoul 138-950
address:      Korea, Republic Of
phone:        +82 2 405 6470
fax-no:       +82 2 405 5119
e-mail:       techc@kisa.or.kr

nserver:      B.DNS.KR 61.74.75.1
nserver:      C.DNS.KR 203.248.246.220
nserver:      D.DNS.KR 203.83.159.1
nserver:      E.DNS.KR 2001:dcc:5:0:0:0:0:100 202.30.124.100
nserver:      F.DNS.KR 218.38.181.90
nserver:      G.DNS.KR 2001:dc5:a:0:0:0:0:1 202.31.190.1
ds-rdata:     17625 7 2 FB939059F4B67BBA1E8AC37E35811E506488B2D8CFF807AF873B2116B5676B5C

whois:        whois.kr

status:       ACTIVE
remarks:      Registration information: http://www.nic.or.kr/

created:      1986-09-29
changed:      2011-11-23
source:       IANA

Connection closed by foreign host.
[stone@localhost ~]$
Sep 172012
 

DNS는 HTML과 달리 정해진 형식으로 구성된 프로토콜입니다.

워낙 작은 데이타로 값을 요청하고, 응답해야 하기 때문에 나름대로의 규칙이 있습니다.

특히 응답값을 패킷 캡쳐를 해서 보면 재미있는 현상이 있습니다.
실제 결과를 nslookup이나 dig를 통해서 결과를 보면 데이타의 양이 많습니다. 하지만 많은 양에 비해서 패킷의 수치는 그리 많지 않습니다.

이를 처리하는 부분이 도메인 데이타에 대해서 압축(?)을 하는 방법을 사용합니다. 우리가 일반적으로 알고 있는 압축이 아니고, 이미 사용했던 패킷의 데이타를 재사용함으로써 데이타 압축을 한 효과를 내고 있습니다.

RFC에서 DNS 프로토콜에서 데이타 압축 기법에 대한 설명 자료

http://tools.ietf.org/html/rfc1035#section-4.1.4

이러한 기법에 대해서 설명한 자료를 찾지 못해서 RFC와 패킷 캡쳐한 결과로만 알고 있다가 예전에 인터넷으로 검색해서 찾은 자료입니다. 예전같으면 원서라도 구입해서 보겠지만, 요새는 인터넷에서 원서를 공개하고 있어서 원하는 부분만 쉽게 볼수 있어서 좋은것 같습니다.

http://www.tcpipguide.com/free/t_DNSNameNotationandMessageCompressionTechnique.htm

위의 TCP/IP Guide 책을 보면 RFC보다 쉽게 이해가 가능합니다.

하지만 이러한 사실을 눈으로는 쉽게 이해가 되지만, 이를 구현을 하다 보면 여러가지 문제점이 있다는 것을 알수 있습니다.
구현에 대해서는 다음에 다시 한번 정리를 해보도록 하겠습니다.

Plugin from the creators of Brindes :: More at Plulz Wordpress Plugins