nslookup
網路
用法
nslookup <name> [server]把名稱解析成位址的老工具:它還能跑,但輸出格式和結束狀態都不穩定,寫腳本沒法用,如今這活由 dig 接了過去。
常用選項
| 選項 | 含義 |
|---|---|
| <name> <server> | The resolver to ask goes second, with no flag. |
| -type=MX | Record type, written with an equals sign. |
| -debug | Show the full packet, including the flags in the header. |
| (no argument) | Drops into an interactive prompt where you use "set type=MX". |
範例
nslookup example.com 1.1.1.1A quick lookup against a chosen resolver.
nslookup -type=MX example.comMail records, the nslookup spelling.
連不上的時候,這些能把範圍縮小——是名稱解析不了、沒有路由,還是連接埠被擋。
怎麼看
- 方括號 [ ] 表示這部分可以不寫。
- 省略號 … 表示可以寫多個。
- 選項區分大小寫——有些命令裡 -r 和 -R 不是一回事。
常見問題
Q. nslookup 是做什麼的?
把名稱解析成位址的老工具:它還能跑,但輸出格式和結束狀態都不穩定,寫腳本沒法用,如今這活由 dig 接了過去。
Q. 怎麼寫?
nslookup <name> [server] —— 方括號表示可以省略的部分。
Q. 值得記的選項有幾個?
這裡列了 4 個,完整列表在 man nslookup。這條命令屬於網路。
相關命令
man 手冊: man nslookup