Friday, March 12, 2010

Cisco DHCP Configuration

Dynamic Host Configuration Protocol (DHCP) is a protocol used by networked devices to obtain information required to operate on an Internet Protocol network.

When a DHCP client is first switched on, it sends a broadcast packet on the network with a DHCP request. If there is a DHCP server exists in the network, this request will be picked up by the DHCP server. The DHCP server will allocate an IP address to the PC, from one of the pools of addresses it managed.

DHCP clients use a broadcast packet to find a DHCP server, so if a client is on one side of a router, and the server on the other, normally these broadcast packets will be filtered out. Many routers today include support for DHCP- forwarding, but it is not enabled by default.

Many system administrators do not realize that DHCP service can be enabled in Cisco devices. In this article, we will show the method on configuring DHCP on a Cisco router.

Router1, a Cisco router with an IP address of 10.0.0.110 (/24), will be configured as DHCP server. it will be configured to hand out IP addresses in the range from 10.0.0.1 through 10.0.0.254. It will also provide the information identifying itself as the default gateway and DNS server. Our local domain name will be Domain.com.

First of all, enter the configuration mode in Router1.

Router1#config t

By default, the Cisco IOS DHCP server and relay agent features are enabled on your router. To re-enable these features if they are disabled, use the following command in global configuration mode:

Router1(config)# service dhcp

In the case that you may like to reserve few addresses, you are able to tell the router to do so. In the following example, we will exclude address from 10.0.0.110 to 10.0.0.120 and from 10.0.0.200 to 10.0.0.254.

Router1(config)#ip dhcp excluded-address 10.0.0.110 10.0.0.120

Router1(config)#ip dhcp excluded-address 10.0.0.200 10.0.0.254

The next step is to create a DHCP pool. In the following example, we created a DHCP pool named "LAN".

Router1(config)#ip dhcp pool LAN

After DHCP pool is created, we will define the IP address pool. This is the IP address space which will be assigned to users automatically by Cisco router.

Router1(DHCP-config)#network 10.10.0.0 255.255.255.0

Other options for DHCP can be added after this step.

Router1(DHCP-config)#default-router 10.0.0.100

Router1(DHCP-config)#dns-server 10.0.0.105 10.0.0.106

Router1(DHCP-config)#domain-name Domain.com

Router1(DHCP-config)#

Router1(DHCP-config)#exit

If the interface of the router is not set yet, following is the configuration for it.

Router1(config)#

Router1(config)#interface f0/0

Router1(config-if)#ip address 10.0.0.100 255.255.255.0

Router1(config-if)#end

Router1#copy run start

It is possible to create multiple DHCP pools in the router configuration. By using the current DHCP pool as reference, create another DHCP pool using the network/mask and gateway that you plan to be assigned to hosts connected to another interface. The router will be able to determine which DHCP pool to be used based on which interface the client DHCP discover packet it received.

No comments:

Post a Comment