Addressing

Part of Networking

Unique machine identifiers — how computers on a network tell each other apart and direct packets to the right destination.

Why This Matters

A network with more than two computers faces an immediate problem: when a packet is transmitted on a shared medium, how does the intended recipient know the packet is for it, and how do other computers know to ignore it? The answer is addressing — assigning each machine a unique identifier and including that identifier in every packet.

Addressing is the foundation of all multi-node communication. Without it, you can have only point-to-point links (two computers connected by one wire). With addressing, you can have shared media (multiple computers on one cable), routed networks (packets passed through intermediate nodes), and internet-scale interconnects (billions of nodes reachable by any other node).

Understanding the address layers — physical hardware addresses, logical network addresses, and port numbers — lets you design a network that scales from two machines to thousands, diagnose routing failures, and implement protocols that work correctly when networks are combined.

The Three Layers of Addressing

In most network architectures, three distinct layers of addresses are used simultaneously:

Hardware (MAC) address: A permanent identifier burned into the network interface hardware at manufacture. 48 bits (6 bytes) in Ethernet. Globally unique across all network interfaces ever manufactured. Used for delivery within a single network segment; not routable (packets with MAC addresses cannot cross routers between different networks).

Format: six bytes in hex, colon-separated. Example: 00:1A:2B:3C:4D:5E. The first three bytes identify the manufacturer (OUI, Organizationally Unique Identifier); the last three bytes are the specific device.

Network (IP) address: A logical address assigned by network administrators, changeable, and used for routing between networks. IPv4: 32 bits, written as four decimal octets (e.g., 192.168.1.42). IPv6: 128 bits. Network addresses contain a network prefix (identifying the network) and a host portion (identifying the specific device within that network).

Port number: A 16-bit number identifying a specific application or service running on a computer. Multiple applications on the same machine can receive packets simultaneously because each uses a different port. Web servers listen on port 80 (HTTP) or 443 (HTTPS); file transfer uses port 21 (FTP); DNS uses port 53. Ports allow one IP address to serve many simultaneous services.

Hardware Addresses in Detail

For Ethernet and most wireless protocols, the hardware address serves as the definitive identifier at the link layer — the level of communication between two machines on the same wire or wireless cell.

Unicast addresses: The most significant bit of the first byte is 0. The packet is addressed to one specific machine.

Multicast addresses: The most significant bit of the first byte is 1 and the address is not all-ones. The packet is addressed to a group of machines that have joined a multicast group.

Broadcast address: All 48 bits are 1 (FF:FF:FF:FF:FF:FF). Every machine on the network segment receives and processes the packet. Used for ARP (finding the MAC address of a given IP address), DHCP (dynamic IP address assignment), and other discovery protocols.

How hardware addresses are used: When machine A sends a packet to machine B on the same Ethernet segment, the Ethernet frame contains B’s MAC address in the destination field. Every machine on the segment receives the frame, checks the destination MAC, and accepts it only if the MAC matches its own address (or is multicast/broadcast).

Building a simple addressing scheme without standard hardware: If you are building a network from scratch (wired serial bus, UART ring, etc.) without Ethernet hardware, assign hardware addresses manually. Use 1–2 byte addresses appropriate to your network size. Document the assignment: “Node 1 = Primary server, Node 2 = Terminal, Node 3 = Data logger.”

Network (IP) Addressing

IPv4 address structure: A 32-bit address is divided into a network prefix and a host suffix by a subnet mask. The subnet mask is a 32-bit value with consecutive 1-bits for the network portion and 0-bits for the host portion.

Example:

  • IP address: 192.168.1.42
  • Subnet mask: 255.255.255.0 (or equivalently, /24 notation meaning 24 prefix bits)
  • Network: 192.168.1.0 (all host bits zeroed)
  • Broadcast: 192.168.1.255 (all host bits set)
  • Valid host range: 192.168.1.1 to 192.168.1.254 (254 hosts)

Reserved ranges for private networks (not routed on the public internet):

  • 10.0.0.0/8: 10.x.x.x — 16 million addresses
  • 172.16.0.0/12: 172.16.x.x to 172.31.x.x — 1 million addresses
  • 192.168.0.0/16: 192.168.x.x — 65,536 addresses

