DNS DNSDomain Name SystemDomain Name Server Domain Name

  • Slides: 63
Download presentation

DNS 觀念釐清 DNS一詞分為兩個部分,Domain Name System及Domain Name Server,一個 是所為的系統,一個為伺服器 Domain Name System DNS Domain Name

DNS 觀念釐清 DNS一詞分為兩個部分,Domain Name System及Domain Name Server,一個 是所為的系統,一個為伺服器 Domain Name System DNS Domain Name Server 3

DNS基本概念中的關鍵名詞 n 網域Domain n 授權Delegation n 名稱伺服器Name Server n 轄區ZONE 7

DNS基本概念中的關鍵名詞 n 網域Domain n 授權Delegation n 名稱伺服器Name Server n 轄區ZONE 7

頂層網域 n 目前頂層網域的名稱,皆由網際網路網域名稱與位址 管理機構(ICANN, The Internet Corporation for Assigned Names and Numbers)公佈 n ICANN網址:http:

頂層網域 n 目前頂層網域的名稱,皆由網際網路網域名稱與位址 管理機構(ICANN, The Internet Corporation for Assigned Names and Numbers)公佈 n ICANN網址:http: //www. icann. org 17

正向解析(Forward mapping) n Domain Name IP Address q n dns 1. burbur. idv. tw

正向解析(Forward mapping) n Domain Name IP Address q n dns 1. burbur. idv. tw 61. 31. 184. 32 正解析經過root網域來搜尋 例:dns 1 burbur idv tw . n 正向解析中,分為兩種方式遞迴式(Recursive Query) 及反覆式(Iteractive Query) n 遞回式:發生在Client訊問DNS server時 n 交談式:發生在DNS server訊問各層name server 24

網址: dns 1. burbur. idv. tw 代表在burbur. idv. tw機器上name server有 一筆紀錄是dns 1 25

網址: dns 1. burbur. idv. tw 代表在burbur. idv. tw機器上name server有 一筆紀錄是dns 1 25

反向解析(Reverse mapping) n IP Address Domain name q n n 61. 31. 184. 32

反向解析(Reverse mapping) n IP Address Domain name q n n 61. 31. 184. 32 dns 1. burbur. idv. tw 反向解析經過arpa網域來搜訊 搜尋方向 184. 31. 61. in-addr. arpa 27

IP: 61. 31. 184. 32 dns 1. burbur. idv. tw 代表在負責 184. 31. 61.

IP: 61. 31. 184. 32 dns 1. burbur. idv. tw 代表在負責 184. 31. 61. in-addr. arpa sub domain機器上 mapping table有一筆紀錄是 32 ARPA In-addr 61 31 184 32 28

架設DNS的基本條件 n n 了解資源記錄(Resource Records)的義意 以BIND架設DNS伺服器(named daemon) q n n BIND -- Berkeley Internet

架設DNS的基本條件 n n 了解資源記錄(Resource Records)的義意 以BIND架設DNS伺服器(named daemon) q n n BIND -- Berkeley Internet Name Domain 認識 BIND 相關設定檔 註冊Domain Name 30

