Wednesday 5 February 2014

CISCO IOS DHCP

How to Configure Cisco IOS DHCP ?

DHCP:

Dynamic Host Configuration Protocol is a protocol that allows you to automatically configure the settings of the devices on your network. For a device such as a laptop to be able to communicate with other devices on the network it must first have a correct IP configuration on it. This can be done by either manually configuring the IP settings or by using DHCP.

To reduce the tasks carried out by network administrators DHCP is often implemented. This allows for auto configuration for all devices that join a network. It will then also store these details in a centralized location which can be very helpful when troubleshooting. With DHCP, you are able to exclude certain addresses from being allocated and also able to manually assign a DHCP address to a device using the mac address of the device to bind the IP to that device.

Cisco IOS DHCP configuration
Scenario:
In this scenario I will configure router R1 as the DHCP server for devices on the LAN running off the VLAN1 interface. I will also exclude some addresses to show how you can reserve some address space for other devices.

The basic commands to configure a DHCP pool are as follows:

R1(config)# ip dhcp pool R1-LAN-DHCP-POOL
R1(dhcp-config)# network 10.100.100.0 255.255.255.0
R1(dhcp-config)# default-router 10.100.100.1


In this command snippet I have created a DHCP pool for the LAN subnet on router R1, 10.100.100.0/24. I have given this pool a descriptive name of R1-LAN-DHCP-POOL so that it stands out when viewing the configuration and I have also set the default router that the devices will be issued (in this case the IP address of the VLAN1 interface of router R1)

There are a few other options you may wish to add in to this configuration such as domain name and DNS servers. The commands to do this are listed below:

R1(dhcp-config)# dns-server 10.100.100.5
R1(dhcp-config)# domain-name cisco-kid.co.uk Excluded Addresses


If you have a number of servers or similar devices on your network then you will probably want to allocate these devices with a static IP address. It is also probably a good idea to assign these numbers to a range of IP addresses. In our example we want to reserve the addresses from 10.100.100.1 through to 10.100.100.30. These addresses could be used for things such as DNS servers, Mail servers and print servers etc.

To exclude these addresses from being allocated via DHCP you can exclude them. The commands below will demonstrate this:

R1(config)# ip dhcp excluded-address 10.100.100.1 10.100.100.30
IP helper-address


There is a feature within the Cisco IOS range of commands that allows you to forward DHCP traffic through a device on to another device. For example you could configure the routers in the diagram to forward DHCP requests from the 10.100.100.0/24 LAN on R1 through the network to a Windows server on the LAN of R4. The command to do this is ip helper-address.

To demonstrate the commands using the diagram above I will configure router R2 as the DHCP server and configure router R1 to forward the DHCP traffic to router R2 using the ip helper-address command. This will allow devices to get their IP address configuration from router R2.

The only commands you will need on R1 are:

R1(config)# int vlan1
R1(config-if)# ip helper-address 192.168.100.2

This tells R1 to forward DHCP traffic to the DHCP server which in this case is R2.

No comments:

Post a Comment