For a rebuilding scenario, use 192.168.1.x for a small network (up to 254 nodes) or 10.x.x.x for larger networks. Document the address assignment: which addresses are assigned to which machines, which are reserved for future use.

Static assignment: In a small network, simply assign each machine a fixed IP address. Record the assignments in a document. This is more reliable than dynamic assignment (DHCP) for infrastructure equipment that must always be at a known address.

Subnetting: Divide large address spaces into smaller segments. A /24 network with a /28 subnet mask (255.255.255.240) gives 16 subnets of 14 hosts each. Subnetting allows routing between groups of machines on different physical segments.

ARP: Mapping Network Addresses to Hardware Addresses

Within a network segment, machines communicate using MAC addresses. But users and applications specify IP addresses. The Address Resolution Protocol (ARP) bridges this gap.

ARP request: Machine A wants to send a packet to 192.168.1.50 but does not know its MAC address. A broadcasts an ARP request: “Who has IP 192.168.1.50? Tell 00:1A:2B:3C:4D:5E.” This broadcast reaches every machine on the segment.

ARP reply: Machine B, which has IP 192.168.1.50, sends a unicast reply: “192.168.1.50 is at 08:3C:4F:AA:BB:CC.”

ARP cache: Machine A stores this mapping in a local ARP cache (typically valid for 20 minutes). Subsequent packets to 192.168.1.50 use the cached MAC address without requiring another ARP request.

Gratuitous ARP: When a machine joins the network, it sends an ARP reply (unprompted) announcing its own IP-to-MAC mapping. This updates the caches of all other machines on the segment and also detects IP address conflicts (if another machine responds to your gratuitous ARP, two machines have the same IP address — a problem).

Implementing ARP in a simple network: ARP requires a key-value store (the cache) and the ability to send and receive broadcast frames. In a small static network where IP-to-MAC mappings never change, you can use a hard-coded ARP table instead: each machine has a compiled-in table mapping all other machines’ IPs to their MACs. No ARP protocol traffic is needed.

Port Numbers and Multiplexing

Multiple applications on the same machine can use the network simultaneously because each application binds to a different port number. The transport layer (TCP or UDP) uses source and destination port numbers to route arriving packets to the correct application.

Well-known ports (0–1023): Reserved for standard services. Defined by IANA:

  • 7: Echo (debugging)
  • 20/21: FTP data/control
  • 22: SSH
  • 23: Telnet
  • 25: SMTP (email)
  • 53: DNS
  • 80: HTTP
  • 110: POP3 (email retrieval)
  • 443: HTTPS

Registered ports (1024–49151): Registered with IANA for specific applications but not strictly reserved. Common examples: 3306 (MySQL), 5432 (PostgreSQL), 8080 (alternative HTTP).

Ephemeral ports (49152–65535): Used by client applications for the source port of outgoing connections. The operating system assigns an unused ephemeral port when a connection is initiated; it is released when the connection closes.

Designing a port assignment for a rebuilt network: For a small purpose-built network, any port scheme that is consistently documented works. Use low-numbered ports for primary services (1 = time synchronization, 2 = file transfer, 3 = terminal access), keeping the scheme simple enough that operators can remember it without a reference.

Address Assignment and Documentation

The most important aspect of network addressing is documentation. A network without a documented address plan becomes unmaintainable as it grows.

Address plan document (minimum contents):

  1. Network address range in use (e.g., 10.0.0.0/16)
  2. Subnet allocations (which subnets are for which building/department)
  3. Static address assignments: IP address, MAC address, hostname, physical location, purpose, date assigned
  4. Reserved ranges: which addresses are reserved for future use, which are for infrastructure (routers, switches), which are for servers, which are available for workstations
  5. DNS name assignments: which hostnames map to which IPs

Hostname conventions: Give every machine a memorable, consistent name (e.g., hostname server1, terminal-a, storage-2). Use DNS or a simple /etc/hosts file to map names to IP addresses. Never refer to machines by IP address in documentation — IPs change, hostnames persist.

Update the address plan document every time a machine is added, removed, or has its address changed. Post a printed copy in the server room. Keep a backup of the document on at least two separate physical media in separate locations.