DNS資源記錄 n n n n SOA 紀錄(SOA record) NS 紀錄(Name Server record) A 紀錄(Address

DNS資源記錄 n n n n SOA 紀錄(SOA record) NS 紀錄(Name Server record) A 紀錄(Address record) PTR 紀錄(Pointer record) CNAME 紀錄(CNAME record) MX紀錄(Mail eXchanger) TXT 紀錄(TEXT Information) HINFO紀錄(Host Information) 31

SOA -- Start Of Authority(Ⅰ) n 起始授權記錄 -- Start Of Authority q q q

SOA -- Start Of Authority(Ⅰ) n 起始授權記錄 -- Start Of Authority q q q 顯示管理該網域的主要DNS伺服器資料 放在zone file一開始的地方 描述這個zone負責的 內容: n n name server version number maintainer資料 以及當slave server要備份這個zone時的一些參數 32

SOA -- Start Of Authority(Ⅱ) 格式: [zone] [ttl] IN SOA origin contact ( Serial

SOA -- Start Of Authority(Ⅱ) 格式: [zone] [ttl] IN SOA origin contact ( Serial 序號 Refresh 更新時間 Retry 重試時間 Expire 保留時間 Time to life 存活時間 ) @ IN SOA dns 1. burbur. idv. tw. 1 ( 56 ; serial 10800 ; refrash 3600 ; retry 604800 ; expire 86400 ) ; minimum zone:網域的名稱 origin:主要名稱伺服器 contact:聯絡人email IN:Internet 其中,第一行的ttl是可以省略的,而Serial、Refresh、 Retry、Expire、Time to life,只是註解,可略,所有的數字 設定必須在()中,除了serial以外,其他數字格式可以使用秒、 分鐘(M)、小時(H)、日(D)、週(W) 33

A -- Address Record n A 紀錄 -- A record q q q 定義某個

A -- Address Record n A 紀錄 -- A record q q q 定義某個 domain name 對應的 IP 格式: [host] [ttl] IN A address n host:主機名稱 n address:主機的IP位址 範例 dns 1 IN A 61. 31. 184. 32 www IN A 61. 31. 184. 21 35

CNAME -- Canonical NAME n CNAME 紀錄 -- CNAME record q q 定義一個別名及其真正對應到的 record

CNAME -- Canonical NAME n CNAME 紀錄 -- CNAME record q q 定義一個別名及其真正對應到的 record 格式 : nickname [ttl] IN CNAME host n n Nickname可以自取 Cname host可以使用對應名稱或FQDN w 1 IN CNAME dns 1. burbur. idv. tw. 36

PTR -- Pointer Record n n DNS 反解檔的資源記錄 PTR 紀錄 -- PTR record q

PTR -- Pointer Record n n DNS 反解檔的資源記錄 PTR 紀錄 -- PTR record q q 定義某個 IP 對應的 domain name 格式 : name [ttl] IN PTR host n name:主機IP位址 n host:主機的FQDN 32 IN PTR dns 1. burbur. idv. tw. 39

DNS安裝(Ⅱ) 安裝方式:rpm –ivh bind-chroot-9. 2. 3 -13. i 386. rpm –ivh caching-nameserver-7. 2 -12

DNS安裝(Ⅱ) 安裝方式:rpm –ivh bind-chroot-9. 2. 3 -13. i 386. rpm –ivh caching-nameserver-7. 2 -12 使用apt安裝:必須先安裝apt套件,參考文件 apt-get install bind-9. 2. 3 -13. i 386. rpm 41

BIND 設定檔 n 啟動檔 q n /etc/named. conf 9. 2. 3版 快取檔 /var/named. ca

BIND 設定檔 n 啟動檔 q n /etc/named. conf 9. 2. 3版 快取檔 /var/named. ca 十三台root主機位址 q /var/named/localhost. zone 本機內部正解 q /var/named. local 本機內部反解 由快取套件caching-nameserver-7. 2 -12產生 q /var/naemd/正解檔 q /var/named/反解檔 q n 路徑檔 q /etc/sysconfig/named 42

啟動檔– named. conf(Ⅰ) // generated by named-bootconf. pl options { directory "/var/named"; forwarders {

啟動檔– named. conf(Ⅰ) // generated by named-bootconf. pl options { directory "/var/named"; forwarders { 168. 95. 192. 1; 211. 78. 215. 137; 140. 137. 12. 11; }; 快取檔案存放路徑, 包含正、反解檔的 存放 本報告中,只說明必要的部分,完整的named. conf可連結此查看或參考 study-area網站 43

啟動檔– named. conf(Ⅱ) zone ". " IN { type hint; file "named. ca"; };

啟動檔– named. conf(Ⅱ) zone ". " IN { type hint; file "named. ca"; }; 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; }; }; 轄區名稱 主機類型 快取檔名稱 44

