Setting up router as a DHCP server on packet tracer for a 2811 router and 3 hosts

cisco-iospacket-tracer

I am trying a configure a 2811 Cisco router on packet tracer to be a DHCP server for 3 hosts.

Here is the running config I have as of now:

Building configuration...

Current configuration : 657 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname r1
!
!
!
!
!
ip dhcp pool stackexchange
 network 192.168.0.0 255.255.255.0
 default-router 192.168.0.1
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 192.168.0.1 255.255.255.0
 duplex auto

The configuration is as suggested by @Andrey Prokhorov but now I found no "lease" command.

enter image description here

I must be able to have the DHCP service working on all 3 host.

enter image description here

Best Answer

Lets assume you want to deliver IP addresses to your interface Gi0/0 (addr 192.168.0.1) network 192.168.0.0/24, also you have DNS server 192.168.0.5. Then you should define DHCP pool with options:

service dhcp
ip dhcp pool NET_192.168.0.0
 network 192.168.0.0 255.255.255.0
 default-router 192.168.0.1
 dns-server 192.168.0.5
 lease 7
 domain-name net.local

This will enable DHCP service for your 192.168.0.0/24 network with lease time for each address in 7 days.

Also, you can exclude IP addresses from distributed scope by entering command:

ip dhcp excluded-address 192.168.0.1 192.168.0.10

This will prevent issuance of addresses 192.168.0.1 thru 192.168.0.10. You can add many of that entries. Exclude records can consist of only one address:

ip dhcp excluded-address 192.168.0.200

You can find more about configuring DHCP server in Cisco IOS here - Configuring DHCP