Aqua Phoenix
     >>  Software >>  SunRay  
 

Navigator
   
 
       
   

3. DHCP

DHCP is a standard protocol that comprises specific message types and a certain set of standard network configuration parameters. A typical DHCP message flow comprises the following steps:
  1. A DHCP-dependent client sends a DHCP request to the entire subnet, requesting an IP address, Name Server information, etc. Part of the message is the client's MAC address, which uniquely identifies a network interface.
  2. The message can be read by all machines on the subnet, but usually only one machine, the DHCP server, will reply appropriately. The DHCP server responsible on this subnet, or the DHCP server routed to this subnet, accepts the DHCP request, assembles a message with an available IP address and the client's MAC address, and sends the DHCP response to the subnet.
  3. Again, the message can be read by all machines on the subnet, but typically only the client with the matching MAC address will accept the DHCP response and begin to configure itself with the network parameters in the DHCP reply.

3.1 DHCP Message Structure

  Bits
  00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
00 Opcode Hardware Type Hardware Address Length Hop Count
01 Transaction ID
02 Number of Seconds Flags
03 Client IP Address
04 Your IP Address
05 Server IP Address
06 Gateway IP Address
07 Client Hardware Address (* 2)
09 Server Host Name (* 16)
25 Boot Filename (* 32)
57 Vendor-specific Options (* variable)

Opcode (8 bits, 1 byte):

ValueDescription
1 Boot request
2 Boot reply

Hardware Type (8 bits, 1 byte):

Value Description
1 Ethernet
2 Experimental Ethernet
3 Amateur Radio AX.25
4 Proteon ProNET Token Ring
5 Chaos
6 IEEE 802
7 ARCNET.
8 Hyperchannel
9 Lanstar
10 Autonet Short Address
11 LocalTalk
12 LocalNet (IBM PCNet or SYTEK LocalNET)
13 Ultra Link
14 SMDS
15 Frame Relay
16 ATM, Asynchronous Transmission Mode
Value Description
17 HDLC
18 Fibre Channel
19 ATM, Asynchronous Transmission Mode
20 Serial Line
21 ATM, Asynchronous Transmission Mode
22 MIL-STD-188-220
23 Metricom
24 IEEE 1394.1995
25 MAPOS
26 Twinaxial
27 EUI-64
28 HIPARP
29 IP and ARP over ISO 7816-3
30 ARPSec.
31 IPsec Tunnel
32 Infiniband

Hardware address length (8 bits, 1 byte)

Hop count (8 bits, 1 byte): This field is used by relay agents.

Transaction ID (32 bits, 4 bytes): A random number chosen by the client, used by the client and server to associate messages and responses between a client and a server.

Number of seconds (16 bits, 2 bytes): The elapsed time, in seconds since the client began an address acquisition or renewal process.

Flags (16 bits)

Client IP address (32 bits, 4 bytes)

Your IP address (32 bits, 4 bytes)

Server IP address (32 bits, 4 bytes)

Gateway IP address (32 bits, 4 bytes)

Client hardware address (128 bits, 16 bytes)

Server host name (512 bits, 64 bytes)

Boot filename (1024 bits, 128 bytes)

Vendor-specific Options (variable)

3.2 Vendor-specific Options Structure

Because the Vendor-specific Options are variable in length, a specific structure is imposed to the data in this field, if it is intended to be interpreted by anyone (see RFC1533). Of course this structure is not required if the data is meant not to be interpreted by everyone.

Vendor-specific options can contain any number of key-value pairs. Depending on the vendor's requirements, these key-value pairs may include IP addresses, host names, or any other information. Key-value pairs are encoded as follows:

Code Length Contents
1 byte 1 byte <Length> bytes
                      ...

For example, an IP address (192.68.10.56) for vendor-specific code "02" would be represented as:

Code Length Contents
1 byte 1 byte 4 bytes
02 04 C0 44 0A 38

(192.68.10.56 = C0.44.0A.38 in hexadecimal values)

The Vendor-specific Option field is completed with the stop byte FF (= 255).

Consecutive key-value pairs are not separated by any additional bytes. Using this method of coding 1 byte keys, 1 byte lengths, and 0-to-255 byte content fields, an RFC1533 vendor field can easily be decoded.