DHCP: who gives your phone its IP? (DORA)

☰ All 15 lessons

The moment you connect to Wi-Fi, your phone gets an IP. Nobody types anything. So who gives it?

DHCP

It's the router in the box at home, and it does it with a protocol called DHCP (Dynamic Host Configuration Protocol). As soon as a device connects, the router gives it an IP to use automatically, along with settings like which router to go through to reach the internet (the default gateway) and which DNS server to ask. The same thing happens for every device that joins.

DORA, step by step

Imagine you're connecting your phone to a Wi-Fi network:

  1. D – Discover. The phone asks: "I'm a new device and I don't have an IP. Does anyone have one?" It doesn't know who runs DHCP, so it sends this to every device on the network at once, a broadcast. The others ignore it; only the router running DHCP replies.
  2. O – Offer. The router: "This IP is free. Do you want it?"
  3. R – Request. The phone: "OK, I'll take that IP."
  4. A – Acknowledge. The router: "Done, it's yours."
The DHCP DORA processPhoneRouter (DHCP)D – Discover: "Anyone have an IP?" (broadcast)O – Offer: "192.168.31.5 is free"R – Request: "I'll take it"A – Acknowledge: "It's yours ✓"
  1. Discover: the phone broadcasts "Does anyone have an IP for me?"
  2. Offer: the router offers a free IP.
  3. Request: the phone asks for that IP.
  4. Acknowledge: the router confirms it.
Discover, Offer, Request, Acknowledge.

This is also why your IP can change when you reconnect (lesson 4): each time, the router offers whichever IP is free.

For hackers: because the phone trusts whoever answers its broadcast, an attacker on the same network can run a rogue DHCP server and hand out their own machine as the gateway, putting themselves in the middle of the victim's traffic. That's one reason networks protect against unknown DHCP servers.

Key takeaways

  • DHCP lets the router give devices an IP automatically.
  • It also hands out the default gateway and DNS server.
  • DORA = Discover, Offer, Request, Acknowledge.
  • Discover is a broadcast, because the device doesn't know who runs DHCP yet.

Quick quiz

Pick an answer to check yourself. Answer both to mark this lesson done.

1. What is the correct order of the DORA process?

  1. A) Discover → Offer → Request → Acknowledge
  2. B) Offer → Discover → Acknowledge → Request
  3. C) Request → Offer → Discover → Acknowledge
  4. D) Discover → Request → Offer → Acknowledge
Show answer

Answer: A. The phone asks for an IP (Discover), the router offers one (Offer), the phone asks for it (Request), and the router confirms (Acknowledge).

2. Who does the phone send the Discover message to?

  1. A) Only the router
  2. B) Every device on the network (broadcast)
  3. C) The DNS server
  4. D) Facebook's server
Show answer

Answer: B. The phone has no IP and doesn't know who runs DHCP, so it broadcasts to everyone. Only the router running DHCP replies.

Module 2 test

Five questions on lessons 6 to 10.

1. If an IP is the address of a block of flats, what is a port?

  1. A) The building's name
  2. B) The door of one flat inside
  3. C) The road to the building
  4. D) The postman
Show answer

Answer: B. The IP gets data to the right device; the port gets it to the right app or service inside.

2. You need to be sure an email arrived. Which is better?

  1. A) UDP
  2. B) TCP
  3. C) ARP
  4. D) DHCP
Show answer

Answer: B. TCP checks that data arrived and resends it if not. UDP doesn't check.

3. In the 3-way handshake, what does the server send back after the client's SYN?

  1. A) SYN
  2. B) ACK
  3. C) SYN-ACK
  4. D) RST
Show answer

Answer: C. SYN → SYN-ACK → ACK. The server says "heard you" (ACK) and "I want to connect too" (SYN) together.

4. You type edwhere.com in the browser. Who is asked for its IP first?

  1. A) A DNS server
  2. B) A DHCP server
  3. C) The switch
  4. D) Wireshark
Show answer

Answer: A. DNS servers store domain names and their IPs. The browser gets the IP there, then goes to the site.

5. In DHCP's DORA process, what does "O" stand for?

  1. A) Open
  2. B) Offer
  3. C) Order
  4. D) Output
Show answer

Answer: B. Discover, Offer, Request, Acknowledge. In the Offer, the router offers a free IP.

Frequently asked questions

What does DHCP do?

DHCP automatically gives a device an IP address when it joins a network, along with the default gateway and DNS server settings.

What is DORA in DHCP?

The four DHCP messages: Discover, Offer, Request and Acknowledge.

Why does my IP address change?

Each time you connect, the DHCP server offers whichever IP is free, so you can get a different one.

Do it hands-on.

This tutorial gives you the concepts. The 50 Days Ethical Hacking Challenge puts them to work in real labs, explained in Malayalam.