What is DNS ? Domain Name System or Domain Name Service
=================================================
- DNS 最容易理解的說法是: 負責將好記的網域名稱翻譯成IP位址
- 一般而言, 如果想要上網到某個網頁, 通常會輸入名稱而不會輸入該網頁的IP位址
- 假設要瀏覽台灣大學的網頁
- 輸入: www.ntu.edu.tw 而不會輸入 140.112.8.116
- 如何查找 www.ntu.edu.tw 的 IP address ?
- 可以使用 nslookup 指令
- 假設要瀏覽台灣大學的網頁
- 完整網域名稱 (Full Qualified Domain Name, FQDN)
- FQDN: [主機名稱] + [網域名稱] + [.]
- DNS Record Type
- DNS SRV Record
- 查詢指定服務的地址
- DNS SRV 除了紀錄伺服器的地址, 還記錄了 Port
- DNS SRV 還可以設定每個 Server address 的優先順序和權重
- 根據優先順序及權重, 選取發出 DNS Query 的目標 Server address
- 如圖: 可以設定 Priority: 1 Weight: 100 (Priority:小 →大; Weight: 大 → 小)
- DNS SRV Record
- DNS A Record Type
- A 表示 IPv4 Address
- AAAA 表示 IPv6 address
- 用途為 IP address 查閱: 將網域名稱匹配到 IPv4 address
- 範例:
- 常用的 DNS Server: bind9
- 使用自定義的檔案
- 先修改 named.conf.local
- 使用自定義的檔案
- 重新啟動 bind9 server
root@arcadyanubuntu:/etc/bind# /etc/init.d/bind9 restart
root@arcadyanubuntu:/etc/bind# sudo systemctl restart bind9
root@arcadyanubuntu:/etc/bind# cat voip.arcadyan.com
;
; BIND reverse data file for broadcast zone
;
$TTL 14400
@ IN SOA voip.arcadyan.com. arcadyan.com. (
1 ; Serial
3600 ; Refresh
86400 ; Retry
2419200 ; Expire
14400 ) ; Negative Cache TTL
;
@ IN NS voip.arcadyan.com.
;voip IN A 192.168.88.11
;voip IN A 192.168.200.223
;voip IN A 192.168.214.168
;voip IN A 10.118.22.218
;voip IN A 5.6.5.6
;voip IN A 172.17.21.9
;voip IN A 192.168.88.112
;voip IN A 10.10.101.135
voip IN A 172.16.1.1
;voip IN A 7.8.9.10
;test IN A 172.16.1.188
test IN A 2.4.6.8
;voip1 IN A 172.16.232.1
;eit IN A 172.16.132.1
;test IN A 172.16.111.1
;test1 IN A 3.5.7.9
;voip IN AAAA 2001:470:23:ed9::2
;voip IN AAAA 3001:200:0:10::23
;_sips._tcp.voip.arcadyan.com. IN SRV 1 50 5061 voip.arcadyan.com.
;_sips._tcp.ys.dnssrv.test. IN SRV 1 0 5061 voip.arcadyan.com.
;_sips._tcp.voip.arcadyan.com. IN SRV 1 100 5061 test.arcadyan.com.
;_sip._udp.voip.arcadyan.com. IN SRV 2 0 5060 voip.arcadyan.com.
;_sip._udp.voip.arcadyan.com. IN SRV 1 50 5060 test.arcadyan.com.
;_sip._tcp.voip.arcadyan.com. IN SRV 1 0 5060 voip.arcadyan.com.
;DNS_SRV_Testing
_sip._udp.voip.arcadyan.com. IN SRV 2 100 5060 voip.arcadyan.com.
;_sip._udp.one.arcadyan.com. IN SRV 2 50 5060 voip.arcadyan.com.
_sip._udp.voip.arcadyan.com. IN SRV 1 50 5060 test.arcadyan.com.
;_sip._udp.voip.arcadyan.com. IN SRV 1 100 5068 test1.arcadyan.com.
;_sip._udp.voip.arcadyan.com. IN SRV 4 0 5060 voip.arcadyan.com.
;_sip._udp.voip1.arcadyan.com. IN SRV 1 0 5065 voip1.arcadyan.com.
;_sip._udp.voip.arcadyan.com. IN SRV 1 0 5065 voip1.arcadyan.com.
;_sip._udp.voip.arcadyan.com. IN SRV 1 50 5066 voip.arcadyan.com.
naptr.arcadyan.com. NAPTR 10 100 "S" "SIP+D2T" "" _sip._tcp.voip.arcadyan.com.
naptr.arcadyan.com. NAPTR 20 200 "S" "SIP+D2U" "" _sip._udp.voip.arcadyan.com.
naptr.arcadyan.com. NAPTR 30 300 "S" "SIPS+D2T" "" _sips._tcp.voip.arcadyan.com.
root@arcadyanubuntu:/etc/bind# cat named.conf.local
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "arcadyan.com" {
type master;
file "/etc/bind/voip.arcadyan.com";
};
root@arcadyanubuntu:/etc/bind#