1 / 51

網域名稱服務

網域名稱服務. YZU DNS Setting. ADSL. TANET. router. DNS server. 140.138.2.104. 140.138.2.107. 140.138.2.109. mech DNS. eed DNS. 140.138.138.250. 140.138.136.250. 位址與名稱. 兩種方式來表達主機的位址 IP 位址 telnet l40.113.214.163 http://l92.168.16.200 ftp://192.168.16.24

temple
Download Presentation

網域名稱服務

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 網域名稱服務

  2. YZU DNS Setting ADSL TANET router DNS server 140.138.2.104 140.138.2.107 140.138.2.109 mech DNS eed DNS 140.138.138.250 140.138.136.250

  3. 位址與名稱 • 兩種方式來表達主機的位址 • IP 位址 • telnet l40.113.214.163 • http://l92.168.16.200 • ftp://192.168.16.24 • 領域名稱(Domain Name) • telnet birdnest.twbbs.org • http://www.kimo.com • ftp://freebsd.csie.nctu.edu.tw

  4. 網域名稱(Domain Name) • Domain Name 必須向網路資訊中心(NIC)登記註冊,得到唯一的、合法授權的domain suffix。 • NIC 將註冊網域名稱委託給 Network Solution 公司 • 組織內的管理者便可以依照部門的特性來建立各主機名稱與 IP 位址之間的對應關係。

  5. 台灣網際網路資訊中心(TWNIC) • TWNIC(http://www.twinc.net.tw)負責 • 網域名稱制定與註冊 • IP address 申請與分配(又轉包給其他公司) • DNS 的維護 • 中文網址 • 美國公司 VeriSign 接受中文、日文及韓文的網址申請 • 中國網際網路資訊中心(NNIC)的控告

  6. 網域的階層架構 root yzu mech eed

  7. 領域(Domain) • DNS:樹狀組織的形態 • 領域(Domain):樹狀圖上的一個子樹 • magi.rd.hgiga.com 這台機器,隸屬於rd.hgiga.com 領域及 hgiga.com領域。

  8. Domain Name Space • Internet 網域名稱與位址管理機構(ICANN)將網址分成 3 sections: • Generic Domains • Country Domains • Inverse Domains root Inverse domain generic domain country domain

  9. 根領域 (Root Domain)

  10. 新增網域名稱 • 2000年11月,Internet 網域名稱與位址管理機構(ICANN)宣佈增加7個網域名稱: • .info:一般資訊 • .biz:商業機構 • .name:個人登錄 • .pro:專業人士或機構 • .museum:博物館 • .coop:合作機構 • .aero:航空業界

  11. Country Code • au Australia • ca Canada • cn Mainland China • de Germany • fr France • jp Japan • nz New Zealand • tw Taiwan • uk United Kingdom

  12. Inverse Domains root Inverse domain Search the domain name of 132.34.45.121 arpa in-addr 132 34 45 Index to names 121 121.45.34.132.in-addr.arpa.

  13. 以領域為管理單位的問題

  14. 圖2-3 網域(zone) • magi.rd.hgiga.com 隸屬 rd.hgiga.com 網域,但不隸屬於 hgiga.com 網域。

  15. Graphical representation • walnut.candy.foobar.com

  16. 分割領域的範例

  17. 領域名稱的轉換 • 網際網路中所有資料的傳遞都是以 IP 位址的方式在傳遞 • 必須把領域名稱轉換成 IP 位址 • 主機表 • 網域名稱服務

  18. 主機表(Host Table) • IP 位址與主機名稱的對照表 • UNIX 在 /etc/hosts 檔案中 • 系統中最好有一主機表,包含 local host、gateway、servers資料,當 DNS 不work時,就可使用主機表。

  19. 名稱伺服器 (DNS) • 提供一個供 Domain Name 和 IP 位址互相轉換的伺服器。 • 正查:將領域名稱傳給DNS,它會回傳該 Domain Name 的 IP 位址。 • 反查:將IP 位址轉為該 IP 位址的領域名稱。 • 任何的正反查請求,DNS會先在自己的Database尋找,若找不到則會詢問根伺服器。

  20. 取得magi.rd.hgiga.com IP的過程

  21. 網域名稱服務的優點 • 分散式架構、擴充性佳 • 自動傳送最新資訊

  22. 網域的分類 • 從 DNS Server 的扮演的角色來看,Zone 可分為 • 主權網域(Master Zone) • 代理網域(Slave Zone) • 託管網域(Stub Zone) • 轉送網域(Forward Zone)

  23. 主權網域(Master Zone) • 擁有直接管轄權的網域。 • 有權改變本網域中任何機器的domain name的相關資料。

  24. 代理網域(Slave Zone) • 能夠提供網域所有相關 DNS 資訊及服務。 • 無權對代理網域內任何資料做更動。 • “資料過期時間”到了之後,DNS 必需再度更新所代理的網域資料。 • 管理此 Slave Zone 的 DNS Sever 可以不是在主權網域的上層網域的授權名單中。

  25. 託管網域(Stub Zone) • 上層網域 (hgiga.com) 將子網域(rd.hgiga.com) 託管給子網域的DNS(210.241.239.250),故稱之託管網域。 • 上層網域的 DNS 會反過來,定時向此 DNS 索取相關資訊。 • 上層網域 DNS 給予託管網域 DNS 最大的自主權。 • 除了要更改託管網域的 DNS IP 外,託管網域其它更動,將不用手動對上層網域的 DNS 進行更改。

  26. 轉送(Forward)網域 • 如果你不想增加你伺服器的負擔,你可以將不屬於你的主權網域、代理網域和託管網域的資料,轉送到另外一個網域伺服器去查詢。此 DNS 稱為轉送(Forward) 網域。

  27. BIND名稱伺服器 • UNIX 的名稱服務:BIND名稱伺服器軟體(Berkely Internet Name Domain) • 主從式架構(Client/Server Architecture) • BIND 同時提供用戶端與伺服器端的軟體 • 名稱求解器(resolver code):為 client 端,形成向 DNS 發出“詢問”的軟體程式庫,可以連結到任何需要查址的程式。 • 名稱伺服器(Name Server):為 server 端,回答“詢問”的行程(process),稱為named

  28. 4 種層級的名稱伺服器 • Primary(第一順位)Server:具權威性 • Second(第二順位)Server:定期從 Primary Server 複製資料 • Cache-only(旁觀)Server:只是將經手的資料,保存在快取資料庫( cache )中 • resolver-only System:只提供 resolver 函式庫,不執行 named • 管理者設定 named.boot 決定host的屬性與資訊來源

  29. 轄區檔(Zone File) • 存放網域資料的網域資料庫,稱為轄區檔(Zone File)。 • 最原始的 Zone File 位於 Primary Server。 • 在 RFC 1033 定義建立 Zone File 的標準記錄格式(Standard Resource Record),簡稱為RRs。 • 除了 named.boot 外,其他檔案都是以 RRs 方式呈現。

  30. 快取資料庫(Cache) • 所有 DNS A 有經手過的各網域的 DNS 的 IP,及主機的 IP,都會被暫時保留在 DNS A 的快取資料庫( cache )中,直到該筆資料的 “資料更新時間( TTL )” 到期為止,才會從資料庫中刪除。

  31. DNS Messages • DNS has two type of messages: • Query:Client → Server • Header+Question section • Response:Server → Client • Header+Question +Answer +Authoritative+Additional • Two messages has the same format. Header Question section Answer section Authoritative section Additional section

  32. Header Identification (16 bits) Flags (16 bits) Number of question records Number of answer recodes Number of authoritative records Number of additional records Flag 0 1 5 6 7 8 9 10 11 12 15 QR Opcode AA TC RD RA Z AD CD rCode QR=0: query, QR=1: response Opcode=0: standard, Opcode=1: inverse, Opcode=2: server status request

  33. Flags • AA=1: authoritative answer (for response) • TC=1: truncated to 512 bytes (for UDP) • RD=1: recursive desired (set by query) • RA=1: recursive avalilable (for response) • AD=1: authenticated data • CD: checking disable • rCode: status of error in response

  34. Question Record Format Query name Query Type Query Class Query name format 5 a d m i n 3 a t c 4 f h d a 3 e d u 0 Query Type: 詢問 RR 中那一筆 Resource Data (ex: A, PTR,Mx,NS) Query Class=1: Internet (目前只用此設定)

  35. Question Type Type Mnemonic Description 1 A Domain name →IPv4 Address. 2 NS Name Server. Find the authoritative name server for the zone. 12 PTR Pointer. IP → domain name. • MX Mail Exchange. Find the mail server of the zone. 255 ANY A request for all records.

  36. Other Sections • Answer Section:a list of resource record • Authoritative Section: the information of (1 or more) authoritative servers • Additional Information Section: other response message, ex: IP of authoritative server

  37. Resource Record Format Domain name Domain Type Domain Class TTL (Time to Live) Resource data length Resource Data

  38. 設定 resolver • 提供 process 呼叫的函式庫 • 設定 /etc/resolv.conf 組態檔,供 process讀取 • domain:若要搜尋的主機名稱之後沒有(.),則可加上此設定預設的網域名稱。若搜尋不到,則會往上一層的網域尋找。 • nameserver:設定 reslover 可詢問的名稱伺服器的 IP Address。一般有 3 個 BIND 可依序查詢 • search:若要搜尋的主機名稱之後沒有(.),則可加上此設定預設的網域名稱。但只搜尋此明確指定的網域,不會再往上一層。

  39. resolver-only 的例子(1) (在 ms.chinmin.edu.tw) $ cat /etc/resolv.conf domain chinmin.edu.tw nameserver 140.126.111.1 nameserver 140.113.1.1 nameserver 140.126.111.2

  40. resolver-only的例子(2) (在 mail.mis.chinmin.edu.tw) # cat /etc/resolv.conf domain mis.chinmin.edu.tw nameserver 140.126.155.35 nameserver 140.126.111.1 nameserver 140.126.111.2

  41. DNS Server 的例子 (在 dns2.chinmin.edu.tw) # cat /etc/resolv.conf domain chinmin.edu.tw search localdomain nameserver 140.126.111.1 nameserver 140.126.111.2

  42. named 的組態檔 • named.boot:設定named的一般參數,並指出該伺服器的網域資料庫之資訊來源。 • named.ca:指到root網域資料庫。 • named.local:用來轉換當地的loopback位址。 • named.hosts:將主機名稱對映成IP位址的轄區檔(zone file)。 • named.rev:反向網域的轄區檔,可以把IP位址對映成主機名稱。

  43. 設定 4 種層級 DNS 的比較 網域轄區檔named.hosts 反向網域轄區檔named.rev 啟動檔named.boot 快取檔named.ca lookback位址檔name.local 設定/etc/resolv.conf Primary       從Primary 下載 從Primar 下載 Secondary       Cache-only   通常都會有 Resolver-only 

  44. 善用 nslookup • BIND 的一個軟體除錯工具 • 直接查詢 Name Server 的資源記錄 • 設定成直接向某一 DNS Server 發出詢問 • 取得一個網域的資料存入檔案中

  45. 利用 nslookup 的例子(1)(在 mail.mis.chinmin.edu.tw) # nslookup ms.chinmin.edu.tw Server: pro1.mis.chinmin.edu.tw Address: 140.126.155.35 Non-authoritative answer: Name: ms.chinmin.edu.tw Address: 140.126.111.3

  46. 利用 nslookup 的例子(2)(在 mail.mis.chinmin.edu.tw) # nslookup Default Server: pro1.mis.chinmin.edu.tw Address: 140.126.155.35 > ms.chinmin.edu.tw Server: pro1.mis.chinmin.edu.tw Address: 140.126.155.35 Non-authoritative answer: Name: ms.chinmin.edu.tw Address: 140.126.111.3 > exit

  47. 利用 nslookup 的例子(3)(在 mail.mis.chinmin.edu.tw) > set type=MX > ms.chinmin.edu.tw Server: pro1.mis.chinmin.edu.tw Address: 140.126.155.35 Non-authoritative answer: ms.chinmin.edu.tw preference = 10, mail exchanger = ms.chinmin.edu.tw Authoritative answers can be found from: ms.chinmin.edu.tw internet address = 140.126.111.3

  48. 利用 nslookup 的例子(4)(在 mail.mis.chinmin.edu.tw) > set type=NS > chinmin.edu.tw Server: pro1.mis.chinmin.edu.tw Address: 140.126.155.35 Non-authoritative answer: chinmin.edu.tw nameserver = dns.chinmin.edu.tw chinmin.edu.tw nameserver = dns2.chinmin.edu.tw Authoritative answers can be found from: dns.chinmin.edu.tw internet address = 140.126.111.1 dns2.chinmin.edu.tw internet address = 140.126.111.2

  49. 利用 nslookup 的例子(5)(在 mail.mis.chinmin.edu.tw) > server dns.chinmin.edu.tw Default Server: dns.chinmin.edu.tw Address: 140.126.111.1 > set type=any > ms.chinmin.edu.tw Server: dns.chinmin.edu.tw Address: 140.126.111.1 ms.chinmin.edu.tw preference = 10, mail exchanger = ms.chinmin.edu.tw ms.chinmin.edu.tw internet address = 140.126.111.3 chinmin.edu.tw nameserver = dns.chinmin.edu.tw chinmin.edu.tw nameserver = dns2.chinmin.edu.tw ms.chinmin.edu.tw internet address = 140.126.111.3 dns.chinmin.edu.tw internet address = 140.126.111.1 dns2.chinmin.edu.tw internet address = 140.126.111.2

  50. 利用 nslookup 的例子(6)(在 mail.mis.chinmin.edu.tw) > ls chinmin.edu.tw > chinmin.file [dns.chinmin.edu.tw] Received 42 answers (25 records). > exit # cat chinmin.file > ls chinmin.edu.tw [dns.chinmin.edu.tw] $ORIGIN chinmin.edu.tw. ms1 12H IN A 140.126.111.4 ms2 12H IN A 140.126.111.7 dns2 12H IN A 140.126.111.2 dns 12H IN A 140.126.111.1 ms 12H IN A 140.126.111.3 ... ...

More Related