|
DHCP stands for Dynamic Host Configuration Protocol. It is a service which allows you to configure TCP/ IP settings such as IP address and subnet mask on the clients (PC, laptop, printer, etc.) automatically. Typically, DHCP is configured on a dedicated server for better performance. The server can be either Windows-based or Linux-based.
To perform this exercise, we will use the following topology.
First, add the required devices in Cico Packet Tracer and connect them appropriatley. In the preceding topology, Router1 will act as DHCP server while Router2 and PC1 will act as DCHP clients. Let’s begin the exercise.
1. On Router1, execute the following commands to configure an IP address.
Router( config)# int fa0/ 0
Router( config-if)# ip add 10.0.0.1 255.0.0.0
Router( config-if)# no shut
2. Next, create a DHCP pool named DhcpPool1. Use 10.0.0.1 IP address as the default gateway and DNS server. Use 10.0.0.0 255.0.0.0 as network ID.
Router( config)# ip dhcp pool DhcpPool1
Router( dhcp-config)# default-router 10.0.0.1
Router( dhcp-config)# dns-server 10.0.0.1
Router( dhcp-config)# network 10.0.0.0 255.0.0.0
Router( dhcp-config)# exit
By default DHCP server will start to assign IP addresses from the first IP address of the assigned network ID and it will be 10.0.0.1/ 8. However, we have already configured this IP addresses manually on Fa0/ 0 interface of Router1. To avoid the confliction between DHCP assigned and manually assigned IP addresses, you can exclude one or more specific IP addresses or IP ranges from the DHCP pool. DHCP server will not distribute these IP addresses to any of the DHCP client.
3. The following commands will exclude 10.0.0.0.1 to 10.0.0.100 IP addresses that will not be distributed by DHCP server.
Router( config)# ip dhcp excluded-address 10.0.0.1 10.0.0.100
Router( config)# exit
4. On Router2, we will assign an IPv4 address on the Fa0/ 0 interface through the DHCP server. To do this, execute the following commands.
Router( config)# int fa0/ 0
Router( config-if)# ip add dhcp
Router( config-if)# no shut
5. Wait for a few seconds and then execute the following command to view the IP address on Router2.
Router2# show ip int brief
or
Router2( config)# do show ip int brief
Note: Adding the do command before the show command allows you to execute privilege mode commands from the global configuration mode.
7. After a few seconds, DHCP server will assign an IP address from the configured DHCP pool along with a default gateway and DNS server IP addresses.
8. In the preceding figure, you can see that 10.0.0.102 IP address has been assigned by the DHCP server.
9. To verify the connectivity between PC1 and Router1, execute the following command at the Command Prompt window.
Ping 10.0.0.1
10. You should be able to ping successfully, as shown in the following figure.
11. Save the configuration of each device and also save the topology and name is as DHCP Topology.
|
|