Thursday, November 13, 2014

IP Services: ARP, Proxy ARP, Reverse ARP, BOOTP, and DHCP

All these five protocols have a common denominator, namely, they help a host learn information to successfully send and receive IP packets.

ARP

ARP is a protocol used to map IP addresses to MAC addresses. Before a host can send any data, it must know the Layer 3 (IP) and Layer 2 (MAC) addresses to correctly construct a frame. ARP is used to dynamically learn the MAC address of a receiver, when the IP address is known. The protocol works as demonstrated in the figure below.


Proxy ARP

Proxy ARP uses the exact same process as ARP, but the ARP request is requesting a MAC address that is not on the local subnet. Because an ARP request is a broadcast, it will not be forwarded outside the local subnet, and the target host will never receive it. However, if a router has a route to that destination, it can issue a proxy ARP reply with its own MAC address on behalf of the target host.

Before the advent of DHCP, many networks relied on proxy ARP. Today, the use of proxy ARP is not that common. In fact, it is often a "quick fix" for potential routing issues (I'll get to this in another post).

Note that the sending host must believe that the target host is in its local network. Otherwise, the sending host will send an ARP request for its default gateway (this is normal ARP, not proxy ARP). In both cases, however, the default gateway (the first-hop router) will reply with its MAC address.

Let's alter the previous scenario to illustrate proxy ARP. First, let's modify the subnet mask on PC1 to cover a larger range, so it believes the remote network is directly connected. Say 10.1.1.102/16. Next, let's add a remote target host (PC2: 10.1.100.22/24) that PC1 will try to ping.


PC1 performs the AND operation, and believes that PC2 exists in its local network, so it sends an ARP request for PC2's IP address directly. The router receives the broadcast, and realizes that it can reach PC2, so it responds to PC1's ARP request with its own MAC address.

Reverse ARP

RARP, BOOTP, and DHCP represent the evolution of protocols defined to enable a host to dynamically learn its IP address. All three are client-server protocols. The client sends a broadcast to begin discovery, the server hears the request and supplies an IP address.

RARP also uses the same ARP message, but operates, well, in reverse (as conveniently implied by the protocol name). When sending a RARP request, the host inserts its own MAC address and an IP address of 0.0.0.0 (indicating an unknown IP address). A preconfigured RARP server, which must be on the same subnet, receives the request and performs a table lookup. If the MAC address listed in the RARP request is configured on the RARP server, the RARP server sends a RARP reply with the corresponding IP address.

The following figure illustrates the operation of RARP.


BOOTP

BOOTP improves on the address assignment features of RARP. BOOTP also uses a completely different set of messages, the payload is encapsulated inside an IP and UDP header. With minimal router configuration, BOOTP packets can be forwarded to remote subnets - allowing the deployment of a centrally located BOOTP server. In addition to IP address assignment, BOOTP supports the assignment of other information, including the subnet mask, default gateway, and DNS servers. But, similar to RARP, BOOTP still requires the server to be manually preconfigured with the MAC addresses and IP addresses for each client.

BOOTP operates as demonstrated in the following figure.


DHCP

DHCP represents the next in the evolution of dynamic IP address assignment. DHCP is widely deployed today. DHCP builds on the format of the BOOTP protocol, and provides flexible messaging and information assignment capability without requiring predefinition of MAC addresses for each client. DHCP also allows the reuse of IP addresses, meaning that a fixed 1:1 address configuration is not required. DHCP can lease IP addresses for the duration the device needs.

DHCP servers typically reside in a centralized location, with routers forwarding local broadcast DHCP requests  to remote DHCP servers. These type of routers are called DHCP relay agents. They change the DHCP request's destination IP address (255.255.255.255) to match the DHCP server (defined by the ip helper-address <ip> command). A relay agent would also list its own IP address in the gateway IP address (giaddr) field, notifying the DHCP server of the IP address to which the DHCP reply should be sent.



Bonus: Configuring a router as a DHCP server

Perhaps not that common in the real world, but a Cisco router can also act as a DHCP server. Essentially, the configuration requires three steps.

  1. Enable the DHCP service on the router.
  2. Exclude all statically configured IP addresses from being dynamically assigned.
  3. Configure DHCP pools with appropriate parameters.

Example:

service dhcp
!
ip dhcp excluded-address 10.1.1.1 10.1.1.15
!
ip dhcp pool DHCP-POOL
  network 10.1.1.0 255.255.255.0
  default-router 10.1.1.1
  dns-server 8.8.8.8

The above configuration is very basic; it merely enables the DHCP service, excludes IP addresses within the range 10.1.1.1-15, and defines a single DHCP pool


No comments:

Post a Comment