Wednesday, January 11, 2017

DHCP Pool and static reservations

To create DHCP reservations, you should first create the scope and then create the reservations separately with unique names. The L3 device will know that the reserved device is a part of the scope (global DHCP pool) and make them a subset of it because their host IP addresses are within the scope CIDR block.
For example, you want to create a printer scope on 10.xxx.5.0/24 with you company settings and you have 3 printers that you want to have permanent DHCP reservations. You decide that they will be 10.xxx.5.21, 22, and 23. You obtain the MAC addresses from the printers as 0000.1111.2222, 5555.4444.3333, and 6666.5555.4444 respectively. You would create a dhcp pool for printers with you network, domain-name, dns-server, and default-router (and more features if you need them). Then you would create a reservation for each printer by giving it a unique pool name, the host IP address, and the MAC address with an "01" for Ethernet in front of it. Note that the reservation name does not have to relate to the global ip dhcp pool at all.

The configuration would look like this:
conf t
!
ip dhcp pool Printers
network 10.xxx.5.0 255.255.255.0
domain-name yourcompany.global.pvt
dns-server 10.xxx.10.100
default-router 10.xxx.5.1

ip dhcp pool Print-21
host 10.xxx.5.21 255.255.255.0
client-id 010000.1111.2222
!
ip dhcp pool Print-22
host 10.xxx.5.22 255.255.255.0
client-id 015555.4444.3333
!
ip dhcp pool Print-23
host 10.xxx.5.23 255.255.255.0
client-id 016666.5555.4444
!
end
wr mem

This will work on most all Cisco L3 devices. Note that some printers may need to use BootP instead of DHCP and therefore the client-id statement would be different. That is easily found on Cisco configuration guides.

For example:

 MAC address of PC is2047.47D0.C89A
   
Sample Config:

ip dhcp excluded-address 10.1.1.1
ip dhcp excluded-address 10.1.1.2

ip dhcp pool VLAN1
 network 10.1.1.0 255.255.255.0
 domain-name test.local
 default-router 10.1.1.1

   
   ****YES WORKS***
   ip dhcp pool RESERVE_POOL
 host 10.1.1.10 255.255.255.0
 client-id 0120.4747.d0c8.9a

 ****NO******
   ip dhcp pool RESERVE_POOL
 host 10.1.1.10 255.255.255.0
 client-id 2047.47d0.c89a

 ****N0******
   ip dhcp pool RESERVE_POOL
 host 10.1.1.10 255.255.255.0
 hardware-addr 0120.4747.d0c8.9a


 *****NO*******
    ip dhcp pool RESERVE_POOL
 host 10.1.1.10 255.255.255.0
 hardware-addr 2047.47d0.c89a

Note when excluding a static address 10.1.1.10:
Switch(config)#ip dhcp excluded-address 10.1.1.10

% Address 10.1.1.10 is already excluded.



No comments:

Post a Comment