Monday, May 10, 2010

Dynamic Host Configuration Protocol (DHCP)

Dynamic Host Configuration Protocol (DHCP)

DHCP Description:

• DHCP works in a client/server mode. DHCP enables DHCP clients on an IP network to obtain their configurations from a DHCP server.

• DHCP is not intended for configuring routers, switches, and servers. These type of hosts need to have static IP addresses.

• DHCP works by providing a process for a server to allocate IP information to clients. Clients lease the information from the server for an administratively defined period. When the lease expires the client must ask for another address, although the client is typically reassigned the same address. Administrators typically prefer a network server to offer DHCP services because these solutions are scalable and relatively easy to manage. Cisco routers can use a Cisco IOS feature set, Easy IP, to offer an optional, full-featured DHCP server.

• Administrators set up DHCP servers to assign addresses from predefined pools. DHCP servers can also offer other information, such as DNS server addresses, WINS server addresses, and domain names. Most DHCP servers also allow the administrator to define specifically what client MAC addresses can be serviced and automatically assign them the same IP address each time. DHCP uses User Datagram Protocol (UDP) as its transport protocol. The client sends messages to the server on port 67. The server sends messages to the client on port 68.
What can DHCP offer to clients:
• IP address
• Gateway address
• Subnet mask
• DNS server address
• WINS server address
• Domain name and address
• And many other parameters

Camparing BOOTP and DHCP:

BOOTP and DHCP share some operational characteristics. Both protocols are client/server based and use UDP ports 67 and 68. Those ports are still known as BOOTP ports.
The four basic IP parameters that BOOTP offer:
• IP address
• Gateway address
• Subnet mask
• DNS server address

BOOTP does not dynamically allocate IP addresses to a host. When a client requests an IP address, the BOOTP server searches a predefined table for an entry that matches the MAC address for the client. If an entry exists, then the corresponding IP address for that entry is returned to the client. This means that the binding between the MAC address and the IP address must have already been configured in the BOOTP server.
DHCP operation:
The DHCP client configuration process uses the following steps:
1. A client must have DHCP configured when starting the network membership process. The client sends a request to a server requesting an IP configuration. Sometimes the client may suggest the IP address it wants, such as when requesting an extension to a DHCP lease. The client locates a DHCP server by sending a broadcast called a DHCPDISCOVER.
2. When the server receives the broadcast, it determines whether it can service the request from its own database. If it cannot, the server may forward the request on to another DHCP server. If it can, the DHCP server offers the client IP configuration information in the form of a unicast DHCPOFFER. The DHCPOFFER is a proposed configuration that may include IP address, DNS server address, and lease time.
3. If the client finds the offer agreeable, it will send another broadcast, a DHCPREQUEST, specifically requesting those particular IP parameters. Why does the client broadcast the request instead of unicasting it to the server? A broadcast is used because the first message, the DHCPDISCOVER, may have reached more than one DHCP server. If more than one server makes an offer, the broadcasted DHCPREQUEST allows the other servers to know which offer was accepted. The offer accepted is usually the first offer received.
4. The server that receives the DHCPREQUEST makes the configuration official by sending a unicast acknowledgment, the DHCPACK. It is possible, but highly unlikely, that the server will not send the DHCPACK. This may happen because the server may have leased that information to another client in the interim. Receipt of the DHCPACK message enables the client to begin using the assigned address immediately.
5. If the client detects that the address is already in use on the local segment it will send a DHCPDECLINE message and the process starts again. If the client received a DHCPNACK from the server after sending the DHCPREQUEST, then it will restart the process again.
6. If the client no longer needs the IP address, the client sends a DHCPRELEASE message to the server.
Depending on an organization's policies, it may be possible for an end user or an administrator to statically assign a host an IP address that belongs in the DHCP servers

address pool. Just in case, the Cisco IOS DHCP server always checks to make sure that an address is not in use before the server offers it to a client. The server will issue an ICMP echo request, or will ping, to a pool address before sending the DHCPOFFER to a client. Although configurable, the default number of pings used to check for a potential IP address conflict is two.
DHCP Relay:
DHCP clients use IP broadcasts to find the DHCP server on the segment. What happens when the server and the client are not on the same segment and are separated by a router? Routers do not forward these broadcasts.
However, routers, by default, will not forward client broadcasts beyond their subnet.
Because some clients are useless without services such as DHCP, one of two choices must be implemented. The administrator will need to place servers on all subnets or use the Cisco IOS helper address feature. Running services such as DHCP or DNS on several computers creates overhead and administrative difficulties making the first option inefficient. When possible, administrators should use the ip helper-address command to relay broadcast requests for these key UDP services.
By using the helper address feature, a router can be configured to accept a broadcast request for a UDP service and then forward it as a unicast to a specific IP address. By default, the ip helper-address command forwards the following eight UDP services:
• Time
• TACACS
• DNS
• BOOTP/DHCP Server
• BOOTP/DHCP Client
• TFTP
• NetBIOS Name Service
• NetBIOS datagram Service

Configuring DHCP
The DHCP service is enabled by default on versions of Cisco IOS that support it. To disable the service, use the no service dhcp command. Use the service dhcp global configuration command to re-enable the DHCP server process.
Below is an example for DHCP configuration.
DHCPRouter(config)#ip dhcp pool LAN1 * LAN1 is pool name
DHCPRouter(dhcp-config)#network 172.16.12.0 255.255.255.0
DHCPRouter(dhcp-config)#default-router 172.16.12.1 *Gateway
DHCPRouter(dhcp-config)#dns-server 172.16.1.2
DHCPRouter(dhcp-config)#domain-name cisco.com
DHCPRouter(dhcp-config)#netbios-name-server 172.16.12.10
DHCPRouter(dhcp-config)#exit
DHCPRouter(config)#ip dhcp excluded-address 172.16.12.1 172.16.12.10
Note: The excluded-address is a range or a single IP address that you don’t want to be assigned by DHCP, such as router interface address, servers addresses,..etc.
Verifying DHCP operation
Router#show ip dhcp binding
Router#show ip dhcp server statistics

DHCP Relay Configration:
RouterA(config)#int e0
RouterA(config-if)#ip helper-address 172.24.1.9
OR
RouterA(config)#int e1
RouterA(config-if)#ip directed-broadcast
RouterA(config)#int e0
RouterA(config-if)#ip helper-address 172.24.1.255

Reference - Eng. Mohammed Alani by certificationist.com

No comments:

Post a Comment