Ask the kernel
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.
Type ip -br -4 addr. The shell starts ip, which asks the kernel through netlink, a socket for talking to the kernel. Back come two interfaces: lo, the loopback (this machine talking to itself), and eth0 with 192.168.1.20.
The /24 after 192.168.1.20 is the prefix length. The first 24 bits, 192.168.1, name the local network; the last 8 bits, .20, name this machine. Any 192.168.1.x address is a neighbour, reached directly.
ip route show default asks for the default route: the exit for every address that is not local. Here it says: send it via 192.168.1.1, the gateway (your router), out of eth0.
Test the path
ping -c 1 192.168.1.1 sends one echo request, a small ICMP test packet. ping asks the kernel to send it; the kernel checks the routes, picks eth0, and the network card puts it on the wire to the router.
The router answers with an echo reply. The kernel hands it to ping, which prints it: 64 bytes, ttl=64 (hops left; the gateway set the start value), and time=0.9 ms for the round trip. The local link works.
curl -sI https://example.com tests the whole path. curl looks up the name's address (DNS), then asks the kernel for a TCP connection. The packets leave through eth0 and the gateway, across the internet, to the server.
The server answers HTTP/2 200: the page exists, and every layer worked, from the cable to the web server. The answer travels back the same way, through the gateway, the network card and the kernel, to curl.
When it fails
When the network fails, climb the same ladder. No address: check ip addr. No default route: check ip route. Gateway silent to ping: check the cable or Wi-Fi (some routers ignore ping). Gateway answers but curl fails: suspect DNS or the server.
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.