Configure Cisco router as a basic DHCP server

Using a Cisco router as a DHCP server can simplify a network configuration by cetralizing DHCP services in a large network or decentralizing DHCP services to the endpoint routers at satellite locations. The ease of remote management of Cisco-based DHCP services is a great advantage.


conf t
service dhcp
ip dhcp pool 192.168.1.0/24
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 192.168.1.5 192.168.1.6
exit
ip dhcp excluded-address 192.168.1.1 192.168.1.199
ip dhcp excluded-address 192.168.1.241 192.168.1.255
^Z

This example shows a Cisco router configuration as a basic DHCP server in the 192.168.1.0/24 network. The DHCP options implemented are default-router (DHCP option 3) and dns-server (DHCP option 6). Two DNS servers are configured. With the excluded-address commands, using only ip addresses between 192.168.1.200-192.168.1.240 will be available for client use.

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.

25 Responses to “Configure Cisco router as a basic DHCP server”

  1. December 21, 2008 at 3:24 am, winelle said:

    where did you get the dns server?? and what ip should be use is it the lan or wan?

    Reply

  2. March 16, 2009 at 12:15 pm, ABC said:

    DNS Servers are manually configured by the System admin… In the above example the DNS Servers are assigned IP from the Excluded range because DNS Servers need to be configured by Static IP’s..

    Reply

  3. April 10, 2009 at 5:56 am, Sridhar V said:

    We are getting a 4 mb internet leased line to our college. We have a cisco 2600 series router. I want to config NAT as well as DNS in the router so that the clients will be given static IP address in the local LAN side with Gate way only. WIll the router be able to resolve the DNS queries of the computers. If can please give me details how to configure the above in the router.

    Reply

  4. August 19, 2009 at 4:51 pm, Buddie said:

    Is it really manadatory to configure dns server on the router along with the dhcp server.
    pls do mail me for details bfun4real@gmail.com .
    Thank u

    Reply

  5. October 17, 2009 at 5:28 am, Anonymous said:

    thanks

    Reply

  6. January 07, 2010 at 5:24 pm, abdulelah said:

    how can configruation router until don’t change ip for client inside (the ip is dhcp between range)

    Reply

  7. May 09, 2010 at 8:48 pm, Anonymous said:

    good one example

    Reply

    • February 13, 2011 at 3:17 pm, Fffff said:

      thanx

      Reply

  8. May 09, 2010 at 8:51 pm, Anonymous said:

    good one example

    Reply

  9. October 07, 2010 at 10:27 am, Armin_zakarian said:

    almost its useful you use in your configuration :

    Specify the lease duration for the addresses you’re using from the pool.

    Router(dhcp-config)#lease 7

    ## Armin Zakarian – iran ##

    Reply

    • February 26, 2013 at 7:59 am, dasoulman said:

      > for seven days

      Reply

  10. November 13, 2010 at 2:59 pm, Martin DePores said:

    How do I disable a Cisco SR2024C DHCP SERVER on this switch? I am a novice but willing to learn

    Reply

  11. December 06, 2010 at 3:55 pm, Jim Flerlage said:

    I’am new at this and not sure of a cisco 3750 swt. when plug a IP 2002 PH INTO JUST A FREE PORT i JUST GET DIAL TONE NO PROGRAM FEATURES and what program is used in the cisco router to make the phone programable. Thanks jim.

    Reply

  12. February 13, 2011 at 3:15 pm, Faizrel1 said:

    what purpose using for these IP range from it means without excluded ip mentioned above 192.168.1.200 192.168.1.240

    Reply

    • April 04, 2011 at 12:35 pm, Arutembesa said:

      Hi I have a Cisco router 878w , and I have a LAN, and I need to connect the router to my LAN and give it a DHCP wirless sercer setting , in case all the computers with wireless can get internet via my wireless router.

      Reply

  13. July 12, 2011 at 4:53 am, Gitesh said:

    My requirememnt is to install DHCP for providing the IP’s automatically.. is it necessary to install DNS with it ..if yes any guidelines to install it…

    Reply

  14. July 12, 2011 at 4:53 am, Gitesh said:

    My requirememnt is to install DHCP for providing the IP’s automatically.. is it necessary to install DNS with it ..if yes any guidelines to install it…

    Reply

    • June 11, 2012 at 7:04 am, Christian said:

      The network at your end has an ianerntl or local IP every device attached to your local IP must have different IP’s. The devices attached to your local network will have an octet sequence such as 192.xxx.xxx.xxxThis sequence forms the IP’s of your local network.Now the router also has an IP which identifies you to your ISP.You can log into the router and see it’s local web page by keying in the IP that was assigned by the ISP if the IP is dynamic the this IP can change for various reasons. If Static the IP will always be the same. If you are going to be a host then you want to request a static IP. This static IP will then be your public IP so that the outside world can reach you to access the devices attached to your local network. Such as the virtual server. Think long and hard about security. I strongly recommend putting the game side on a separate system.

      Reply

  15. April 26, 2012 at 6:43 pm, Al said:

    How do you configure a cisco 1841 to obtain an IP address and DNS addresses from an ISP using a cable modem ?

    Reply

  16. May 04, 2012 at 12:04 pm, wanyakala edwin said:

    thank you so much, we want you to help us such that we can help others too.

    Reply

  17. July 21, 2012 at 7:49 am, kabeer khan said:

    hi guys,how to configure dhcp server in layer 3 switch

    Reply

    • January 21, 2013 at 9:58 pm, schaef350 said:

      > The same way! The only difference is your network will be part of the VLAN interface rather than a specific physical interface like on a router.

      Reply

  18. January 21, 2013 at 9:56 pm, schaef350 said:

    Great stuff! This sure saved me a lot of time as the router was already part of the network…

    Reply

  19. May 29, 2013 at 3:53 pm, hamed said:

    thank its work realy nice

    Reply

  20. May 29, 2013 at 3:54 pm, hamed said:

    hey you re elite

    Reply

Leave a Reply