$ shellippingcurlLinux kernelnetwork stacklo127.0.0.1/8eth0192.168.1.20/24defaultvia 192.168.1.1NICgatewayexample.comip addrip routepingcurl
Back: user space (terminal, shell, tools). Middle: the kernel and its network tables. Front: the network card and the networkRows on the kernel: the interface list and the routing tableTokens: your typed command, netlink envelopes to the kernel, and packets on the wireUser space at the back: the terminal, the shell and three network tools, ip, ping and curl. The Linux kernel in the middle holds the interfaces and the routing table. In front: the network card, a cable to the gateway, the internet and the web server example.com. ip asks the kernel's tables over netlink; ping sends one packet to the gateway and back; curl sends one all the way to example.com and back. The machine in the example has the address 192.168.1.20/24 on eth0 and its router at 192.168.1.1, a typical home network. Interface names differ (eth0, enp3s0, wlan0), and the ping time is an example.

Ask the kernel

  1. On Linux, the kernel runs the network. It keeps the interfaces (each network connection, such as eth0), their addresses, and a routing table that says where packets go. Network tools are small programs that ask the kernel.

Test the path

When it fails

What happens

;; step 1/9 · stack
kernel space   the Linux kernel
  interfaces   lo, eth0 ... and their addresses
  routes       where each packet should go
  sockets      every open connection
hardware       the network card sends the packets
user space     ip, ping, curl, ss: they only ask

The machine in the example has the address 192.168.1.20/24 on eth0 and its router at 192.168.1.1, a typical home network. Interface names differ (eth0, enp3s0, wlan0), and the ping time is an example. The card trims the output to fit: ip pads its columns wider, ping also prints a header line and a summary, ping's long reply line is wrapped, and curl prints more header lines after HTTP/2 200. Every command in this lesson only reads or tests; none changes the network. Commands that change it, such as ip addr add or ip route del, need root (sudo) and can cut you off from a remote machine, so try them only on a test system.