Get My Exclusive FREE 7-Part Report,
"How To Pass The CCNA", Daily FREE
Cisco And CompTIA Exam Questions,
And All The Latest Certification News
In My Daily Newsletter!

Privacy Policy

Name:
Email:
  More Testimonials >
Visit my blog for free daily Cisco CCNA and CCNP certification questions, my latest free articles and tutorials, and more!


 

Cisco CCNP BSCI Exam Tutorial For The 642-901 Exam:

Configuring A Cisco Router As A DHCP Server

By Chris Bryant, CCIE #12933

Careful planning is the first step to success when working with Cisco routers, and that's particularly true of a DHCP deployment.  We may have a situation where we want to exclude a certain range of addresses from the DHCP pool, and oddly enough, we need to do that in global configuration mode. 

Let's say we are going to assign addresses to DHCP clients from the 11.0.0.0 /8 range, but we don't want to assign the addresses 11.1.1.1 - 11.1.1.255.  We need to use the ip dhcp excluded-address command to do that, and again, that's a global command.  (I mention that twice because that drives everyone crazy - it's very easy to forget!)

R1(config)#ip dhcp excluded-address ?
  A.B.C.D  Low IP address

R1(config)#ip dhcp excluded-address 11.1.1.1 ?
  A.B.C.D  High IP address
  <cr>

R1(config)#ip dhcp excluded-address 11.1.1.1 11.1.1.255 ?
  <cr>

R1(config)#ip dhcp excluded-address 11.1.1.1 11.1.1.255

Note that there are no masks used in this command - just the numerically lowest and highest IP addresses in the excluded range.

We're ready to create the DHCP pool!   We enter DHCP config mode with the ip dhcp pool command, followed by the name we want the pool to have.

R1(config)#ip dhcp pool ?
  WORD  Pool name

R1(config)#ip dhcp pool NETWORK11
R1(dhcp-config)#

The range of addresses to be assigned to the clients is defined with the network command.  Note that for the mask, we're given the option of entering the value in either prefix notation or the more familiar dotted decimal.

R1(dhcp-config)#network ?
  A.B.C.D  Network number in dotted-decimal notation

R1(dhcp-config)#network 11.0.0.0 ?
  /nn or A.B.C.D  Network mask or prefix length
  <cr>

R1(dhcp-config)#network 11.0.0.0 /8

We can specify a domain name with the domain-name command, and give the clients the location of DNS servers with the dns-server command.  The DNS servers can be referred to by either their hostname or IP address.

R1(dhcp-config)#domain-name ?
  WORD  Domain name

R1(dhcp-config)#domain-name bryantadvantage.com

R1(dhcp-config)#dns-server ?
  Hostname or A.B.C.D  Server's name or IP address

R1(dhcp-config)#dns-server 11.1.1.255

To specify a default router for the clients, use the default-router command. 

R1(dhcp-config)#default-router ?
  Hostname or A.B.C.D  Router's name or IP address

R1(dhcp-config)#default-router 11.1.1.100

You can also use the netbios-name-server and netbios-node-type commands as needed for Microsoft DHCP clients.  The netbios-name-server command indicates the location of WINS servers.  Note that the netbios-name-server commands allows more than one WINS server to be specified with a single command.

R1(dhcp-config)#netbios-name-server ?
  Hostname or A.B.C.D  Server's name or IP address

R1(dhcp-config)#netbios-name-server 11.1.1.51 ?
  Hostname or A.B.C.D  Server's name or IP address
  <cr>

R1(dhcp-config)#netbios-name-server 11.1.1.51 11.1.1.52

R1(dhcp-config)#netbios-node-type ?
  <0-FF>  Hexadecimal number
  b-node  Broadcast node
  h-node  Hybrid node
  m-node  Mixed node
  p-node  Peer-to-peer node

Not only can you specify the length of the DHCP address lease, you can be really specific about that value - down to the minute!  The lease can also be made indefinite with the infinite option.

R1(dhcp-config)#lease ?
  <0-365>   Days
  infinite  Infinite lease

R1(dhcp-config)#lease 30 ?
  <0-23>  Hours
  <cr>

R1(dhcp-config)#lease 30 23 ?
  <0-59>  Minutes
  <cr>

R1(dhcp-config)#lease 30 23 59 ?
  <cr>

R1(dhcp-config)#lease 30 23 59

At the beginning of this section, I mentioned that a Cisco router acting as a DHCP server will check for IP address conflicts before assigning an IP address.  This check consists of the router sending two ping packets to an IP address before assigning that address; those pings will time out in 500 milliseconds. If the ping times out, the address will be assigned.  If an echo returns, obviously that address should not and will not be assigned!

If you want to change either the number of pings sent or the ping timeout value during this process, use the ip dhcp ping packets and ip dhcp ping timeout commands.  Note that these are global commands as well.  You can also disable this pinging by entering zero for the ping packets value.

R1(config)#ip dhcp ping packets ?
  <0-10>  Number of ping packets (comment - 0 disables ping)
  <cr>

R1(config)#ip dhcp ping packets 5


R1(config)#ip dhcp ping timeout ?
  <100-10000>  Ping timeout in milliseconds

R1(config)#ip dhcp ping timeout 1000
R1(config)#

Finally, if you need to disable the DHCP service on this router, run the no service dhcp command.  It can be reenabled at any time with the service dhcp command. 

To your success,

Chris Bryant

CCIE #12933

chris@thebryantadvantage.com