7.2.10 Packet Tracer - Configure DHCPv4 Answers
Topology

7.2.10 Packet Tracer - Configure DHCPv4
Addressing Table
| Device | Interface | IPv4 Address | Subnet Mask | Default Gateway |
|---|---|---|---|---|
| R1 | G0/0 | 192.168.10.1 | 255.255.255.0 | N/A |
| S0/0/0 | 10.1.1.1 | 255.255.255.252 | N/A | |
| R2 | G0/0 | 192.168.20.1 | 255.255.255.0 | N/A |
| G0/1 | DHCP Assigned | DHCP Assigned | N/A | |
| S0/0/0 | 10.1.1.2 | 255.255.255.252 | N/A | |
| S0/0/1 | 10.2.2.2 | 255.255.255.252 | N/A | |
| R3 | G0/0 | 192.168.30.1 | 255.255.255.0 | N/A |
| S0/0/1 | 10.2.2.1 | 255.255.255.252 | N/A | |
| PC1 | NIC | DHCP Assigned | DHCP Assigned | DHCP Assigned |
| PC2 | NIC | DHCP Assigned | DHCP Assigned | DHCP Assigned |
| DNS Server | NIC | 192.168.20.254 | 255.255.255.0 | 192.168.20.1 |
Objectives
- Part 1: Configure a Router as a DHCP Server
- Part 2: Configure DHCP Relay
- Part 3: Configure a Router as a DHCP Client
- Part 4: Verify DHCP and Connectivity
Scenario
A dedicated DHCP server is scalable and relatively easy to manage but it can be costly to have one at every location in a network. However, a Cisco router can be configured to provide DHCP services without the need for a dedicated server. As the network technician for your company, you have been assigned the task of configuring a Cisco router as a DHCP server. You are also required to configure the edge router as a DHCP client so that it receives an IP address from the ISP network.
Instructions
Part 1: Configure a Router as a DHCP Server
Step 1: Configure the excluded IPv4 addresses.
Addresses that have been statically assigned to devices in the networks that will use DHCP must be excluded from the DHCP pools. This avoids errors associated with duplicate IP addresses. In this case the IP addresses of the R1 and R3 LAN interfaces must be excluded from DHCP. In addition, nine other addresses are excluded for static assignment to other devices such as servers and device management interfaces.
a. Configure R2 to exclude the first 10 addresses from the R1 LAN.
R2(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
b. Configure R2 to exclude the first 10 addresses from R3 LAN.
R2(config)# ip dhcp excluded-address 192.168.30.1 192.168.30.10
Step 2: Create a DHCP pool on R2 for the R1 LAN.
a. Create a DHCP pool named R1-LAN (case-sensitive).
R2(config)# ip dhcp pool R1-LAN
b. Configure the DHCP pool to include the network address, the default gateway, and the IP address of the DNS server.
R2(dhcp-config)# network 192.168.10.0 255.255.255.0 R2(dhcp-config)# default-router 192.168.10.1 R2(dhcp-config)# dns-server 192.168.20.254
Step 3: Create a DHCP pool on R2 for the R3 LAN.
a. Create a DHCP pool named R3-LAN (case-sensitive).
R2(config)# ip dhcp pool R3-LAN
b. Configure the DHCP pool to include the network address, the default gateway, and the IP address of the DNS server. Refer to the Addressing Table.
R2(dhcp-config)# network 192.168.30.0 255.255.255.0 R2(dhcp-config)# default-router 192.168.30.1 R2(dhcp-config)# dns-server 192.168.20.254
Part 2: Configure DHCP Relay
Step 1: Configure R1 and R3 as a DHCP relay agent.
For DHCP clients to obtain an address from a server on a different LAN segment, the interface that the clients are attached to must include a helper address pointing to the DHCP server. In this case, the hosts on the LANs that are attached to R1 and R3 will access the DHCP server that is configured on R2. The IP addresses of the R2 serial interfaces that are attached to R1 and R3 are used as the helper addresses. DHCP traffic from the hosts on the R1 and R3 LANs will be forwarded to these addresses and processed by the DHCP server that is configured on R2.
a. Configure the helper address for the LAN interface on R1.
R1(config)# interface gigabitethernet 0/0 R1(config-if)# ip helper-address 10.1.1.2
b. Configure the helper address for the LAN interface on R3.
R3(config)# interface gigabitethernet 0/0 R3(config-if)# ip helper-address 10.2.2.2
Step 2: Configure hosts to receive IP addressing information from DHCP.
a. Configure hosts PC1 and PC2 to receive their IP addresses from a DHCP server.
b. Verify that the hosts have received their addresses from the correct DHCP pools.
Part 3: Configure a Router as a DHCP Client
Just as a PC is able to receive an IPv4 address from a server, a router interface has the ability to do the same. Router R2 needs to be configured to receive addressing from the ISP.
a. Configure the Gigabit Ethernet 0/1 interface on R2 to receive IP addressing from DHCP and activate the interface.
R2(config)# interface gigabitethernet 0/1 R2(config-if)# ip address dhcp R2(config-if)# no shutdown
Note: Use Packet Tracer Fast Forward Time feature to speed up the process.

b. Use the show ip interface brief command to verify that R2 received an IP address from DHCP.
R2# show ip interface brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 192.168.20.1 YES manual up up
GigabitEthernet0/1 209.165.200.231 YES DHCP up up
Serial0/0/0 10.1.1.2 YES manual up up
Serial0/0/1 10.2.2.2 YES manual up up
Serial0/1/0 unassigned YES unset down down
Serial0/1/1 unassigned YES unset down down
Vlan1 unassigned YES unset administratively down downPart 4: Verify DHCP and Connectivity
Step 1: Verify DHCP bindings.
R2# show ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
192.168.10.11 0002.4AA5.1470 -- Automatic
192.168.30.11 0004.9A97.2535 -- AutomaticStep 2: Verify configurations.
Verify that PC1 and PC2 can now ping each other and all other devices.
Device Configs - Final
ROUTER R1
! ============================================================== !--- 7.2.10 Packet Tracer - Configure DHCPv4 !--- ANSWER SCRIPT FOR ROUTER R1 !--- Usage: copy this whole file and paste it into the R1 terminal (start at the R1> prompt). Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 2: Configure DHCP Relay. ! -------------------------------------------------------------- !--- Step 1a. Helper address on the LAN interface: R2 S0/0/0 (10.1.1.2), so PC1 DHCP requests reach the R1-LAN pool on R2. interface gigabitethernet 0/0 ip helper-address 10.1.1.2 exit end ! -------------------------------------------------------------- !--- Save the configuration to NVRAM. (Press Enter when prompted for the destination filename.) ! -------------------------------------------------------------- copy running-config startup-config ! ============================================================== !--- Verification: !--- show running-config interface gigabitethernet 0/0 -> ip helper-address 10.1.1.2 !--- PC1 (DHCP) -> 192.168.10.11, gateway 192.168.10.1, DNS 192.168.20.254 ! ==============================================================
ROUTER R2
! ============================================================== !--- 7.2.10 Packet Tracer - Configure DHCPv4 !--- ANSWER SCRIPT FOR ROUTER R2 !--- Usage: copy this whole file and paste it into the R2 terminal (start at the R2> prompt). Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 1: Configure a Router as a DHCP Server. ! -------------------------------------------------------------- !--- Step 1a. Exclude the first 10 addresses of the R1 LAN. ip dhcp excluded-address 192.168.10.1 192.168.10.10 !--- Step 1b. Exclude the first 10 addresses of the R3 LAN. ip dhcp excluded-address 192.168.30.1 192.168.30.10 !--- Step 2. DHCP pool R1-LAN (case-sensitive): network, default gateway and DNS server. ip dhcp pool R1-LAN network 192.168.10.0 255.255.255.0 default-router 192.168.10.1 dns-server 192.168.20.254 exit !--- Step 3. DHCP pool R3-LAN (case-sensitive): network, default gateway and DNS server. ip dhcp pool R3-LAN network 192.168.30.0 255.255.255.0 default-router 192.168.30.1 dns-server 192.168.20.254 exit ! -------------------------------------------------------------- !--- Part 3: Configure a Router as a DHCP Client. ! -------------------------------------------------------------- !--- a. G0/1 receives its IP addressing from the ISP by DHCP and is activated. interface gigabitethernet 0/1 ip address dhcp no shutdown exit end ! -------------------------------------------------------------- !--- Save the configuration to NVRAM. (Press Enter when prompted for the destination filename.) ! -------------------------------------------------------------- copy running-config startup-config ! ============================================================== !--- Verification: !--- show ip interface brief -> GigabitEthernet0/1 209.165.200.x YES DHCP up up (use Fast Forward Time) !--- show ip dhcp binding -> 192.168.10.11 (PC1) and 192.168.30.11 (PC2), type Automatic ! ==============================================================
ROUTER R3
! ============================================================== !--- 7.2.10 Packet Tracer - Configure DHCPv4 !--- ANSWER SCRIPT FOR ROUTER R3 !--- Usage: copy this whole file and paste it into the R3 terminal (start at the R3> prompt). Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 2: Configure DHCP Relay. ! -------------------------------------------------------------- !--- Step 1b. Helper address on the LAN interface: R2 S0/0/1 (10.2.2.2), so PC2 DHCP requests reach the R3-LAN pool on R2. interface gigabitethernet 0/0 ip helper-address 10.2.2.2 exit end ! -------------------------------------------------------------- !--- Save the configuration to NVRAM. (Press Enter when prompted for the destination filename.) ! -------------------------------------------------------------- copy running-config startup-config ! ============================================================== !--- Verification: !--- show running-config interface gigabitethernet 0/0 -> ip helper-address 10.2.2.2 !--- PC2 (DHCP) -> 192.168.30.11, gateway 192.168.30.1, DNS 192.168.20.254 ! ==============================================================






