How-TO: Configure DHCP on a CISCO router
This post is about configuring a CISCO router to act as a DHCP server in your network.
Task1: Configure R1 to act as a DHCP server and provide all network information to hosts in the LAN dynamically. (R1 and R2 are directly connected via Ethernet)
Server Configuration (R1)
!-- enable dhcp server (default)
service dhcp ! -- defining DHCP pool with all network information ip dhcp pool OFFICE !-- defining static binding to R2 using its client-id ip dhcp pool STATIC !-- exclude server and static addresses from the dynamic pool ip dhcp excluded-address 192.168.12.1 |
Client Configuration:
interface FastEthernet0/0 ip address dhcp client-id FastEthernet0/0 |
Troubleshooting and verfication:
IP address is assigned dynamically to R2
!-- R2 f0/0 address is assigned via DHCP
R2(config-if)#do sh ip int b !-- R1 bindings has R2 as a static entry R1#sh ip dhcp binding |
R2 gets its domain-name dynamically from R1
R2#sh ip domain networkers-online.com |
R2 sets R1 as a default gateway using a floating static route
R2#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static routeGateway of last resort is 192.168.12.1 to network 0.0.0.0 C 192.168.12.0/24 is directly connected, FastEthernet0/0 |
R2 learns Primary and secondary DNS servers from R1
R2#ping xyz.comTranslating "yahoo.com"...domain server (192.168.12.100) (192.168.12.101) % Unrecognized host or address, or protocol not running. |
for more information on how to configure DHCP features consult the following link CISCO IOS DHCP Server