DHCP: It is a networking protocol that is used for dynamically assigning IP addresses to interfaces and services. It uses port no. 67. Each machine that connects to the internet requires a unique IP address which is assigned by dhcp server. Without dhcp the ip address must be entered manually in each computer.
dhclient: dhclient is the Linux command, which will provide the ip address to the device which is to be connecting to the network from the dhcp.
This is the initial ip address of the machine
To assign static ip
Step 1: Use the command
gvim /etc/network /interfaces
Step 2: Enter the ip (192.168.2.185) along with the subnet mask and save it & close.
Step 3:Then give ifconfig command to check the ip address, it should be 192.168.2.185 or else do ifdown eth0 to disconnect the interface and connect it back by using the command ifup eth0 check ip again.
To obtain the ip address from dhcp without changing the interfaces file
Step 1: dhclient eth0 -r
This command is used to release the previous ip.
Step 2: dhclient eth0 –v
This command is used to renew the ipaddress from dhcp
Step 3: Now give ifconfig command to check the ip
You will get the different ip address because the ip will be assigned by the dhcp not from static.