大家好,又见面了,我是你们的朋友全栈君。
1 DHCP协议1.1 DHCP协议理解定义:
DHCP:Dynamic Host Configuration Protocol,动态主机配置协议,是一个用于局域网的网络协议,位于OSI模型的应用层,使用UDP协议工作,主要有两个用途:
用于内部网或网络服务供应商自动分配IP地址给用户用于内部网管理员对所有电脑作中央管理作用:
动态分配IP地址,过程自动化,终端无需一一手工配置,配置信息统一管理(DNS,网关),IP地址有限、需要大量配置IP地址、经常移动终端。
适用性:
DHCP用一台或一组DHCP服务器来管理网络参数的分配,这种方案具有容错性。甚至对于那些很少改变地址的服务器来说,DHCP仍然被建议用来设置它们的地址。如果服务器需要被重新分配地址(RFC 2071)的时候,就尽可能不去做更改。对于一些设备,如路由器和防火墙,则不应使用DHCP。把TFTP或SSH服务器放在同一台运行DHCP的机器上也是有用的,目的是为了集中管理。
DHCP也可用于直接为服务器和桌面计算机分配地址,并且透过一个PPP代理,也可为拨接及宽带的主机,以及住宅NAT网关和路由器分配地址。DHCP一般不适用于使用在无边际路由器和DNS服务器上。
历史:
DHCP于1993年10月成为标准协议,其前身是BOOTP协议。当前的DHCP定义可以在RFC 2131中找到,而基于IPv6的建议标准(DHCPv6)可以在RFC 3315中找到。
原理:
动态主机设置协议(DHCP)是一种使网络管理员能够集中管理和自动分配IP网络地址的通信协议。在IP网络中,每个连接Internet的设备都需要分配唯一的IP地址。DHCP使网络管理员能从中心结点监控和分配IP地址。当某台计算机移到网络中的其它位置时,能自动收到新的IP地址。
DHCP使用了租约的概念,或称为计算机IP地址的有效期。租用时间是不定的,主要取决于用户在某地连接Internet需要多久,这对于教育行业和其它用户频繁改变的环境是很实用的。透过较短的租期,DHCP能够在一个计算机比可用IP地址多的环境中动态地重新配置网络。DHCP支持为计算机分配静态地址,如需要永久性IP地址的Web服务器。
DHCP和另一个网络IP管理协议BOOTP类似。当前两种配置管理协议都得到了普遍使用,其中DHCP更为先进。某些操作系统,如Windows NT/2000,都带有DHCP服务器。DHCP或BOOTP客户端是装在计算机中的一个程序,这样就可以对其进行配置操作。
分配IP地址方式:
(1)手工配置方式:通过网络管理员手工配置某台客户端特定的IP地址,当客户端请求分配时,DHCP服务器就将手动配置的IP地址分配给客户端。。
(2)自动配置方式:当DHCP客户端第一次想服务端租用到第一个IP地址后,就将这个IP地址永久分配给客户端使用。
(3)动态配置方式:服务器暂时分配一个IP地址给客户端,根据租约到期或者续约租期的方式来管理分配的IP地址。
1.2 DHCP报文格式链路层头
IP头 20bytes
UDP头
DHCP报文
表-1是整个报文的封装格式,包括链路层头、IP头、UDP头和DHCP报文,其中dhcp主要的数据都封装在dhcp报文中。
8 bits
16 bits
24 bits
32 bits
Op
Htype
Hlen
Hops
Xid(4 bytes)
Secs(2 bytes)
Flags(2 bytes)
Ciaddr(4 bytes)
Yiaddr(4 bytes)
Siaddr(4 bytes)
Giaddr(4 bytes)
Chaddr (16 bytes)
Sname (64 bytes)
File (128 bytes)
Option (variable)
表-2 是DHCP报文的格式,各字段的说明如下:
Op:消息操作代码,1byte,既可以是引导请求(BOOTREQUEST)也可以是引导答复(BOOTREPLY),1为请求报文;2为响应报文。具体的报文类型在option字段中标识。Htype:硬件地址类型,1byte,表示client硬件地址的类型,1表示以太网类型。Hlen:硬件地址长度,1byte,以太网的硬件地址长度为6bytes。Xid:处理ID,1byte,由client端产生的随机数,用于匹配请求和应答报文,就是匹配应答报文是对哪个请求报文做出应答。Secs:从获取到IP地址或者续约过程开始到现在所消耗的时间,2bytes,客户端进入IP地址申请进程的时间或者更新IP地址进程的时间;由客户端软件根据情况设定。目前没有使用,固定为0。Flags:标记,2bytes,16bit中只使用了最高位比特(即最左边的比特),这个个比特是广播响应标识位,用来标识DHCP服务器发出的响应报文是广播还是单播,0是单播,1是广播。其余的比特位保留不用,都为0.Ciaddr:客户机IP地址,4bytes,可以是client自己的IP地址,也可以是server分配给client的IP地址。Yiaddr:“你的”(客户机)IP地址,4bytes,是server分配给client的IP地址。Siaddr:在bootstrap中使用的下一台服务器的IP地址,4bytes,是client端获取IP地址等信息的server端的地址。Giaddr:用于导入的接替代理IP地址,4bytes,是client发出请求报文后经过的第一个中继的IP地址。Chaddr:客户机硬件,16bytes,是client端的硬件地址,在client发出报文时会把自己网卡的硬件地址写进这个字段。Sname:任意服务器主机名称,空终止符,64bytes,是client端获取IP地址等信息的服务器名称。File:DHCP发现协议中的引导文件名、空终止符、属名或者空,DHCP供应协议中的受限目录路径名,Options:可选参数字段。这个字段包含了终端的初始配置信息和网络配置信息,包括报文类型,有效租期,DNS服务器的IP地址等配置信息。这个字段的结构采用“CLV”结构,如图-4: 图-1
1.3 技术细节DHCP统一使用两个IANA分配的端口作为BOOTP:服务器端使用67/udp,客户端使用68/udp。
DHCP运行分为四个基本过程,分别为请求IP租约、提供IP租约、选择IP租约和确认IP租约。
客户在获得了一个IP地址以后,就可以发送一个ARP请求来避免由于DHCP服务器地址池重叠而引发的IP冲突。
图-2
这里列出了如下的四个例子
UDP Src=0.0.0.0 sPort=68
Dest=255.255.255.255 dPort=67
OP
HTYPE
HLEN
HOPS
0x01
0x01
0x06
0x00
XID
0x3903F326
SECS
FLAGS
0x0000
0x0000
CIADDR
0x00000000
YIADDR
0x00000000
SIADDR
0x00000000
GIADDR
0x00000000
CHADDR
0x00053C04
0x8D590000
0x00000000
0x00000000
192 octets of 0’s. BOOTP legacy
Magic Cookie
0x63825363
DHCP Options
DHCP option 53: DHCP Discover
DHCP option 50: 192.168.1.100 requested
DHCP发现(DISCOVER)client在物理子网上发送广播来寻找可用的服务器。网络管理员可以配置一个本地路由来转发DHCP包给另一个子网上的DHCP服务器。该client实现生成一个目的地址为255.255.255.255或者一个子网广播地址的UDP包。
客户也可以申请它使用的最后一个IP地址(在下面的例子里为192.168.1.100)。如果该客户所在的网络中此IP仍然可用,服务器就可以准许该申请。否则,就要看该服务器是授权的还是非授权的。授权服务器会拒绝请求,使得客户立刻申请一个新的IP。非授权服务器仅仅忽略掉请求,导致一个客户端请求的超时,于是客户端就会放弃此请求而去申请一个新的IP地址。
UDP Src=192.168.1.1
sPort=67 Dest=255.255.255.255 dPort=68
OP
HTYPE
HLEN
HOPS
0x02
0x01
0x06
0x00
XID
0x3903F326
SECS
FLAGS
0x0000
0x0000
CIADDR
0x00000000
YIADDR
0xC0A80164
SIADDR
0x00000000
GIADDR
0x00000000
CHADDR
0x00053C04
0x8D590000
0x00000000
0x00000000
192 octets of 0’s. BOOTP legacy
Magic Cookie
0x63825363
DHCP Options
DHCP option 53: DHCP Offer
DHCP option 1: 255.255.255.0 subnet mask
DHCP option 3: 192.168.1.1 router
DHCP option 51: 1 day IP lease time
DHCP option 54: 192.168.1.1 DHCP server
DHCP提供(OFFER)当DHCP服务器收到一个来自客户的IP租约请求时,它会提供一个IP租约。DHCP为客户保留一个IP地址,然后通过网络单播一个DHCPOFFER消息给客户。该消息包含客户的MAC地址、服务器提供的IP地址、子网掩码、租期以及提供IP的DHCP服务器的IP。
服务器基于在CHADDR字段指定的客户硬件地址来检查配置。这里的服务器,192.168.1.1,将IP地址指定于YIADDR字段。
UDP Src=0.0.0.0
sPort=68
Dest=255.255.255.255
dPort=67
OP
HTYPE
HLEN
HOPS
0x01
0x01
0x06
0x00
XID
0x3903F326
SECS
FLAGS
0x0000
0x0000
CIADDR
0x00000000
YIADDR
0x00000000
SIADDR
0x00000000
GIADDR
0x00000000
CHADDR
0x00053C04
0x8D590000
0x00000000
0x00000000
192 octets of 0’s. BOOTP legacy
Magic Cookie
0x63825363
DHCP Options
DHCP option 53: DHCP Request
DHCP option 50: 192.168.1.100 requested
DHCP option 54: 192.168.1.1 DHCP server.
DHCP请求(REQUEST)当客户PC收到一个IP租约提供时,它必须告诉所有其他的DHCP服务器它已经接受了一个租约提供。因此,该客户会发送一个DHCPREQUEST消息,其中包含提供租约的服务器的IP。当其他DHCP服务器收到了该消息后,它们会收回所有可能已提供给该客户的租约。然后它们把曾经给该客户保留的那个地址重新放回到可用地址池中,这样,它们就可以为其他计算机分配这个地址。任意数量的DHCP服务器都可以响应同一个IP租约请求,但是每一个客户网卡只能接受一个租约提供。
UDP Src=192.168.1.1
sPort=67
Dest=192.168.1.100
dPort=68
OP
HTYPE
HLEN
HOPS
0x02
0x01
0x06
0x00
XID
0x3903F326
SECS
FLAGS
0x0000
0x0000
CIADDR (Client IP Address)
0x00000000
YIADDR (Your IP Address)
0xC0A80164
SIADDR (Server IP Address)
0x00000000
GIADDR (Gateway IP Address switched by relay)
0x00000000
CHADDR (Client Hardware Address)
0x00053C04
0x8D590000
0x00000000
0x00000000
192 octets of 0’s. BOOTP legacy
Magic Cookie
0x63825363
DHCP Options
DHCP option 53: DHCP ACK
DHCP option 1: 255.255.255.0 subnet mask
DHCP option 3: 192.168.1.1 router
DHCP option 51: 1 day IP lease time
DHCP option 54: 192.168.1.1 DHCP server
DHCP确认(Acknowledge,ACK)当DHCP服务器收到来自客户的REQUEST消息后,它就开始了配置过程的最后阶段。这个响应阶段包括发送一个DHCPACK包给客户。这个包包含租期和客户可能请求的其他所有配置信息。这时候,TCP/IP配置过程就完成了。
该服务器响应请求并发送响应给客户。整个系统期望客户来根据选项来配置其网卡。
DHCP释放(RELEASE)客户端向DHCP服务器发送一个请求以释放DHCP资源,并注销其IP地址。鉴于客户端更多的时候并不清楚何时用户会将其从网络中移除,此协议不会托管“DHCP释放的发送”。
DHCP NAK服务器回复客户,客户要求的网址不能被分配。
Options下表列出了DHCP可选的options,也可以在RFC 2132和IANA registry(附录1)中找到定义。
Code
Name
Length
Notes
0
Pad[13]:Section 3.1
0 octets
Can be used to pad other options so that they are aligned to the word boundary; is not followed by length byte
1
Subnet mask[13]:Section 3.3
4 octets
Must be sent before the router option (option 3) if both are included
2
Time offset[13]:Section 3.4
4 octets
3
Router
Multiples of 4 octets
Available routers, should be listed in order of preference
4
Time server
Multiples of 4 octets
Available time servers to synchronise with, should be listed in order of preference
5
Name server
Multiples of 4 octets
Available IEN 116 name servers, should be listed in order of preference
6
Domain name server
Multiples of 4 octets
Available DNS servers, should be listed in order of preference
7
Log server
Multiples of 4 octets
Available log servers, should be listed in order of preference.
8
Cookie server
Multiples of 4 octets
Cookie in this case means “fortune cookie” or “quote of the day”, a pithy or humorous anecdote often sent as part of a logon process on large computers; it has nothing to do with cookies sent by websites.
9
LPR Server
Multiples of 4 octets
10
Impress server
Multiples of 4 octets
11
Resource location server
Multiples of 4 octets
12
Host name
Minimum of 1 octet
13
Boot file size
2 octets
Length of the boot image in 4KiB blocks
14
Merit dump file
Minimum of 1 octet
Path where crash dumps should be stored
15
Domain name
Minimum of 1 octet
16
Swap server
4 octets
17
Root path
Minimum of 1 octet
18
Extensions path
Minimum of 1 octet
255
End
0 octets
Used to mark the end of the vendor option field
Code
Name
Length
Notes
19
IP forwarding enable/disable
1 octet
20
Non-local source routing enable/disable
1 octet
21
Policy filter
Multiples of 8 octets
22
Maximum datagram reassembly size
2 octets
23
Default IP time-to-live
1 octet
24
Path MTU aging timeout
4 octets
25
Path MTU plateau table
Multiples of 2 octets
Code
Name
Length
Notes
26
Interface MTU
2 octets
27
All subnets are local
1 octet
28
Broadcast address
4 octets
29
Perform mask discovery
1 octet
30
Mask supplier
1 octet
31
Perform router discovery
1 octet
32
Router solicitation address
4 octets
33
Static route
Multiples of 8 octets
A list of destination/router pairs
Code
Name
Length
Notes
34
Trailer encapsulation option
1 octet
35
ARP cache timeout
4 octets
36
Ethernet encapsulation
1 octet
Code
Name
Length
Notes
37
TCP default TTL
1 octet
38
TCP keepalive interval
4 octets
39
TCP keepalive garbage
1 octet
Code
Name
Length
Notes
40
Network information service domain
Minimum of 1 octet
41
Network information servers
Multiples of 4 octets
42
Network Time Protocol (NTP) servers
Multiples of 4 octets
43
Vendor-specific information
Minimum of 1 octets
44
NetBIOS over TCP/IP name server
Multiples of 4 octets
45
NetBIOS over TCP/IP datagram Distribution Server
Multiples of 4 octets
46
NetBIOS over TCP/IP node type
1 octet
47
NetBIOS over TCP/IP scope
Minimum of 1 octet
48
X Window System font server
Multiples of 4 octets
49
X Window System display manager
Multiples of 4 octets
64
Network Information Service+ domain
Minimum of 1 octet
65
Network Information Service+ servers
Multiples of 4 octets
68
Mobile IP home agent
Multiples of 4 octets
69
Simple Mail Transfer Protocol (SMTP) server
Multiples of 4 octets
70
Post Office Protocol (POP3) server
Multiples of 4 octets
71
Network News Transfer Protocol (NNTP) server
Multiples of 4 octets
72
Default World Wide Web (WWW) server
Multiples of 4 octets
73
Default Finger protocol server
Multiples of 4 octets
74
Default Internet Relay Chat (IRC) server
Multiples of 4 octets
75
StreetTalk server
Multiples of 4 octets
76
StreetTalk Directory Assistance (STDA) server
Multiples of 4 octets
Code
Name
Length
Notes
50
Requested IP address
4 octets
51
IP address lease time
4 octets
52
Option overload
1 octet
53
DHCP message type
1 octet
54
Server identifier
4 octets
55
Parameter request list
Minimum of 1 octet
56
Message
Minimum of 1 octet
57
Maximum DHCP message size
2 octets
58
Renewal (T1) time value
4 octets
59
Rebinding (T2) time value
4 octets
60
Vendor class identifier
Minimum of 1 octet
61
Client-identifier
Minimum of 2 octets
66
TFTP server name
Minimum of 1 octet
67
Bootfile name
Minimum of 1 octet
客户供应商标识
DHCP Option 60可以被DHCP客户端用来做为识别供应商及DHCP客户端这边的兼容性识别。DHCP的协议里头有提供默认路由的选项,Option 60则是供应商的识别ID。基于这个选项,可在CPE方提供给STB方一些特定的选择。这样做最大的好处是在使用Option 60的时候,不用去定义桥接或路由的端口号。桥接是基于Option 60的MAC地址,如此一来switch可以连到STB上面,如同在PC及STB上面拥有同一个接口。
Option 60这个消息会是一个长度会变动的字符串也有可能依供应商提供的八进制数字的一个集合。DHCP客户端通常会用来沟通的一个方式是在提交DHCP要求的时候按硬件或固件的类型来设置这个信息,这个信息会被称之为供应商Class识别(VCI Vendor Class Identifier)/(Option 60)。这个方式可能因DHCP Server之间的不同而会在两种 CMs或两种 modems之间进行DHCP request时造成差异。有些set-top的Boxes也会设置VCI去通知DHCP Server有关硬件和设备的功能性信息。所以结论是,这个选项的信息会给予DHCP Server在做DHCP回应时必要附加消息上面的提示。
2 实验1-nat模式之前我的一篇文章《Pxe + Kickstart脚本 自动安装 ESXi 6.5》介绍了无人值守安装esxi,其中涉及到的dhcp协议,我在本文进行详细的介绍。下面,我们结合文章,通过wireshark抓包整个安装过程,过滤DHCP协议如下图
图-3
注:其中最后两列,为自定义的hardware source addr 和hardware destination addr。
首先我列出我的实验环境信息
代码语言:javascript代码运行次数:0运行复制Vmware_b2:88:38 (00:0c:29:b2:88:38) 192.168.67.137 -- 虚拟机esxi
Vmware_c0:00:08 (00:50:56:c0:00:08) 192.168.67.1 -- 物理主机
Vmware_e4:41:21 (00:50:56:e4:41:21) 192.168.67.2 -- 虚拟机nat的网关
Vmware_f2:3c:d6 (00:50:56:f2:3c:d6) 192.168.67.254 -- 虚拟机nat的DHCP服务器其中,192.168.67.254为什么是nat的DHCP服务器,可以参见《vmawre nat模式或仅主机模式的IP划分》,另外,从《Pxe + Kickstart脚本 自动安装 ESXi 6.5》我们可以看到,Tiny PXE Server 启动也启动DHCP服务,也就是有两个DHCP服务器。
2.1 Discover我们来看1号包,info是DHCP Discover,这是客户端在寻找dhcp 服务器所发出的udp包。
DHCP是通过UDP数据包来封装的,双击打开1号包,点击第二行,此为链路层头(14byte),具体字节可数下面第二个红框,如图-4:
图-4
点击第三行,此为IP头层(20byte),如图-5:
图-5
第四行则为UDP头(8byte),如图-6:
图-6
第五行为DHCP报文(剩下的所有字节,包含填充字节),如图-7
图-7
以上图-4到图-7与表-1所述内容相符。
在图-8中,我们看到详细的DHCP报文结构,与表-2所述内容一致。
本包是由客户端发起的广播包,希望找到DHCP server来获得IP地址,所以目标地址是 255.255.255.255,所有相邻网段都将收到此包。
图-8
2.2 Offer双击5号包,本包是由DHCP server 回应客户端而发出的广播包,所以目标地址是它本网段下的广播地址 192.168.67.255,即本网段的所有设备都将收到此包,其他网段不会收到此包。
图-9
此外option 53 的可选值有如下8个:详见
代码语言:javascript代码运行次数:0运行复制1 = (DHCP) Discover message (DHCPDiscover).
2 = (DHCP) Offer message (DHCPOffer).
3 = (DHCP) Request message (DHCPRequest).
4 = (DHCP) Decline message (DHCPDecline).
5 = (DHCP) Acknowledgment message (DHCPAck).
6 = (DHCP) Negative Acknowledgment message (DHCPNak).
7 = (DHCP) Release message (DHCPRelease).
8 = (DHCP) Informational message (DHCPInform) 接下来看7号包,如图-10,这里为什么会有192.168.67.254这个地址,这个其实是nat的DHCP服务器,也就是说在192.168.67.0/24这个网络上存在着两个DHCP服务器。
这个包是由192.168.67.254(00:50:56:f2:3c:d6) 发出的广播包,目标MAC是客户端(00:0c:29:b2:88:38),但是使用的目标IP是 255.255.255.255,也就是说,这个包是IP层的广播,而以太网层是发送到客户端MAC的,这是什么原理呢?望大神指点。
图-10
2.3 Request3 实验2-hostonly模式与实验1不同,这里vmware使用的是仅主机模式,并且关闭了该模式自带的dhcp服务。去掉勾选。
其他的步骤也与nat模式没有什么差别。
这里去掉自带dhcp服务器的目的是使环境更加纯粹。
3.1 Discover附:表1:摘自IANA registry文档
Tag
Name
Data
Length
Meaning
Reference
0
Pad
0
None
[RFC2132]
1
Subnet Mask
4
Subnet Mask Value
[RFC2132]
2
Time Offset
4
Time Offset in Seconds from UTC (note: deprecated by 100 and 101)
[RFC2132]
3
Router
N
N/4 Router addresses
[RFC2132]
4
Time Server
N
N/4 Timeserver addresses
[RFC2132]
5
Name Server
N
N/4 IEN-116 Server addresses
[RFC2132]
6
Domain Server
N
N/4 DNS Server addresses
[RFC2132]
7
Log Server
N
N/4 Logging Server addresses
[RFC2132]
8
Quotes Server
N
N/4 Quotes Server addresses
[RFC2132]
9
LPR Server
N
N/4 Printer Server addresses
[RFC2132]
10
Impress Server
N
N/4 Impress Server addresses
[RFC2132]
11
RLP Server
N
N/4 RLP Server addresses
[RFC2132]
12
Hostname
N
Hostname string
[RFC2132]
13
Boot File Size
2
Size of boot file in 512 byte chunks
[RFC2132]
14
Merit Dump File
N
Client to dump and name the file to dump it to
[RFC2132]
15
Domain Name
N
The DNS domain name of the client
[RFC2132]
16
Swap Server
N
Swap Server address
[RFC2132]
17
Root Path
N
Path name for root disk
[RFC2132]
18
Extension File
N
Path name for more BOOTP info
[RFC2132]
19
Forward On/Off
1
Enable/Disable IP Forwarding
[RFC2132]
20
SrcRte On/Off
1
Enable/Disable Source Routing
[RFC2132]
21
Policy Filter
N
Routing Policy Filters
[RFC2132]
22
Max DG Assembly
2
Max Datagram Reassembly Size
[RFC2132]
23
Default IP TTL
1
Default IP Time to Live
[RFC2132]
24
MTU Timeout
4
Path MTU Aging Timeout
[RFC2132]
25
MTU Plateau
N
Path MTU Plateau Table
[RFC2132]
26
MTU Interface
2
Interface MTU Size
[RFC2132]
27
MTU Subnet
1
All Subnets are Local
[RFC2132]
28
Broadcast Address
4
Broadcast Address
[RFC2132]
29
Mask Discovery
1
Perform Mask Discovery
[RFC2132]
30
Mask Supplier
1
Provide Mask to Others
[RFC2132]
31
Router Discovery
1
Perform Router Discovery
[RFC2132]
32
Router Request
4
Router Solicitation Address
[RFC2132]
33
Static Route
N
Static Routing Table
[RFC2132]
34
Trailers
1
Trailer Encapsulation
[RFC2132]
35
ARP Timeout
4
ARP Cache Timeout
[RFC2132]
36
Ethernet
1
Ethernet Encapsulation
[RFC2132]
37
Default TCP TTL
1
Default TCP Time to Live
[RFC2132]
38
Keepalive Time
4
TCP Keepalive Interval
[RFC2132]
39
Keepalive Data
1
TCP Keepalive Garbage
[RFC2132]
40
NIS Domain
N
NIS Domain Name
[RFC2132]
41
NIS Servers
N
NIS Server Addresses
[RFC2132]
42
NTP Servers
N
NTP Server Addresses
[RFC2132]
43
Vendor Specific
N
Vendor Specific Information
[RFC2132]
44
NETBIOS Name Srv
N
NETBIOS Name Servers
[RFC2132]
45
NETBIOS Dist Srv
N
NETBIOS Datagram Distribution
[RFC2132]
46
NETBIOS Node Type
1
NETBIOS Node Type
[RFC2132]
47
NETBIOS Scope
N
NETBIOS Scope
[RFC2132]
48
X Window Font
N
X Window Font Server
[RFC2132]
49
X Window Manager
N
X Window Display Manager
[RFC2132]
50
Address Request
4
Requested IP Address
[RFC2132]
51
Address Time
4
IP Address Lease Time
[RFC2132]
52
Overload
1
Overload “sname” or “file”
[RFC2132]
53
DHCP Msg Type
1
DHCP Message Type
[RFC2132]
54
DHCP Server Id
4
DHCP Server Identification
[RFC2132]
55
Parameter List
N
Parameter Request List
[RFC2132]
56
DHCP Message
N
DHCP Error Message
[RFC2132]
57
DHCP Max Msg Size
2
DHCP Maximum Message Size
[RFC2132]
58
Renewal Time
4
DHCP Renewal (T1) Time
[RFC2132]
59
Rebinding Time
4
DHCP Rebinding (T2) Time
[RFC2132]
60
Class Id
N
Class Identifier
[RFC2132]
61
Client Id
N
Client Identifier
[RFC2132]
62
NetWare/IP Domain
N
NetWare/IP Domain Name
[RFC2242]
63
NetWare/IP Option
N
NetWare/IP sub Options
[RFC2242]
64
NIS-Domain-Name
N
NIS+ v3 Client Domain Name
[RFC2132]
65
NIS-Server-Addr
N
NIS+ v3 Server Addresses
[RFC2132]
66
Server-Name
N
TFTP Server Name
[RFC2132]
67
Bootfile-Name
N
Boot File Name
[RFC2132]
68
Home-Agent-Addrs
N
Home Agent Addresses
[RFC2132]
69
SMTP-Server
N
Simple Mail Server Addresses
[RFC2132]
70
POP3-Server
N
Post Office Server Addresses
[RFC2132]
71
NNTP-Server
N
Network News Server Addresses
[RFC2132]
72
WWW-Server
N
WWW Server Addresses
[RFC2132]
73
Finger-Server
N
Finger Server Addresses
[RFC2132]
74
IRC-Server
N
Chat Server Addresses
[RFC2132]
75
StreetTalk-Server
N
StreetTalk Server Addresses
[RFC2132]
76
STDA-Server
N
ST Directory Assist. Addresses
[RFC2132]
77
User-Class
N
User Class Information
[RFC3004]
78
Directory Agent
N
directory agent information
[RFC2610]
79
Service Scope
N
service location agent scope
[RFC2610]
80
Rapid Commit
0
Rapid Commit
[RFC4039]
81
Client FQDN
N
Fully Qualified Domain Name
[RFC4702]
82
Relay Agent Information
N
Relay Agent Information
[RFC3046]
83
iSNS
N
Internet Storage Name Service
[RFC4174]
84
REMOVED/Unassigned
[RFC3679]
85
NDS Servers
N
Novell Directory Services
[RFC2241]
86
NDS Tree Name
N
Novell Directory Services
[RFC2241]
87
NDS Context
N
Novell Directory Services
[RFC2241]
88
BCMCS Controller Domain Name list
[RFC4280]
89
BCMCS Controller IPv4 address option
[RFC4280]
90
Authentication
N
Authentication
[RFC3118]
91
client-last-transaction-time option
[RFC4388]
92
associated-ip option
[RFC4388]
93
Client System
N
Client System Architecture
[RFC4578]
94
Client NDI
N
Client Network Device Interface
[RFC4578]
95
LDAP
N
Lightweight Directory Access Protocol
[RFC3679]
96
REMOVED/Unassigned
[RFC3679]
97
UUID/GUID
N
UUID/GUID-based Client Identifier
[RFC4578]
98
User-Auth
N
Open Group’s User Authentication
[RFC2485]
99
GEOCONF_CIVIC
[RFC4776]
100
PCode
N
IEEE 1003.1 TZ String
[RFC4833]
101
TCode
N
Reference to the TZ Database
[RFC4833]
102-107
REMOVED/Unassigned
[RFC3679]
108
REMOVED/Unassigned
[RFC3679]
109
OPTION_DHCP4O6_S46_SADDR
16
DHCPv4 over DHCPv6 Softwire Source Address Option
[RFC8539]
110
REMOVED/Unassigned
[RFC3679]
111
Unassigned
[RFC3679]
112
Netinfo Address
N
NetInfo Parent Server Address
[RFC3679]
113
Netinfo Tag
N
NetInfo Parent Server Tag
[RFC3679]
114
URL
N
URL
[RFC3679]
115
REMOVED/Unassigned
[RFC3679]
116
Auto-Config
N
DHCP Auto-Configuration
[RFC2563]
117
Name Service Search
N
Name Service Search
[RFC2937]
118
Subnet Selection Option
4
Subnet Selection Option
[RFC3011]
119
Domain Search
N
DNS domain search list
[RFC3397]
120
SIP Servers DHCP Option
N
SIP Servers DHCP Option
[RFC3361]
121
Classless Static Route Option
N
Classless Static Route Option
[RFC3442]
122
CCC
N
CableLabs Client Configuration
[RFC3495]
123
GeoConf Option
16
GeoConf Option
[RFC6225]
124
V-I Vendor Class
Vendor-Identifying Vendor Class
[RFC3925]
125
V-I Vendor-Specific Information
Vendor-Identifying Vendor-Specific Information
[RFC3925]
126
Removed/Unassigned
[RFC3679]
127
Removed/Unassigned
[RFC3679]
128
PXE – undefined (vendor specific)
[RFC4578]
128
Etherboot signature. 6 bytes: E4:45:74:68:00:00
128
DOCSIS “full security” server IP address
128
TFTP Server IP address (for IP Phone software load)
129
PXE – undefined (vendor specific)
[RFC4578]
129
Kernel options. Variable length string
129
Call Server IP address
130
PXE – undefined (vendor specific)
[RFC4578]
130
Ethernet interface. Variable length string.
130
Discrimination string (to identify vendor)
131
PXE – undefined (vendor specific)
[RFC4578]
131
Remote statistics server IP address
132
PXE – undefined (vendor specific)
[RFC4578]
132
IEEE 802.1Q VLAN ID
133
PXE – undefined (vendor specific)
[RFC4578]
133
IEEE 802.1D/p Layer 2 Priority
134
PXE – undefined (vendor specific)
[RFC4578]
134
Diffserv Code Point (DSCP) for VoIP signalling and media streams
135
PXE – undefined (vendor specific)
[RFC4578]
135
HTTP Proxy for phone-specific applications
136
OPTION_PANA_AGENT
[RFC5192]
137
OPTION_V4_LOST
[RFC5223]
138
OPTION_CAPWAP_AC_V4
N
CAPWAP Access Controller addresses
[RFC5417]
139
OPTION-IPv4_Address-MoS
N
a series of suboptions
[RFC5678]
140
OPTION-IPv4_FQDN-MoS
N
a series of suboptions
[RFC5678]
141
SIP UA Configuration Service Domains
N
List of domain names to search for SIP User Agent Configuration
[RFC6011]
142
OPTION-IPv4_Address-ANDSF
N
ANDSF IPv4 Address Option for DHCPv4
[RFC6153]
143
OPTION_V4_SZTP_REDIRECT
N
This option provides a list of URIs for SZTP bootstrap servers
[RFC8572]
144
GeoLoc
16
Geospatial Location with Uncertainty
[RFC6225]
145
FORCERENEW_NONCE_CAPABLE
1
Forcerenew Nonce Capable
[RFC6704]
146
RDNSS Selection
N
Information for selecting RDNSS
[RFC6731]
147-149
Unassigned
[RFC3942]
150
TFTP server address
[RFC5859]
150
Etherboot
150
GRUB configuration path name
151
status-code
N+1
Status code and optional N byte text message describing status.
[RFC6926]
152
base-time
4
Absolute time (seconds since Jan 1, 1970) message was sent.
[RFC6926]
153
start-time-of-state
4
Number of seconds in the past when client entered current state.
[RFC6926]
154
query-start-time
4
Absolute time (seconds since Jan 1, 1970) for beginning of query.
[RFC6926]
155
query-end-time
4
Absolute time (seconds since Jan 1, 1970) for end of query.
[RFC6926]
156
dhcp-state
1
State of IP address.
[RFC6926]
157
data-source
1
Indicates information came from local or remote server.
[RFC6926]
158
OPTION_V4_PCP_SERVER
Variable; the minimum length is 5.
Includes one or multiple lists of PCP server IP addresses; each list is treated as a separate PCP server.
[RFC7291]
159
OPTION_V4_PORTPARAMS
4
This option is used to configure a set of ports bound to a shared IPv4 address.
[RFC7618]
160
DHCP Captive-Portal
N
DHCP Captive-Portal
[RFC7710]
161
OPTION_MUD_URL_V4
N (variable)
Manufacturer Usage Descriptions
[RFC8520]
162-174
Unassigned
[RFC3942]
175
Etherboot (Tentatively Assigned – 2005-06-23)
176
IP Telephone (Tentatively Assigned – 2005-06-23)
177
Etherboot (Tentatively Assigned – 2005-06-23)
177
PacketCable and CableHome (replaced by 122)
178-207
Unassigned
[RFC3942]
208
PXELINUX Magic
4
magic string = F1:00:74:7E
[RFC5071][Deprecated]
209
Configuration File
N
Configuration file
[RFC5071]
210
Path Prefix
N
Path Prefix Option
[RFC5071]
211
Reboot Time
4
Reboot Time
[RFC5071]
212
OPTION_6RD
18 + N
OPTION_6RD with N/4 6rd BR addresses
[RFC5969]
213
OPTION_V4_ACCESS_DOMAIN
N
Access Network Domain Name
[RFC5986]
214-219
Unassigned
220
Subnet Allocation Option
N
Subnet Allocation Option
[RFC6656]
221
Virtual Subnet Selection (VSS) Option
[RFC6607]
222-223
Unassigned
[RFC3942]
224-254
Reserved (Private Use)
255
End
0
None
[RFC2132]
参考:RFC2132
https://tools.ietf.org/html/rfc2132
DHCP wiki 英文版
https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
DHCP wiki 中文版
https://zh.wikipedia.org/wiki/%E5%8A%A8%E6%80%81%E4%B8%BB%E6%9C%BA%E8%AE%BE%E7%BD%AE%E5%8D%8F%E8%AE%AE
DHCP option清单
http://www.networksorcery.com/enp/protocol/bootp/options.htm
iana 关于DHCP
https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml#options
Dynamic Host Configuation Protocol (DHCP) Message Options
http://www.omnisecu.com/tcpip/dhcp-dynamic-host-configuration-protocol-message-options.php
DHCP协议详解(非常详细总结),结合ENSP,wireshark学习使用
https://blog.csdn.net/scanf_linux/article/details/89415965
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/142110.html原文链接:https://javaforall.cn