The network digram for this example is as follows.
The first thing we need to do in to set the IP address of the interface Fa0/0 on R1
R1> enable R1# configure terminal R1(config)# interface fastethernet 0/0 R1(config-if)# ip address 192.168.1.1 255.255.255.0 R1(config-if)# no shutdown R1(config-if)# end R1#
We then need to verify we have the IP address on the correct interface. This is done using the “show ip interface brief” command
Now we have an IP address we now need to configure DHCP. Now we need to first define the address that are not going to be part of the DHCP pool. This is done using the following command.
R1(config)# ip dhcp exclude-address 192.168.1.1 192.168.1.5
the above command will now exclude the IP address 192.168.1.1 to 192.168.1.5 so the first assignable address in DHCP will be 192.168.1.6. we now need to define the DHCP pool and give it a name. For this example the name of the pool will be DHCP.
R1(config)# ip dhcp pool DHCP R1(dhcp-config)# default-router 192.168.1.1 R1(dhcp-config)# network 192.168.1.0 255.255.255.0 R1(dhcp-config)# dns-server 192.168.1.2 R1(dhcp-config)#end R1#
We now need to go to R2 and bring up the interface and set it to accept a DHCP address.
R2> enable R2# configure terminal R2(config)# interface fastethernet 0/0 R2(config-if)# no shutdown R2(config-if)# ip address dhcp R2(config-if)# end
now to check if all is working. First we check on R2 using “show ip interface brief”
now we chcek on R1 using “show ip dhcp binding”
We have now successfully enabled DHCP on a Cisco router