啟動檔– named. conf(Ⅲ) zone "burbur. idv. tw" IN { type master; file "burbur. zo";

啟動檔– named. conf(Ⅲ) zone "burbur. idv. tw" IN { type master; file "burbur. zo"; allow-update { 127. 0. 0. 1; localhost; 140. 137. 12. 11; 168. 95. 192. 1; 140. 137. 1. 9; }; }; zone "184. 31. 61. in-addr. arpa" IN { type master; file "burbur. re"; allow-update { 127. 0. 0. 1; localhost; 140. 137. 12. 11; 168. 95. 192. 1; 140. 137. 1. 9; }; }; 正解設定 反解設定 45

正解檔sample – burbur. zo $TTL 86400 $ORIGIN burbur. idv. tw. @ IN SOA dns

正解檔sample – burbur. zo $TTL 86400 $ORIGIN burbur. idv. tw. @ IN SOA dns 1. burbur. idv. tw. 1 ( 56 ; serial 10800 ; refrash 3600 ; retry 604800 ; expire 86400 ) ; minimum @ IN NS dns 1. burbur. idv. tw. @ IN MX 10 dns 1. burbur. idv. tw. @ IN A 61. 31. 184. 32 dns 1 IN A 61. 31. 184. 32 w 1 IN CNAME dns 1 mail IN CNAME dns 1 注意: ‧檔名需與啟動檔中 設定的相同。 ‧每次對此有做修正 時serial的數字一 定要向上改 56 57 ‧每一個網址,一定 都要使用FQDN, 也就是後面要多個 “‧” 46

反解檔sample – burbur. re $TTL 86400 @ IN SOA dns 1. burbur. idv. tw.

反解檔sample – burbur. re $TTL 86400 @ IN SOA dns 1. burbur. idv. tw. 1 ( 61 ; serial 7200 ; refresh 1800 ; retry 604800 ; expire 86400 ) ; minimum @ IN NS dns 1. burbur. idv. tw. 32 IN PTR dns 1. burbur. idv. tw. 事實上,反解檔的設定,並不會產生實際的效果,因為要使用反 解,一定得跟上層主機申請,我們的主機裡並沒有in-addr. arpa sub domain網域,我們會在其他討論中再說明! 47

路徑檔-- /etc/sysconfig/named # Currently, you can use the following options: # ROOTDIR="/some/where" -- will

路徑檔-- /etc/sysconfig/named # Currently, you can use the following options: # ROOTDIR="/some/where" -- will run named in a chroot # environment. # you must set up the chroot environment before doing this. # OPTIONS="whatever" -- These additional options will be # passed to named at startup. Don't add -t here, use # ROOTDIR instead. # ROOTDIR=/var/named/chroot ROOTDIR=/ 檔案本身有經過編排,有點不同 原本設定的路徑是在這裡, 也就是說所有的啟動檔、快 取檔,都要放在這個路徑之 下,才可正常啟動BIND 早期的設定路徑,如果不想 要變更路徑,記得加入這一 行 48

Ping(Ⅱ) 正向查詢: Pinging dns 1. burbur. idv. tw [61. 31. 184. 32] with 32

Ping(Ⅱ) 正向查詢: Pinging dns 1. burbur. idv. tw [61. 31. 184. 32] with 32 bytes of data: Reply from 61. 31. 184. 32: bytes=32 time<10 ms TTL=100 反向查詢: Pinging 61 -31 -184 -32. static. tfn. net. tw [61. 31. 184. 32] with 32 bytes of data: Reply from 61. 31. 184. 32: bytes=32 time<10 ms TTL=100 一般查詢: Pinging 61. 31. 184. 32 with 32 bytes of data: Reply from 61. 31. 184. 32: bytes=32 time<10 ms TTL=100 51

nslookup(實例) C: >nslookup Default Server: hntp 1. hinet. net Address: 168. 95. 192. 1

nslookup(實例) C: >nslookup Default Server: hntp 1. hinet. net Address: 168. 95. 192. 1 >? set OPTION - set an option all - print options, current server and host > server dns 1. burbur. idv. tw Default Server: dns 1. burbur. idv. tw Address: 61. 31. 184. 32 > set type=all > ls -d burbur. idv. tw [dns 1. burbur. idv. tw] burbur. idv. tw. SOA dns 1. burbur. idv. tw. (56 1 0800 3600 604800 86400) burbur. idv. tw. NS dns 1. burbur. idv. tw. MX 10 dns 1. burbur. idv. tw 54

Dig、host n Linux專用的主機查訊指令 q q 格式:dig -- help Dig [主機名稱] 格式:host -- help host

Dig、host n Linux專用的主機查訊指令 q q 格式:dig -- help Dig [主機名稱] 格式:host -- help host –t any 55

DNS Client 設定(Ⅰ) n 在LINUX及UNIX下的client端設定 手動設定 /etc/resolv. conf nameserver 61. 31. 184. 32 nameserver

DNS Client 設定(Ⅰ) n 在LINUX及UNIX下的client端設定 手動設定 /etc/resolv. conf nameserver 61. 31. 184. 32 nameserver 140. 137. 12. 11 56

Domain Name之申請與應用(Ⅰ) n 以Hinet為例 58

Domain Name之申請與應用(Ⅰ) n 以Hinet為例 58

Domain Name之申請與應用(Ⅱ) 59

Domain Name之申請與應用(Ⅱ) 59

Domain Name申請資訊(Ⅰ) n 國內 q q n 中華電信:http: //nweb. hinet. net/ PC Home:http: //myname.

Domain Name申請資訊(Ⅰ) n 國內 q q n 中華電信:http: //nweb. hinet. net/ PC Home:http: //myname. pchome. com. tw/ 章魚網:http: //w 3. tacocity. com. tw/idv/apply. htm SEED net:http: //rs. seed. net. tw/ 國外 q q q http: //register. com http: //www. dotster. com http: //www. networksolutions. com 61

Domain Name申請資訊(Ⅱ) n 免費、動態 q q n http: //www. no-ip. com/ http: //www. dns

Domain Name申請資訊(Ⅱ) n 免費、動態 q q n http: //www. no-ip. com/ http: //www. dns 2 go. com/ 使用動態DNS需下載相關的動態DNS軟體 q q No-ip:noip-duc-linux. tar. gz Dns 2 go:dns 2 go-2. 0. tar. gz,相關設定 62

參考資料 n n n 顧問群:中國文化大學資管所 Study-Area:http: //www. study-area. org/menu 2. htm 鳥哥的 Linux 私房菜:http:

參考資料 n n n 顧問群:中國文化大學資管所 Study-Area:http: //www. study-area. org/menu 2. htm 鳥哥的 Linux 私房菜:http: //linux. vbird. org/ 成功大學:http: //turtle. ee. ncku. edu. tw/~tung/dnsintro. html DNS 2 GO:www. dns 2 go. com NO-IP:http: //www. no-ip. com/ 63