DHCP( Dynamic Host ConfigurationProtocol )ByTrupti Rajesh Kini
History & Evolution1. RARPThe primary motivation forreplacing RARP with BOOTPwas that RARP was a data linklayer protocol. This madeimplementation difficult onmany server platforms, andrequired that a server bepresent on each individual IPsubnet.2.BOOTPIn computer networking, theBootstrap Protocol, or BOOTP,is a network protocol used by anetwork client to obtain an IPaddress from a configurationserver.3. DHCPThe Dynamic Host Configuration Protocol (DHCP) is a moreadvanced protocol for the same purpose and has supersededthe use of BOOTP.
● RouterThe router receives the configuration information througha modem from an internet service provider, which alsooperates DHCP servers with this router as one of theclients. The clients request configuration settings usingthe DHCP protocol such as an IP address, adefault route and one or more DNS server addresses.Once the client implements these settings, the host isable to communicate on the internet● Printers,Smartphones,PCs● Modem● ISPConfigurationinfoIP
● The DHCP server maintains a database of available IPaddresses and configuration information. When the serverreceives a request from a client, the DHCP serverdetermines the network to which the DHCP client isconnected, and then allocates an IP address or prefix that isappropriate for the client, and sends configurationinformation appropriate for that client● The query is typically initiated immediately after booting, andmust complete before the client can initiate IP-basedcommunication with other hosts. Upon disconnecting, the IPaddress is returned to the pool for use by another computer.This way, many other computers can use the same IPaddress within minutes of each other.● For example, the DHCP Message type option for an Offerwould appear as 0x35,0x01,0x02, where 0x35 is code 53 for"DHCP Message Type", 0x01 means one octet follows and0x02 is the value of "Offer".
Three methods of allocating IP-addresses●AAutomatic allocation: The DHCP server permanently assignsa free IP address to a requesting client from the rangedefined by the administrator. This is like dynamic allocation,but the DHCP server keeps a table of past IP addressassignments, so that it can preferentially assign to a clientthe same IP address that the client previously had.●SStatic allocation: The DHCP server allocates an IP addressbased on a table with MAC address/IP address pairs, whichare manually filled in (perhaps by a network administrator).Only clients with a MAC address listed in this table will beallocated an IP address.●DDynamic allocation: A network administrator assigns a rangeof IP addresses to DHCP, and each client computer on theLAN is configured to request an IP address from the DHCPserver during network initialization. The request-and-grantprocess uses a lease concept.
Disadvantage● Because the DHCP server has no secure mechanism forauthenticating the client, clients can gain unauthorizedaccess to IP addresses by presenting credentials, such asclient identifiers, that belong to other DHCP clients
Important Commands● less /var/lib/dhcp/dhclient.leases● grep dhcp-server-identifier/var/lib/dhcp/dhclient.leases● man dhcp-options● netstat -au | grep bootp
Change Ubuntu Server from DHCPto a Static IP Address● sudo vi /etc/network/interfaces● For the primary interface, which is usually eth0,you will see these lines:auto eth0iface eth0 inet dhcp
● Instead type the below lines:auto loiface lo inet loopbackauto eth0iface eth0 inet staticaddress 192.168.1.10netmask 255.255.255.0gateway 192.168.1.1
● sudo nano /etc/resolv.conf● Add appropriate nameserver for eg:nameserver 192.168.1.1● sudo /etc/init.d/networking restart● Ifconfig● ping http://www.google.com.If you get a response, name resolution is working: