Ethernet/The cable and the chips/From frames to an IP address
Lesson 8 of 12 · in 3D and VR

From frames to an IP address

A link that is up has no IP address yet. On an ESP32 the driver hands frames to lwIP through esp_netif, and code should wait for the got-IP event, not the link-up event, before it talks.

Lonely BinaryUpdated 2026-10-094 min readNo board required

View it in VR

Lesson 8 of the Ethernet course opens in a VR headset, on a table in front of you, and a voice starts three seconds after you arrive. Type this short address into the browser on a headset such as Meta Quest or Apple Vision Pro, and press Enter VR. No headset? Press Start the lesson: the same lesson, full screen.

learn.lonelybinary.com/vr/ethernet/8

Still the data link

Once the Ethernet driver is installed and the PHY answers, frames can come and go. That is all. The driver knows whether the link is up and what its MAC address is, and nothing about IP. Up to this point everything is layer 2: frames, MAC addresses, a link.

The glue and the stack

On an ESP32 the TCP/IP stack is lwIP, a small TCP/IP implementation for embedded systems, first written by Adam Dunkels at the Swedish Institute of Computer Science. The driver does not talk to it directly. A glue layer, esp_netif, sits between them: esp_eth_new_netif_glue() makes the glue for the Ethernet driver, and attaching it to a netif hands every received frame up to lwIP and every outgoing frame down to the driver.

lwIP reads the type field of each frame. Type 0800 goes to IPv4, type 0806 goes to ARP. ARP is how a station on the local network finds the MAC address that belongs to an IPv4 address, so that a frame can be addressed to it.

Wi-Fi is attached the same way, with its own esp_netif. To lwIP the two are both network interfaces carrying the same IP traffic.

An address, and two events

An IPv4 address usually comes from a DHCP server on the network, or it is set by hand in the code. Until one of those happens the interface has a link and no address.

ESP-IDF reports the two moments separately. ETHERNET_EVENT_CONNECTED means the link is up. IP_EVENT_ETH_GOT_IP means the interface has an IP address. Code that starts talking on the first event talks from a stack with no address yet, and fails whenever the DHCP server is slow to answer or not there at all. Wait for got IP.

A link light says the same thing as the first event and no more: the cable and the PHYs agree. It does not say that IP is configured or that anything on the network is listening.

Above lwIP sit the sockets, with TCP and UDP. They are the subject of the TCP and UDP course. The board side, with the pins and the code, is Ethernet instead of Wi-Fi in the ESP32 book.

Common mistakes

  • Starting network code on the link-up event. ETHERNET_EVENT_CONNECTED arrives before there is an address. Start on IP_EVENT_ETH_GOT_IP.
  • Reading the link light as "the network works". It shows the physical link only. No DHCP server on the network means a lit jack and no address.
  • Installing the driver and never attaching the glue. Without esp_netif and its Ethernet glue, frames reach the driver and stop there, and no IP event ever comes.

Edit this page — content/fundamentals/ethernet/from-frames-to-an-ip-address.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum →