## DHCP and ARP

How you join a network.

### DHCP (Dynamic Host Configuration Protocol)
Automates assigning IPs.
**The DORA Process**:
1.  **Discover**: Client shouts (Broadcast): "IS ANY DHCP SERVER HERE?"
2.  **Offer**: Server says: "I can give you IP `192.168.1.100`".
3.  **Request**: Client says: "I will take it!"
4.  **Acknowledge**: Server says: "It yours for 24 hours."

### ARP (Address Resolution Protocol)
Maps IP (Logic) to MAC (Physical).
*   Switch knows MACs. Router knows IPs.
*   When you ping `192.168.1.5` on a LAN:
    1.  PC checks ARP Table: "Do I know the MAC for 192.168.1.5?"
    2.  If No: Broadcast "WHO HAS 192.168.1.5? TELL 192.168.1.2".
    3.  Device replies "I have it! My MAC is AA:BB:CC...".
    4.  PC sends frame to AA:BB:CC.

**ARP Spoofing (Man in the Middle)**:
Hacker replies "I am 192.168.1.5!" to the PC, and "I am the Router!" to the Gateway. Now all traffic flows through the Hacker.