Dynamic Host Configuration Protocol (DHCP) Server Configuration

Dynamic Host Configuration Protocol (DHCP) is a protocol that handles the assignment of many IP parameters. Configuring your DHCP server is easy, involving only a few lines in your router's configuration file. Just follow these steps:



  1. Determine your network range and any addresses that you do not want to include in your pool of addresses.



  2. Exclude your reserved addresses.



  3. Enable the pool.



  4. Specify the IP network for which to assign addresses.



  5. Specify options you want to include, such as



    • DNS servers



    • WINS servers



    • NetBIOS Node Types (b, p, m, or h)



    • Lease Duration in days, hours, and minutes






If you want, you can specify the following items also:



  • A location to store the DHCP database, which could be a network location. In this way, you do not lose your assigned leases if your router experiences a failure.



  • Statically assign addresses to specific hosts — this is managed through their MAC addresses. In this way, you gain the flexibility to use DHCP as well as the capability to have the same device always obtain the same address, which is ideal for devices such as servers or printers.




The following code walks you through the basic process to get your DHCP server up and running for a basic network of 192.168.1.0:


Router2>enable
Password:
Router2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.3
Router2(config)#ip dhcp pool DHCPPool
Router2(config-dhcp)#network 192.168.1.0 255.255.255.0
Router2(config-dhcp)#domain-name cisco.com
Router2(config-dhcp)#dns-server 192.168.1.1 192.168.1.21
Router2(config-dhcp)#dns-server 192.168.1.102 192.168.2.102
Router2(config-dhcp)#netbios-name-server 192.168.1.103 192.168.2.103
Router2(config-dhcp)#netbios-node-type h-node
Router2(config-dhcp)#default-router 192.168.1.1
Router2(config-dhcp)#lease 0 0 10
Router2(config-dhcp)#exit
Router2(config)#exit

To specify storing the DHCP database in a remote location, include a line like this one in the previous configuration. This configuration line stores the database 120 seconds after an update to the local database.


ip dhcp database ftp://user:password@192.168.1.103/router-dhcp write-delay 120

When handing out address information for multiple subnets, at times you will want to specify the same options for all subnets. To do so, you create a pool at a higher level (network-wise) and configure your options there. These options are handed out to the lower level pools as well. The following configuration of three pools illustrates this functionality:


Router2>enable
Password:
Router2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#ip dhcp excluded-address 172.30.1.100 172.30.1.103
Router2(config)#ip dhcp excluded-address 172.30.2.100 172.30.2.103
Router2(config)#ip dhcp pool 0
Router2(config-dhcp)#network 172.30.0.0 /16
Router2(config-dhcp)#domain-name edtetz.net
Router2(config-dhcp)#dns-server 172.30.1.102 172.30.2.102
Router2(config-dhcp)#netbios-name-server 172.30.1.103 172.30.2.103
Router2(config-dhcp)#netbios-node-type h-node
Router2(config-dhcp)#exit
Router2(config)#ip dhcp pool 1
Router2(config-dhcp)#network 172.30.1.0 /24
Router2(config-dhcp)#default-router 172.30.1.100 172.30.1.101
Router2(config-dhcp)#lease 30
Router2(config-dhcp)#exit
Router2(config)#ip dhcp pool 2
Router2(config-dhcp)#network 172.30.2.0 /4
Router2(config-dhcp)#default-router 172.30.2.100 172.30.2.101
Router2(config-dhcp)#lease 30
Router2(config-dhcp)#exit
Router2(config)#exit

In addition to the pools and exclusions just listed, a reservation is the process by which you statically associate a single computer with an IP address using DHCP. The following code associates Bobs-pc with the address of 172.30.2.25, as long as the MAC address of Bobs-pc remains 04c8.58b0.0b2c.


You repeat this process for other computers that need to keep a static address. In these cases, if another pool hands out addresses for the network 172.30.2.0/24 or 172.30.0.0/16, Bob-pc also receives the options assigned to those pools.


Router2>enable
Password:
Router2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#ip dhcp pool Bobs-pc
Router2(config-dhcp)#host 172.30.2.25
Router2(config-dhcp)#hardware-address 04c8.58b0.0b2c ieee802
Router2(config-dhcp)#client-name Bob-pc
Router2(config-dhcp)#exit
Router2(config)#exit



dummies

Source:http://www.dummies.com/how-to/content/dynamic-host-configuration-protocol-dhcp-server-co.html

No comments:

Post a Comment