7.4.1 Packet Tracer - Implement DHCPv4 (Instructor Version)

7.4.1 Packet Tracer – Implement 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 | ||
| R2 | G0/0 | 192.168.20.1 | 255.255.255.0 | N/A |
| G0/1 | DHCP Assigned | DHCP Assigned | ||
| S0/0/0 | 10.1.1.2 | 255.255.255.252 | ||
| S0/0/1 | 10.2.2.2 | 255.255.255.252 | ||
| R3 | G0/0 | 192.168.30.1 | 255.255.255.0 | N/A |
| S0/0/1 | 10.2.2.1 | 255.255.255.252 | ||
| 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
Scenario
As the network technician for your company, you are tasked with configuring a Cisco router as a DHCP server to provide dynamic allocation of addresses to clients on the network. You are also required to configure the edge router as a DHCP client so that it receives an IP address from the ISP network. Since the server is centralized, you will need to configure the two LAN routers to relay DHCP traffic between the LANs and the router that is serving as the DHCP server.
Instructions
Part 1: Configure a Router as a DHCP Server
Step 1: Configure the excluded IPv4 addresses.
Configure R2 to exclude the first 10 addresses from the R1 and R3 LANs. All other addresses should be available in the DHCP address pool.
R2(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.10
R2(config)#ip dhcp excluded-address 192.168.30.1 192.168.30.10Step 2: Create a DHCP pool on R2 for the R1 LAN.
a. Create a DHCP pool named R1-LAN. The pool name must match this value in order for you to get credit for your configuration.
b. Configure the DHCP pool to include the network address, the default gateway, and the IP address of the DNS server.
R2(config)#ip dhcp pool R1-LAN
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.254Step 3: Create a DHCP pool on R2 for the R3 LAN.
a. Create a DHCP pool named R3-LAN (case-sensitive).
b. Configure the DHCP pool to include the network address, the default gateway, and the IP address of the DNS server.
R2(config)#ip dhcp pool R3-LAN
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.254Part 2: Configure DHCP Relay
Step 1: Configure R1 and R3 as a DHCP relay agent.
R1(config)#interface g0/0
R1(config-if)#ip helper-address 10.1.1.2R3(config)#interface g0/0
R3(config-if)#ip helper-address 10.2.2.2Step 2: Set PC1 and PC2 to receive IP addressing information from DHCP.
Part 3: Configure R2 as a DHCP Client
Step 1: Configure the Gigabit Ethernet 0/1 interface on R2 to receive IP addressing from DHCP.
Step 2: Activate the interface.
R2(config)#interface g0/1
R2(config-if)#ip address dhcp
R2(config-if)#no shutdownDevice Configs - Final
Router R1
! ============================================================== !--- 7.4.1 Packet Tracer - Implement DHCPv4 !--- ANSWER SCRIPT FOR ROUTER R1 !--- Usage: from the console (or a Telnet/SSH session, if already reachable) on R1, enter privileged EXEC mode with "enable", then paste this whole file. Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. This script assumes R1's LAN/WAN interfaces are already up and addressed from a previous activity - it only adds the DHCP relay command this lab actually asks for. !--- R1's LAN (192.168.10.0/24) has no local DHCP server - PC1 needs to reach the DHCP pool configured on R2, across the R1-R2 serial link. ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 2: Configure the DHCP relay (helper address) on the LAN interface ! -------------------------------------------------------------- !--- Points at R2's S0/0/0 address (the serial interface facing R1) - DHCP broadcasts from PC1 get relayed there and processed by R2's R1-LAN pool. interface GigabitEthernet0/0 ip helper-address 10.1.1.2 end ! -------------------------------------------------------------- !--- Operational habit (not explicitly required by this lab): save to NVRAM. (Press Enter when prompted for the destination filename.) ! -------------------------------------------------------------- copy running-config startup-config ! ============================================================== !--- Verification: !--- R1# show running-config interface g0/0 -> shows "ip helper-address 10.1.1.2" !--- From PC1, set NIC to DHCP -> should receive an address in 192.168.10.11-254 (per the excluded range configured on R2), gateway 192.168.10.1, DNS 192.168.20.254 ! ==============================================================
Router R2
! ============================================================== !--- 7.4.1 Packet Tracer - Implement DHCPv4 !--- ANSWER SCRIPT FOR ROUTER R2 !--- Usage: from the console (or a Telnet/SSH session, if already reachable) on R2, enter privileged EXEC mode with "enable", then paste this whole file. Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. This script assumes R2's LAN/WAN interfaces are already up and addressed from a previous activity (except G0/1, which this lab brings up via DHCP) - it only adds the DHCP server and DHCP client commands this lab actually asks for. !--- R2 plays two DHCP roles here: it's the DHCP SERVER for both R1's and R3's remote LANs (reached via relay), and it's a DHCP CLIENT itself on G0/1, getting its own address from the ISP. ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 1, Step 1: Exclude statically-assigned addresses from both pools ! -------------------------------------------------------------- !--- Excludes the first 10 addresses of each remote LAN so the DHCP pools never hand these out - "all other addresses should be available" per the Instructions. ip dhcp excluded-address 192.168.10.1 192.168.10.10 ip dhcp excluded-address 192.168.30.1 192.168.30.10 ! -------------------------------------------------------------- !--- Part 1, Step 2: Create the DHCP pool for the R1 LAN ! -------------------------------------------------------------- !--- Pool name must be exactly "R1-LAN" (case-sensitive) for grading. 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 ! -------------------------------------------------------------- !--- Part 1, Step 3: Create the DHCP pool for the R3 LAN ! -------------------------------------------------------------- !--- Pool name must be exactly "R3-LAN" (case-sensitive) for grading. 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 ! -------------------------------------------------------------- !--- Part 3: Configure R2 itself as a DHCP client toward the ISP, then activate it ! -------------------------------------------------------------- !--- G0/1 pulls its own address from the ISP's DHCP server instead of a static one. The Instructions call out "Activate the interface" as its own separate step (3.2) - "no shutdown" is required here since the interface starts administratively down; without it, DHCP negotiation never begins. interface GigabitEthernet0/1 ip address dhcp no shutdown end ! -------------------------------------------------------------- !--- Operational habit (not explicitly required by this lab): save to NVRAM. (Press Enter when prompted for the destination filename.) ! -------------------------------------------------------------- copy running-config startup-config ! ============================================================== !--- Verification: !--- R2# show ip dhcp binding -> shows leases for PC1 (192.168.10.11) and PC2 (192.168.30.11) !--- R2# show ip interface brief -> G0/1 shows an address learned from the ISP (use Packet Tracer's "Fast Forward Time" to speed this up) !--- From PC1, set NIC to DHCP -> receives 192.168.10.11+, gateway 192.168.10.1, DNS 192.168.20.254 !--- From PC2, set NIC to DHCP -> receives 192.168.30.11+, gateway 192.168.30.1, DNS 192.168.20.254 ! ==============================================================
Router R3
! ============================================================== !--- 7.4.1 Packet Tracer - Implement DHCPv4 !--- ANSWER SCRIPT FOR ROUTER R3 !--- Usage: from the console (or a Telnet/SSH session, if already reachable) on R3, enter privileged EXEC mode with "enable", then paste this whole file. Every line beginning with "!" is a comment; IOS ignores it, so pasting a comment by accident is harmless. This script assumes R3's LAN/WAN interfaces are already up and addressed from a previous activity - it only adds the DHCP relay command this lab actually asks for. !--- R3's LAN (192.168.30.0/24) has no local DHCP server - PC2 needs to reach the DHCP pool configured on R2, across the R3-R2 serial link. ! ============================================================== enable configure terminal ! -------------------------------------------------------------- !--- Part 2: Configure the DHCP relay (helper address) on the LAN interface ! -------------------------------------------------------------- !--- Points at R2's S0/0/1 address (the serial interface facing R3) - DHCP broadcasts from PC2 get relayed there and processed by R2's R3-LAN pool. interface GigabitEthernet0/0 ip helper-address 10.2.2.2 end ! -------------------------------------------------------------- !--- Operational habit (not explicitly required by this lab): save to NVRAM. (Press Enter when prompted for the destination filename.) ! -------------------------------------------------------------- copy running-config startup-config ! ============================================================== !--- Verification: !--- R3# show running-config interface g0/0 -> shows "ip helper-address 10.2.2.2" !--- From PC2, set NIC to DHCP -> should receive an address in 192.168.30.11-254, gateway 192.168.30.1, DNS 192.168.20.254 ! ==============================================================




