ARP (Address Resolution Protocol)
How a computer gets another computer’s MAC address in a LAN?
If there is two computer in a LAN suppose Computer A and Computer B and A wants to sends some data to the computer B over the LAN then it needs computer B’s MAC address to send the data. Let’s see how it works –
- Computer A sends ARP(Address Resolution Protocol) request to all the machines in a LAN with the IP address of computer B.
- Computer B respond on the ARP and sends back the MAC address.
DHCP (Dynamic Host Control Protocol)
Ever imagined when you connect to any wifi and it gives you a unique IP address automatically, How?
It is the protocol which gives IP addresses to host that joins a network and also manage the given IP addresses to the hosts.
There are four part of any DHCP system
- DHCP Discover – When a new machine joins a LAN network it sends a broadcast message to to network to know the addresses of the DHCP server.
- DHCP offer – After it gets a DHCP discover request from a host it sends a DHCP offer to the host with one IP address from it’s pull.
- DHCP request – If the host accept the DHCP offer then it sends back a DHCP request back to the server.
- DHCP Acknowledgement – Once the DHCP server gets the DHCP request it gives back a acknowledgement to the host and store the information.
E.G. – A typical example is our home router.
DHCP Relay – So big techs wants a specific DHCP server rather than the router in that case the router works as a DHCP relay and forwards the DHCP requests to the DHCP server knowing the destination IP address.