Markus Löning

Software Engineering & Machine Learning

Network engineering

Posted at Jul 24, 2025 23:07:58 — Last modified at Aug 11, 2025 17:13:14

Intro

I recently had to think more about network engineering. Here are my notes from reading Beej’s Guide to Network Programming and Computer Networking: A Top-Down Approach.

Overview

Five-layer version of Open System Interconnection (OSI) model:

LayerProtocol Data Unit (PDU)FunctionDiagnostic tools
5 ApplicationDataHigh-level protocols such as for continuous data exchange, resource sharing, or remote file access (e.g. HTTP, SMTP, LDAP, DNS)Loggers, debuggers
4 TransportSegmentReliable transmission of data segments between nodes, including segmentation, acknowledgement, and multiplexing (e.g. TCP, UDP, ICMP)netstat, nc (netcat), tcpdump
3 NetworkPacket, DatagramMulti-node network communication, including addressing, routing, and traffic control (IPv4, IPv6, ICMP)ifconfig, route, ping, traceroute
2 Data linkFrameTransmission of data frames between two nodes connected by a physical layer (e.g. Ethernet, WiFi)arp, ndp, tcpdump
1 PhysicalBit, SymbolTransmission and reception of raw streams over a physical medium (e.g. copper/fibre wires, WiFi/radio waves)Hardware status lights, ifconfig

Level 5 can be broken down further, but for a high-level understanding, the differences are not critical; they all concern the application.

Like a postal system, each layer passes its message (payload) down to the next layer, which wraps it in its own envelope, adding its own layer-specific information (headers) (see encapsulation). At reception, the reverse happens. Starting from the physical layer, each layer unwraps the message using the headers and passes it up to the next layer (de-encapsulation). Each layer only acts on its layer-specific headers, leaving the rest untouched. In practice, encapsulation and de-encapsulation is more complex because a message may be split up into multiple segments, which are then split up into multiple datagrams.

Most complexity is designed to be in the network-edge devices (end systems), including the application and transport layer. Network-core devices, including everything from the network layer and below, are designed to be simple (complexity on edges).

Upper layers are constrained by services provided by lower layers (e.g. physical limitations like bandwith or transmission delay), but can build services on top to remedy lower-level limitations (e.g. TCP provides reliable data transfer on the transport layer even with IPv4 as an unreliable network layer protocol).

Physical layer

Network interface

Switch

Local area network (LAN)

Ethernet

Virtual LAN (VLAN)

Network layer

Internet Protocol (IP)

Router

IPv4

Monitoring and diagnostics:

Private IP addresses

Network Address Translation (NAT) and Server Name Indication (SNI)

Proxies and firewalls

IPv6

Internet control message protocol (ICMP)

Transport layer

Principles for choosing transport layer protocols

TCP/IP

UDP

Segment structure

Reliable data transfer

Essential components include:

which require the following features:

TCP

Segment structure

Network congestion control

Costs of congested networks

Control strategies

Ports

If the subnet mask is like the street name or zip code and the IP address like the house number, then the port is like a room number.

Monitoring and diagnostics:

Application layer

Network application design

Client-server

Server is

For example, HTTP web servers.

Peer-to-peer (P2P)

For example, BitTorrent.

Sockets

Bind (server) and connect (client)

Domain name system (DNS)

Monitoring and diagnostics:

Hypertext Transfer Protocol (HTTP)

MPEG-DASH

Quick UDP Internet Connections (QUIC)-HTTP/2

Content Distribution Network (CDN)

Security

Monitoring, diagnostics and debugging

Packet sniffing

tcpdump usage

Alternatively, use Wireshark.

Creating traffic

nc (netcat) usage:

Tracking traffic across the network

Tools

macOS

Linux

Many of the above macOS tools are also available on Linux.

Resources

For more recommendations, see this HackerNews thread.