DHCP Configuration 1
Topology

Tasks:
Configure a Layer 3 switch to act as a DHCP client to obtain an IP address from a DHCP server. The DHCP server is already configured and inaccessible. The Layer 3 switch will also act as a DHCP relay agent to forward DHCP requests from a connected PC (PC1) to the DHCP server.
- Configure the SW1 to act as a DHCP client on FastEthernet0/1 interface to get its IP address from the DHCP server.
- Configure the SW1 switch to act as a DHCP relay agent to forward DHCP requests from PC1 to the DHCP server.
- Configure PC1 to obtain its IP address dynamically via DHCP.
- A ping must be successful from PC1 to the DHCP server.
Solution:
Task 1:
Configure the SW1 to act as a DHCP client on FastEthernet0/1 interface to get
its IP address from the DHCP server.
The SW1 is
connected to the DHCP server on interface FastEthernet0/1.
SW1#configure terminal
SW1(config)#ip routing
SW1(config)#int f0/1
SW1(config-if)#no switchport
SW1(config-if)#ip address dhcp
SW1(config-if)#end
ip address dhcp configures the
switch interface as a DHCP client to dynamically obtain an IP address from a
DHCP server.
ip routing enables Layer 3 functionality on the switch,
allowing it to route traffic between subnets or VLANs.
no switchport Converts the specified interface
(FastEthernet0/1) from a Layer 2 switchport to a Layer 3 routed port, enabling
it to participate in Layer 3 routing.
Verification
SW1 should have an IP address of 192.168.1.2 on
FastEthernet0/1.
SW1#show
ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/1 192.168.1.2 YES DHCP
up up
---output
omitted---
Vlan10 192.168.2.1 YES manual up up
Task 2:
Configure the SW1 switch to act as a DHCP relay agent to forward DHCP requests
from PC1 to the DHCP server.
SW1 is
connected to PC1 via a VLAN 10 access port. From the output of the show ip interface
brief command, we can see that VLAN 10 already has an
IP address assigned. Therefore, we don’t need to assign it manually. However,
if it does not have an IP address, we will need to configure it first.
SW1(config)#int vlan 10
SW1(config-if)#ip helper-address 192.168.1.1
SW1(config-if)#exit
ip helper-address 192.168.1.1 configures the
switch to forward DHCP requests from VLAN 10 to the DHCP server at 192.168.1.1.
Task 3:
Configure PC1 to obtain its IP address dynamically via DHCP.
PC1 should have
a link-local address configured by default. We need to renew the IP
configuration on PC1.
PC1:\>ipconfig
/renew
IP
Address.................: 192.168.2.3
Subnet
Mask................: 255.255.255.0
Default
Gateway............: 192.168.2.1
DNS
Server.................: 8.8.8.8
This command is
used on a PC to request a new IP address from a DHCP server. It forces the
client to release its current IP address (if any) and renew it by communicating
with the DHCP server. The new IP address and related network configuration
details (subnet mask, default gateway, DNS server) are obtained and applied to
the system.
Task 4: A ping
must be successful from PC1 to the DHCP server.
PC1:\> ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.1: bytes=32 time=26ms TTL=115
Reply from 192.168.1.1: bytes=32 time=24ms TTL=115
Reply from 192.168.1.1: bytes=32 time=25ms TTL=115
Now exit
configuration mode and save the configuration.
SW1(config)#end
SW1#write memory
Packet Tracer File
Clicking this button will begin the download of a ZIP file. Inside the ZIP file, you'll find a Packet Tracer Activity (.pka) file, which will automatically track your progress as you configure the network.