TCP/IP 详解 卷1 ch14 DNS: The Domain Name System

本文介绍了DNS的基本工作流程,包括域名解析的过程、绝对域名的概念、使用UDP进行DNS查询的特点等。并通过实例展示了如何通过不同工具获取DNS记录,如使用host、nslookup及dig等命令查询域名对应的IP地址。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. Applications contact resolvers to convert a hostname to an IP address, and vice versa. Resolvers then contact a local name
server, and this server may contact one of the root servers or other servers to fulfill the request.

gethostbyname and gethostbyaddr

2. A domain name that ends with a period is called an absolute domain name or a fully qualified domain name (FQDN), for example, sun.tuc.noao.edu.

3. DNS use UDP, port 53

4. how to get a DNS pcap? try capture "telnet youkuaiyun.com"
4.1 type is A in DNS query, means require a IP address.
4.2 There can be many repetitions of domain names in a reply, so a compression scheme is used. Anywhere the label portion of a domain name can occur, the single count byte (which is between 0 and 63) has its two high-order bits turned on instead. This means it is a 16-bit pointer and not an
8-bit count byte. The 14 bits that follow in the pointer specify an offset in the DNS message of a label to continue
with. (The offset of the first byte in the identification field is 0.)

>> cat /etc/resolv.conf
domain  cn.lxx.com
nameserver 135.252.34.156
nameserver 135.252.128.166

>> host youkuaiyun.com
youkuaiyun.com has address 211.100.26.77

>> nslookup youkuaiyun.com
Server:         135.252.34.156
Address:        135.252.34.156#53

Non-authoritative answer:
Name:   youkuaiyun.com
Address: 211.100.26.77

>> dig youkuaiyun.com

; <<>> DiG 9.2.4 <<>> youkuaiyun.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1516
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;youkuaiyun.com.                      IN      A

;; ANSWER SECTION:
youkuaiyun.com.               488     IN      A       211.100.26.77

;; Query time: 1 msec
;; SERVER: 135.252.34.156#53(135.252.34.156)
;; WHEN: Thu Nov 11 16:47:18 2010
;; MSG SIZE  rcvd: 42

5. Pointer Queries

>> host 135.252.34.158
158.34.252.135.in-addr.arpa domain name pointer a.cn.lxx.com.

6. Caching

To reduce the DNS traffic on the Internet, all name servers employ a cache. With the standard Unix implementation, the
cache is maintained in the server, not the resolver.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值