You want to ensure that your router assigns the same IP address to a particular device every time it connects.
The following commands ensure that the router assigns the same IP address to a device each time it requests one:
Router1(config)#ip dhcp pool IAN Router1(dhcp-config)#host 172.25.1.33 255.255.255.0 Router1(dhcp-config)#client-identifier 0100.0103.85e9.87 Router1(dhcp-config)#client-name win2k Router1(dhcp-config)#default-router 172.25.1.1 Router1(dhcp-config)#domain-name oreilly.com Router1(dhcp-config)#dns-server 172.25.1.1 Router1(dhcp-config)#end Router1#
The router allows you to statically bind an IP address to a MAC address, which ensures that a particular device always receives the same IP address. This is particularly useful for devices such as servers that must be available for access via a well-known IP address or DNS entry. Any device that accepts inbound sessions will probably require a static address, and allocating these addresses via DHCP provides administrators with greater control over their networks.
The configuration for a static DHCP mapping is slightly different from that of a dynamic pool. In particular, you must assign a separate dhcp pool for each static server. In our example, we created a pool named IAN to allocate a static IP address to user Ian. Also, instead of defining a network range of IP addresses, you can assign a specific IP address using the host command. To avoid address conflicts, make sure that the static address you assign is not part of an already configured dynamic pool. You may need to use the excluded-address command for this.
You must configure the static pool with the device's MAC address using the client-identifier command. The client identifier is made up of two parts: the media type and the MAC address. The media type numbers can be found in RFC 1700 ("Assigned Numbers") under the heading "Number Hardware Type." For 10/100/1000Mb Ethernet, the media type number is 01. The router will combine the media type and MAC address into one large address and automatically add the dots if you don't type them.
From this point on, the router will accept the same options as the dynamic pool options. Options can be inherited from dynamic pools as well. To view the configured static binding use the show ip dhcp binding command:
Router1#show ip dhcp binding IP address Hardware address Lease expiration Type 172.25.1.33 0100.0103.85e9.87 Infinite Manual 172.25.1.52 0100.50da.2a5e.a2 Apr 11 2003 09:00 PM Automatic 172.25.1.53 0100.0103.ea1b.ed Apr 11 2003 08:58 PM Automatic Router1#
This shows that we have successfully mapped a static IP address of 172.25.1.33 to MAC address 0001-0385-e987. DHCP has put the code 01 at the start of this address to indicate that it is an Ethernet MAC.
Note that the router marks the static clients as "Manual" to differentiate them from the others. Although the output indicates that the static lease is indefinite, in reality it is not. The static dhcp pool can be assigned any lease period you desire, but the router will only allocate the single static address. This can be useful if you want to change other DHCP options for this end device.
Recipe 20.5; RFC 1700
Top |