- Vixual - http://www.vixual.net/blog -

dig、host 與 nslookup 指令的查詢語法

在 Linux 下執行 nslookup 指令都會出現下列訊息:

Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.

告訴你使用 dig 或 host 指令來取代 nslookup,但可惜在 Windows 系統並沒有 dig 與 host 指令。

以下是 dig、host 與 nslookup 的查詢語法:

dig:

dig @NameServer 網域名稱 Type

host:

host -t Type 網域名稱 NameServer

nslookup:

nslookup -type=Type 網域名稱 NameServer

其中 Type 的參數有

  1. any
  2. a: 查 IP Address
  3. mx: 查郵件伺服器
  4. ns: 查名稱伺服器
  5. cname: 查別名
  6. ptr: 由 IP Address 反查網域名稱
  7. hinfo: 查伺服器的系統資訊