← All labs Lab 9 · Packet Tracer

DHCP server on the router

Excluded addresses, pool, default gateway and DNS

Level: Beginner Time: 20 min Domain 4.0 IP Services

Scenario

The PCs on LAN 192.168.1.0/24 are set to get their IP through DHCP, but nobody answers. R1 will be the server.

Reserve addresses 192.168.1.1 to 192.168.1.10 for statically addressed devices and create a pool named LAN that hands out the rest, with 192.168.1.1 as the default gateway and 8.8.8.8 as DNS.

Watch out: if a PC gets its IP before you finish the pool, it'll lack a gateway or DNS. On its console, ipconfig /renew asks again.

Topology

R1SW1PC1PC2Gi0/0Gi0/1Fa0Fa0/1Fa0Fa0/2

Devices and cabling

FromToCable
R1 Gi0/0SW1 Gi0/1Straight-through
PC1 Fa0SW1 Fa0/1Straight-through
PC2 Fa0SW1 Fa0/2Straight-through

If in doubt, the automatic connection cable (the lightning bolt) picks the right one. Rule: straight-through between different devices (PC or router to switch) and crossover between alike ones.

Addressing

DeviceInterfaceAddressMaskDefault gateway
R1G0/0192.168.1.1255.255.255.0—
PC1NICDHCPDHCPDHCP
PC2NICDHCPDHCPDHCP

Starting configuration

In the app this is already done. In Packet Tracer, before you start, enter each device with enable and configure terminal and type (or paste) these lines.

R1hostname R1 no ip domain-lookup interface g0/0 ip address 192.168.1.1 255.255.255.0 no shutdown
SW1hostname SW1 no ip domain-lookup

PCs and servers (Desktop › IP Configuration)

Tasks

What must end up working. In the app, each one ticks itself off as soon as you get it.

  1. 192.168.1.1 to 192.168.1.10 excluded
  2. Pool LAN with network 192.168.1.0/24
  3. The pool hands out 192.168.1.1 as gateway
  4. The pool hands out 8.8.8.8 as DNS
  5. PC1 and PC2 get an IP, gateway and DNS
  6. Checked with show ip dhcp binding
In Packet Tracer
  • On each PC, go to Desktop › IP Configuration and choose DHCP. You can also use ipconfig /renew in Command Prompt.
Hints
  • 192.168.1.1 to 192.168.1.10 excluded: ip dhcp excluded-address 192.168.1.1 192.168.1.10 (in global config, not inside the pool)
  • Pool LAN with network 192.168.1.0/24: ip dhcp pool LAN → network 192.168.1.0 255.255.255.0
  • The pool hands out 192.168.1.1 as gateway: Inside the pool: default-router 192.168.1.1
  • The pool hands out 8.8.8.8 as DNS: Inside the pool: dns-server 8.8.8.8
  • PC1 and PC2 get an IP, gateway and DNS: Check their settings with ipconfig /all. If something's missing, ipconfig /renew.
  • Checked with show ip dhcp binding: show ip dhcp binding on R1

Step-by-step solution

Try it on your own first: you learn much more by typing the commands yourself.

Show the solution

1Reserve the static addresses R1

Excluded addresses are configured outside the pool, in global mode. Here they're kept for the router and other statically addressed devices.

R1enable configure terminal ip dhcp excluded-address 192.168.1.1 192.168.1.10

2Create the pool R1

network defines what is handed out; default-router and dns-server, what each PC gets besides the IP.

R1ip dhcp pool LAN network 192.168.1.0 255.255.255.0 default-router 192.168.1.1 dns-server 8.8.8.8 end

3Request the IP on the PCs PC1

If a PC requested its IP before the pool was finished, it will lack a gateway or DNS until it asks again.

PC1ipconfig /renew

4And on PC2 PC2

PC2ipconfig /renew

Verification

Each lease binds an IP (from .11 onward) to the PC's MAC.

R1R1#show ip dhcp binding IP address Client-ID/ Lease expiration Type Hardware address 192.168.1.11 00D0.AF38.7A1A -- Automatic 192.168.1.12 0001.30DB.97A9 -- Automatic

The PC shows its IP, the default gateway, the DHCP server and the DNS the router gave it.

PC1C:\>ipconfig /all FastEthernet0 Connection:(default port) Connection-specific DNS Suffix..: Physical Address................: 00D0.AF38.7A1A Link-local IPv6 Address.........: FE80::2D0:AFFF:FE38:7A1A IPv6 Address....................: :: IPv4 Address....................: 192.168.1.11 Subnet Mask.....................: 255.255.255.0 Default Gateway.................: :: 192.168.1.1 DHCP Servers....................: 192.168.1.1 DNS Servers.....................: :: 8.8.8.8

Common mistakes

Practice this lab on your phone

RoutingLab has this lab with a simulated IOS terminal: abbreviations, ? help, the same error messages and objectives that check themselves. The first two labs are free.

Get RoutingLab