Thursday, April 8, 2010

DHCP server on Cisco routers

Router(config)#ip dhcp pool <any-dhcp-pool-name>
Router(dhcp-config)#network <my-network-ip> <my-network-subnetmask>
Router(dhcp-config)#dns-server <my-dns-server-ip>
Router(dhcp-config)#default-router <my-gateway-ip>
Router(dhcp-config)#domain-name <my-domain-name>
Router(dhcp-config)#lease DAYS HOURS MINUTES
Router(config)#ip dhcp excluded-address <ip-address-to-exclude-from-pool>
Router(config)#service dhcp
To show current leases:
Router#show ip dhcp binding
To see some DHCP server stats:
Router#show ip dhcp server statistics
Should you choose, you can exclude a range of addresses from being assigned:
Router(config)#ip dhcp excluded-address <start-ip-to-exclude> <end-ip-to-exclude>
You can also make your ip address leases never expire:
Router(dhcp-config)#lease infinite