Configure and verify DHCP client and relay - CSU359 - Shoolini University

Configure and Verify DHCP Client and Relay

1. DHCP Client

A DHCP client is a device on a network that automatically requests IP address configuration information from a DHCP server. This process is essential for devices to join the network without manual IP configuration. Below is a detailed breakdown of how the DHCP client works and how it is configured on network devices.

1.1 How DHCP Client Works

The DHCP client operates in the following stages:

1.1.1 DHCP Client Lease Process

During the lease process, the client is temporarily assigned an IP address for a specified lease duration. Before the lease expires, the client will try to renew the lease.

1.2 Configuring DHCP Client on Cisco Routers

To configure a DHCP client on a Cisco router, follow these steps:


Router(config)# interface 
Router(config-if)# ip address dhcp
Router(config-if)# no shutdown

Explanation:

1.3 Verifying DHCP Client Configuration

Once the client is configured, you can verify the IP address assignment using the following command:


Router# show ip interface brief

This command will show the IP addresses assigned to each interface, including those obtained via DHCP.

Key Points:

2. DHCP Relay

DHCP Relay is used when the DHCP server is located on a different subnet from the client. Since DHCP Discover messages are broadcast and do not cross routers by default, a DHCP relay is necessary to forward these messages between the client and the server, enabling IP address assignment across different subnets.

2.1 How DHCP Relay Works

DHCP relay agents facilitate communication between clients and servers located on different networks. The process works as follows:

2.2 Configuring DHCP Relay on Cisco Routers

To configure a router as a DHCP relay agent, follow these steps:


Router(config)# interface 
Router(config-if)# ip helper-address 
Router(config-if)# no shutdown

Explanation:

2.2.1 Multiple DHCP Helper Addresses

You can configure multiple DHCP servers by adding additional ip helper-address commands to the same interface. The router will relay client requests to all configured DHCP servers.

2.3 Verifying DHCP Relay Configuration

Once the relay is configured, verify the setup using the following command:


Router# show ip interface 

This command will display the IP helper address configured for the interface, confirming that the relay is active.

Key Points:

3. Configure and Verify DHCP Client and Relay

Dynamic Host Configuration Protocol (DHCP) simplifies the process of assigning IP addresses to devices on a network. Instead of manual configuration, DHCP allows automatic assignment, reducing human error and network administration overhead. In this section, we will cover how to configure a DHCP client and relay, ensuring smooth IP address allocation across different networks.

3.1 DHCP Client

The DHCP client is a device or node that requests IP address information from the DHCP server. The process follows these steps:

3.1.1 Configuration of DHCP Client (Cisco Routers)

To configure a device as a DHCP client on Cisco routers, use the following steps:


Router(config)# interface 
Router(config-if)# ip address dhcp
Router(config-if)# no shutdown

This will enable DHCP on the interface, allowing it to dynamically request an IP from a DHCP server.

3.2 DHCP Relay

A DHCP relay is used when the DHCP server is located on a different network from the client. Since DHCP Discover messages are broadcast and do not traverse routers, a DHCP relay is necessary to forward these messages between clients and the server.

3.2.1 How DHCP Relay Works

The DHCP relay listens for client broadcast messages and forwards them to the DHCP server using a unicast transmission. The DHCP server then replies to the relay, which broadcasts the response back to the client. The steps involved are:

3.2.2 Configuration of DHCP Relay (Cisco Routers)

To configure a router as a DHCP relay agent, use the following commands:


Router(config)# interface 
Router(config-if)# ip helper-address 
Router(config-if)# no shutdown

This command sets up the router interface to forward DHCP requests to the specified DHCP server IP address.

3.3 Verification of DHCP Client and Relay

After configuring the DHCP client and relay, verification is essential to ensure the setup is working correctly.

3.3.1 Verifying DHCP Client

Use the following command to check the IP address assigned to the interface:


Router# show ip interface brief

This will display the IP addresses assigned to the interfaces, including the one obtained via DHCP.

3.3.2 Verifying DHCP Relay

To check if the DHCP relay is functioning, use:


Router# show ip interface 

This should show that the interface has an IP helper address configured, verifying the relay function.