Monday, April 30, 2007

DHCP SERVER

If you are a network administrator, you might have faced the problem of IP conflicts while configuring the IP addresses of hosts on your network. Now say goodbye to all those problems. Windows 2000 server comes with DHCP which enables the server to automatically assign IP addresses to all the hosts on the network. Lets first look how this mechanism works.

For the DHCP to automatically assign IP addresses to the hosts on the networks. There must be a DHCP server running on the server and the clients must be acting as DHCP clients. Below is a simple diagram to show the entire process.


The DHCP client first searches the network (DHCP DISCOVER) for a DHCP server by sending data packets to the machines on the network (see pic.1). The DHCP server on the network responds to the DHCP client offering an IP address (DHCP OFFER) from the preset range of IP addresses (I will tell how to configure the DHCP server afterwards). The DHCP client then sends a request message to the DHCP SERVER (DHCP REQUEST) accepting the IP address. The DHCP server then confirms that IP address to that client with a ACK message (DHCP ACK) back to the client. After the completion on all the four processes the client machine will have a dynamically assigned IP address on the network.

DHCP server: To install a DHCP server on your Windows 2000 server follow the procedure: Open the Control Panel -> Add/Remove Programs -> Add/Remove Windows Components. In the new window click Networking Services and then Details. Now select the Dynamic Host Configuration Protocol (DHCP) in the new window and click OK. Now the DHCP server is installed on your machine.

Before you configure and start your DHCP server, there are two basic requirements. (see pic.2)

1. The DHCP server must have a static IP address

2. The DHCP client service must be stopped before running the DHCP server service.
So make sure that your server has a static IP address on the network. To stop the DHCP client, click start -> Programs ->Administrative Tools ->Services. Now in the right pane of the services window, you must see the DHCP client service and the DHCP server service. Right-click the DHCP client service and then click STOP. Now you have stopped the DHCP client and ready to configure your DHCP server.

Now in the Administrative Tools, click DHCP. If every thing is correct you must see a Window similar to the one at right. (see pic.3)

Now right-click the server system name in the list and click New Scope… The scope tells the DHCP server about the range of IP addresses, their Lease Duration etc… In the new window give some name and description to the scope. Click next and then define the range of the IP addresses that you want the DHCP server to allocate for its clients. (see pic.4)

Click next and then you can define the range of the IP addresses that you want to exclude from the IP range you gave or you can also exclude individual IP addresses. Next comes the Lease Duration. This is the period that an assigned IP address is valid for a client machine. By default the lease duration is 8 Days. So, by the completion of 8th day of the IP application the IP will no longer be valid on the client machine.

But the client machine after reaching 50% to 87.6% completion of the lease duration (i.e. after completion of 4 days to 7 days and 11.52 minutes of the lease duration), the DHCP client request the DHCP server for the renewal of the lease duration. If the DHCP server is not in a position to renew the lease duration then after 87.6% completion of the lease duration a new IP address will be assigned to that machine. The 87.6% was kept as a factor of safety here, if the lease duration completely expires for a client then the client will not have any IP address.

If you click next in the wizard, you will be asked for the DNS configuration. That is beyond the scope of this article. Select No there. Click next and then finish. Now you have defined the scope. In the DHCP window, expand the tree view of the scope that you have defined now and then right-click the scope. Click activate to set the scope configuration active on your network. You have successfully installed the DHCP server on your network.

DHCP client: Configuring a DHCP is very easy. Actually you don’t have to anything to setup a DHCP client by default. Just make sure that the option Automatically obtain an IP address is enabled in the properties of your network connection.

Go to Control Panel ->Network and Dial-up connections->Right-click the connection->Properties. Click the Internet Protocol (TCP/IP) and then click properties. In the new pop-up, make sure that you select the option “Obtain an IP address automatically”. Click OK and then refresh (Press F5). Now your server must have randomly assigned your client machine an IP address from the range you have configured for the scope.

Now to find out the IP address that your DHCP server has assigned for the client, go to DOS and then type the command “ipconfig” or “ipconfig/all” (this gives the complete information about the IP configuration of your system). Isn’t it cool??