DNS 管理者
該知道的
正反解資料檔
1-
正解, 主要有
甲、機器名稱 對應到 IP, 因為有 ipv4 及 ipv6, 同一個機器名稱要分別對
ipv4 , ipv6 各寫一次,
格式上 ipv4 寫成 名稱 in A ipv4 ;
ipv6 寫成 名稱 in AAAA ipv6
例如
dns.chjh.ntpc.edu.tw. in A 163.20.30.1
dns.chjh.ntpc.edu.tw. in AAAA 2001:288:2242:5::1
** 上面沒寫錯喔. 在 dns.chjh.ntpc.edu.tw 後面真的有個 句點.**
** 如果最後不加句點. , 內定會把網域名稱加在後面; 也就是
**簡寫法是 dns in A 163.20.30.1
**完整版就是 dns.chjh.ntpc.edu.tw. in A 163.20.30.1
格式上 ipv4 寫成 名稱 in A ipv4 ;
ipv6 寫成 名稱 in AAAA ipv6
例如
dns.chjh.ntpc.edu.tw. in A 163.20.30.1
dns.chjh.ntpc.edu.tw. in AAAA 2001:288:2242:5::1
** 上面沒寫錯喔. 在 dns.chjh.ntpc.edu.tw 後面真的有個 句點.**
** 如果最後不加句點. , 內定會把網域名稱加在後面; 也就是
**簡寫法是 dns in A 163.20.30.1
**完整版就是 dns.chjh.ntpc.edu.tw. in A 163.20.30.1
乙、別名,cname , 同一個 IP 給予不同名字, 主要名字用 A , 次要名次則是用 CNAME
, 例如, DNS 那台機器, 其 IP 是 163.20.30.1
, 但因為又同時要給它幼兒園的
KIDS 作別名. 所以寫成
dns.chjh.ntpc.edu.tw. in A 163.20.30.1
kids.chjh.ntpc.edu.tw. in CNAME dns.chjh.ntpc.edu.tw.
別名可以用在 apache httpd 網站程式上, 設定
dns.chjh.ntpc.edu.tw. in A 163.20.30.1
kids.chjh.ntpc.edu.tw. in CNAME dns.chjh.ntpc.edu.tw.
別名可以用在 apache httpd 網站程式上, 設定
i.
由主名稱 dns進來時, 取A資料夾內容作網頁,
ii.
設定由
別名 kids進來時, 取B資料夾作網頁內容.
這樣就可以用一部電腦硬體配合 DNS 的設定, 卻作出似乎兩台電腦的情形.
丙、郵件交換主機, MX , 電子郵件一定要玩合 DNS 系統的完整建立, 包含有
(1)用 MX 記錄, 將要收信的網域名稱, 就是@之後的那部份 指令某個名稱, 例如想用 XX@chjh.ntpc.edu.tw 收信, 實際收信由 dns.chjh.ntpc.edu.tw 處理, 則寫成
chjh.ntpc.edu.tw. in MX dns.chjh.ntpc.edu.tw.
(2) 正解 及 反解 都需要: 這樣才能確認連線的對方(不論是要寄信出去或進來時), 對方的真實 IP 與其名稱;
(1)用 MX 記錄, 將要收信的網域名稱, 就是@之後的那部份 指令某個名稱, 例如想用 XX@chjh.ntpc.edu.tw 收信, 實際收信由 dns.chjh.ntpc.edu.tw 處理, 則寫成
chjh.ntpc.edu.tw. in MX dns.chjh.ntpc.edu.tw.
(2) 正解 及 反解 都需要: 這樣才能確認連線的對方(不論是要寄信出去或進來時), 對方的真實 IP 與其名稱;
丁、負則處理 DNS名稱伺服器的機器名稱
例如漳和(chjh.ntpc.edu.tw)早期的 DNS系統自己管理, 主要DNS資料在 dns.chjh.ntpc.edu.tw , 其IP是 163.20.30.1 , 備援的是 ftp.chjh.ntpc.edu.tw , 其 IP 是 163.20.30.2 , 那就要寫成
dns.chjh.ntpc.edu.tw. in A 163.20.30.1
ftp.chjh.ntpc.edu.tw. in A 163.20.30.2
chjh.ntpc.edu.tw. in NS dns.chjh.ntpc.edu.tw.
chjh.ntpc.edu.tw. in NS ftp.chjh.ntpc.edu.tw.
在DNS名稱查詢是一層一層查下來, 如果 DNS 由校內自行管理 , 在漳和的上一層, 也就是教網那裡也是要寫上相類似的資料, 才能指示查詢轉到漳和的 DNS 負責IP 來查詢.
例如漳和(chjh.ntpc.edu.tw)早期的 DNS系統自己管理, 主要DNS資料在 dns.chjh.ntpc.edu.tw , 其IP是 163.20.30.1 , 備援的是 ftp.chjh.ntpc.edu.tw , 其 IP 是 163.20.30.2 , 那就要寫成
dns.chjh.ntpc.edu.tw. in A 163.20.30.1
ftp.chjh.ntpc.edu.tw. in A 163.20.30.2
chjh.ntpc.edu.tw. in NS dns.chjh.ntpc.edu.tw.
chjh.ntpc.edu.tw. in NS ftp.chjh.ntpc.edu.tw.
在DNS名稱查詢是一層一層查下來, 如果 DNS 由校內自行管理 , 在漳和的上一層, 也就是教網那裡也是要寫上相類似的資料, 才能指示查詢轉到漳和的 DNS 負責IP 來查詢.
2-
反解檔, 反解檔相對比較簡單, 只有 2 種
甲、 將 IP 對應到 名稱, 因為有 ipv4 及 ipv6, 兩種各有一個檔,例如
ipv4 反解檔中
163.20.30.1 in PTR dns.chjh.ntpc.edu.tw.
ipv6 反解檔中
2001:288:2242:5::1 in PTR dns.chjh.ntpc.edu.tw.
ipv4 反解檔中
163.20.30.1 in PTR dns.chjh.ntpc.edu.tw.
ipv6 反解檔中
2001:288:2242:5::1 in PTR dns.chjh.ntpc.edu.tw.
乙、負則處理 DNS名稱伺服器的機器名稱, 例如
chjh.ntpc.edu.tw in NS dns.chjh.ntpc.edu.tw.
chjh.ntpc.edu.tw in NS dns.chjh.ntpc.edu.tw.
丙、別名, 郵件 不會出現在 反解檔中.
3-
重點在於 ,
甲、正解 與 反解的 機器名稱與 IP 要互相正確, 例如 在正解檔中, dns 的 IP 是 1 , 那 反解檔中 1 就要對到 dns.
乙、特別是郵件部份, 因為新的郵件系統在接到別人來投寄信件時, 會藉 DNS 系統, 作正反查, 以確定來作郵件交換的對方, 其 IP 與 名稱是否相符, 這樣才不會出現偽造他人名稱的假信件.
4-
查詢應用
甲、查詢使用 nslookup 指令
乙、C:\>nslookup /?
使用方式:
nslookup [-opt ...] # 使用預設伺服器的互動模式
nslookup [-opt ...] - server # 使用 'server' 的互動模式
nslookup [-opt ...] host # 只查閱使用預設伺服器的 'host'
nslookup [-opt ...] host server # 只查閱使用 'server'
的 'host'
實際進入程式後,
C:\>nslookup
預設伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
輸入 ? 就會出現完整說明
> ?
命令: (識別元會以大寫字元顯示,[]
表示選用)
NAME - 列印使用預設伺服器之主機/網域 NAME 的資訊
NAME1 NAME2 - 與上述相同,但使用 NAME2 做為伺服器
help 或 ? - 列印常用命令的資訊
set OPTION - 設定選項
all - 列印選項 (目前伺服器及主機)
[no]debug - 列印偵錯資訊
[no]d2 - 列印詳盡的偵錯資訊
[no]defname - 將網域名稱附加到每個查詢
[no]recurse - 要求遞迴回答查詢
[no]search - 使用網域搜尋清單
[no]vc - 一律使用虛擬電路
domain=NAME - 將預設網域名稱設定為 NAME
srchlist=N1[/N2/.../N6] - 將網域設定為 N1,而將搜尋清單設定為 N1、N2 等
root=NAME -將根伺服器設定為 NAME
retry=X -將重試次數設定為 X
timeout=X - 將初始逾時間隔設定為 X 秒
type=X - 設定查詢類型
(例如 A,AAAA, A+AAAA, ANY, CNAME, MX, NS, PTR, SOA, SRV)
(例如 A,AAAA, A+AAAA, ANY, CNAME, MX, NS, PTR, SOA, SRV)
querytype=X - 與 type 相同
class=X - 設定查詢類別 (例如 IN
(Internet), ANY)
[no]msxfr - 使用 MS 快速區域轉送
ixfrver=X - 用於 IXFR 轉送要求的目前版本
server NAME - 使用目前的預設伺服器,將預設伺服器設定為 NAME
lserver NAME - 使用初始伺服器,將預設伺服器設定為 NAME
root - 將目前預設伺服器設定為根伺服器
ls [opt] DOMAIN [> FILE] - 列出 DOMAIN 中的位址 (選用: 輸出至 FILE)
-a - 列出正式名稱及別名
-d - 列出所有記錄
-t TYPE - 列出所給定 RFC 記錄類型的記錄
(例如 A, CNAME,MX,NS,PTR 等)
(例如 A, CNAME,MX,NS,PTR 等)
view FILE - 排序 'ls' 輸出檔並使用 pg 予以檢視
exit - 結束程式
## 用網卡內定 dns IP 查 “dns.hinet.net”
C:\>nslookup dns.hinet.net
伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
名稱: dns.hinet.net
Addresses:
2001:b000:168::2
168.95.1.1
--------------------------------------
## 用網卡內定 dns IP 查 hinet.net.的 DNS負責機器,
C:\>nslookup -type=NS hinet.net
伺服器:
google-public-dns-a.google.com
Address: 8.8.8.8
未經授權的回答:
hinet.net nameserver = ans2.hinet.net
hinet.net nameserver = ans1.hinet.net
## 查 ans1.hinet.net 的 IP
C:\>nslookup ans1.hinet.net
伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
名稱: ans1.hinet.net
Addresses:
2001:b000:168::1:100:1
168.95.192.15
### 查 ans2.hinet.net 的 IP
C:\>nslookup ans2.hinet.net
伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
名稱: ans2.hinet.net
Addresses:
2001:b000:168::2:100:1
168.95.1.15
==
C:\>nslookup www.chjh.ntpc.edu.tw
伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
名稱: www.chjh.ntpc.edu.tw
Addresses:
2001:288:2242:5::5
163.20.30.5
C:\>nslookup www.chjh.ntpc.edu.tw
168.95.1.1
伺服器: dns.hinet.net
Address:
168.95.1.1
未經授權的回答:
名稱: www.chjh.ntpc.edu.tw
Addresses:
2001:288:2242:5::5
163.20.30.5
##藉 168.95.1.1 查 163.20.30.5
C:\>nslookup 163.20.30.5 168.95.1.1
伺服器: dns.hinet.net
Address:
168.95.1.1
DNS request timed out.
timeout was 2 seconds.
*** 對 dns.hinet.net 的要求逾時
## 藉內定 DNS IP 查 163.20.30.5
C:\>nslookup 163.20.30.5
伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
DNS request timed out.
timeout was 2 seconds.
*** 對
google-public-dns-a.google.com 的要求逾時
## 藉內定DNS IP 查 chjh.ntpc.edu.tw 的 DNS負責機器是誰?
C:\>nslookup -type=ns chjh.ntpc.edu.tw
伺服器: google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
chjh.ntpc.edu.tw nameserver = dns1.ntpc.edu.tw
chjh.ntpc.edu.tw nameserver = dns3.ntpc.edu.tw
chjh.ntpc.edu.tw nameserver = dns4.ntpc.edu.tw
chjh.ntpc.edu.tw nameserver = dns2.ntpc.edu.tw
^^^ 由上可知為代管
## 查 dns1.ntpc.edu.tw 的 IP
C:\>nslookup dns1.ntpc.edu.tw
伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
名稱: dns1.ntpc.edu.tw
Addresses:
2001:288:2200:121::1
203.72.153.1
C:\>nslookup www.chjh.ntpc.edu.tw
dns1.ntpc.edu.tw
伺服器: UnKnown
Address:
203.72.153.1
名稱: www.chjh.ntpc.edu.tw
Addresses:
2001:288:2242:5::5
163.20.30.5
^^上面出現 IPV4 及 IPV6
## 藉 dns1.ntpc.edu.tw 查 163.20.30.5 的名稱
C:\>nslookup 163.20.30.5
dns1.ntpc.edu.tw
伺服器: UnKnown
Address:
203.72.153.1
名稱: www.chjh.ntpc.edu.tw
Address:
163.20.30.5
^^ 以上 IPV4 的正反解相同
##藉 dns1.ntpc.edu.tw 查 2001:288:2242:5::5 的名稱
C:\>nslookup 2001:288:2242:5::5
dns1.ntpc.edu.tw
伺服器: UnKnown
Address:
203.72.153.1
名稱: www.chjh.ntpc.edu.tw
Address:
2001:288:2242:5::5
^^ 以上 IPV6 正反解相同.
==
## 查詢 chjh.ntpc.edu.tw 的郵件 MX 相關資料
C:\>nslookup -type=MX
chjh.ntpc.edu.tw
伺服器: google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
chjh.ntpc.edu.tw MX preference = 2, mail exchanger =
alt1.aspmx.l.google.
com
chjh.ntpc.edu.tw MX preference = 3, mail exchanger =
alt2.aspmx.l.google.
com
chjh.ntpc.edu.tw MX preference = 4, mail exchanger =
aspmx2.google.com
chjh.ntpc.edu.tw MX preference = 5, mail exchanger =
aspmx3.google.com
chjh.ntpc.edu.tw MX preference = 1, mail exchanger =
aspmx.l.google.com
## 查詢 chjh.ntpc.edu.tw 的重要 DNS資料
C:\>nslookup -type=all chjh.ntpc.edu.tw
伺服器:
google-public-dns-a.google.com
Address:
8.8.8.8
未經授權的回答:
chjh.ntpc.edu.tw
primary name server = ntpc.edu.tw
responsible mail addr = root.ntpc.edu.tw
serial = 2016060702
refresh = 60 (1 min)
retry = 900 (15 mins)
expire = 604800 (7 days)
default TTL = 900 (15 mins)
chjh.ntpc.edu.tw nameserver = dns3.ntpc.edu.tw
chjh.ntpc.edu.tw nameserver = dns4.ntpc.edu.tw
chjh.ntpc.edu.tw nameserver = dns1.ntpc.edu.tw
chjh.ntpc.edu.tw nameserver = dns2.ntpc.edu.tw
chjh.ntpc.edu.tw MX preference = 1, mail exchanger =
aspmx.l.google.com
chjh.ntpc.edu.tw MX preference = 2, mail exchanger =
alt1.aspmx.l.google.
com
chjh.ntpc.edu.tw MX preference = 3, mail exchanger =
alt2.aspmx.l.google.
com
chjh.ntpc.edu.tw MX preference = 4, mail exchanger =
aspmx2.google.com
chjh.ntpc.edu.tw MX preference = 5, mail exchanger =
aspmx3.google.com
沒有留言:
張貼留言