Dynamic Host Configuration Protocol

Previous Topic Next Topic

Managing Relay Agents

A relay agent is a small program that relays a certain type of message to other hosts on a network. In TCP/IP networking, routers are used to interconnect hardware and software on different subnets and forward IP packets between the subnets.

To support and use the DHCP service across multiple subnets, routers connecting each subnet should comply with the DHCP/BOOTP relay agent capabilities described in RFC 1542. To comply with RFC 1542 and provide relay agent support, each router must be able to recognize BOOTP and DHCP protocol messages and process (relay) them appropriately. Because routers interpret DHCP messages as BOOTP messages (such as a UDP message sent through the same UDP port number and containing shared message structure), a router with BOOTP–relay agent capability typically relays DHCP packets and any BOOTP packets sent on the network.

In most cases, routers support DHCP/BOOTP relay. If your routers do not, contact your router manufacturer or supplier to find out if a software or firmware upgrade is available to support this feature.

Alternatively, if a router cannot function as a DHCP/BOOTP relay agent, each subnet must have either its own DHCP server or another computer that can function as a relay agent on that subnet.

In cases where it is impractical or impossible to configure routers to support DHCP/BOOTP relay, you can configure a computer running Windows 2000 or Windows NT Server 4.0 to act as a relay agent by installing the DHCP Relay Agent service. A DHCP relay agent is a hardware device or software program that can pass DHCP/BOOTP broadcast messages from one subnet to another subnet according to the RFC 2131 specification for DHCP. DHCP/BOOTP relay agents act as proxies, forwarding messages from one subnet to the next. By default, DHCP is a broadcast-based protocol, so without relay agents and the ability to pass DHCP and BOOTP messages across routers, every subnet on a network must have its own DHCP server.

How Relay Agents Work

Figure 4.24 shows how Client C on Subnet 2 obtains a DHCP address lease from DHCP Server 1 on Subnet 1.

Figure 4.24    Using a Relay Agent
Enlarge figure

Figure 4.24 Using a Relay Agent

  1. DHCP Client C broadcasts a DHCP/BOOTP discover message (DHCPDiscover) on Subnet 2, as a User Datagram Protocol (UDP) datagram using the well-known UDP server port of 67 (the port number reserved and shared for BOOTP and DHCP server communication).
  2. The relay agent, in this case a DHCP/BOOTP relay-enabled router, examines the gateway IP address field in the DHCP/BOOTP message header. If the field has an IP address of 0.0.0.0, the agent fills it with the relay agent or router's IP address and forwards the message to the remote Subnet 1, where the DHCP server is located.
  3. When DHCP Server 1 on remote Subnet 1 receives the message, it examines the gateway IP address field for a DHCP scope that can be used by the DHCP server to supply an IP address lease.
  4. If DHCP Server 1 has multiple DHCP scopes, the address in the gateway IP address field (giaddr) identifies the DHCP scope from which to offer an IP address lease.

    For example, if the giaddr field has an IP address of 201.2.45.2, the DHCP server checks its available set of address scopes for a scope range of addresses that matches the Class C IP network that includes the gateway address of the computer. In this case, the DHCP server checks to see which scope includes addresses between 201.2.45.1 and 201.2.45.254. If a scope exists that matches this criterion, the DHCP server selects an available address from the matched scope to use in an IP address lease offer response to the client.

  5. When DHCP Server 1 receives the DHCPDiscover message, it processes the message and sends an IP address lease offer (DHCPOffer) directly to the relay agent identified in the gateway IP address field (giaddr).
  6. The router relays the address lease offer (DHCPOffer) to the DHCP client.

    The client's IP address is still unknown, so it has to be a broadcast on the local subnet. Similarly, a DHCPRequest message is relayed from client to server, and a DHCPAck message is relayed from server to client, according to RFC 1542.

© 1985-2000 Microsoft Corporation. All rights reserved.