Skip to content
Chethan Yadav_
Computer Networks

CN/Lesson 1 of 8/6 min read

Introduction to Computer Networks

Network types, topologies, transmission modes, circuit vs packet switching, performance metrics, the OSI model, the TCP/IP model, and encapsulation.


On this page

Computer Network

A computer network is a set of devices (nodes) connected by links to share data and resources. Key elements: nodes (hosts, routers, switches), links (wired or wireless media) and protocols (rules for communication).

Protocol

A protocol defines the format, order and meaning of messages exchanged, and the actions taken on sending or receiving them. Elements: syntax (format), semantics (meaning), timing (when and how fast).

Types of networks

TypeRangeExample
PANA few metersBluetooth headset
LANBuilding or campusOffice Ethernet, home Wi-Fi
MANCityCable TV network, city Wi-Fi
WANCountry or globalThe internet, MPLS links between offices

LAN

A Local Area Network is privately owned, high speed and low error rate, usually Ethernet or Wi-Fi.

WAN

A Wide Area Network spans large distances, often using leased lines from telecom providers; slower and more expensive per bit than a LAN. The internet is a network of networks.

Network Topology

The physical or logical layout of nodes:

TopologyDescriptionProsCons
BusAll nodes on one cableCheap, simpleCable failure kills all, collisions
StarAll nodes to a central switchEasy to manage, one failure isolatedCentral device is a single point of failure
RingEach node connected to two neighbors in a loopOrdered access (token)One break can stop the ring
MeshEvery node connected to many othersHighly reliable, redundant pathsExpensive: full mesh needs n(n-1)/2 links
TreeHierarchy of starsScalableRoot failure affects branches
HybridMixFlexibleComplex

Transmission modes

  • Simplex: one direction only (keyboard to computer, TV broadcast).
  • Half-duplex: both directions, one at a time (walkie-talkie, classic hubs).
  • Full-duplex: both directions at once (telephone, modern switched Ethernet).

Delivery types: unicast (one to one), broadcast (one to all), multicast (one to a group), anycast (one to the nearest of a group, used by DNS root servers and CDNs).

Circuit Switching

A dedicated path is reserved for the whole conversation (classic telephone network).

  • Guaranteed bandwidth, constant delay.
  • Wasteful when idle; setup time before sending.

Packet Switching

Data is split into packets, each routed independently and stored-and-forwarded by routers (the internet).

  • Efficient sharing of links (statistical multiplexing), robust to failures.
  • Variable delay, packets can be lost or arrive out of order (higher layers fix this).

Virtual circuit packet switching (ATM, MPLS) sets up a path first, then all packets follow it. Datagram switching (IP) routes each packet independently.

Performance metrics

Bandwidth

Bandwidth is the maximum data rate of a link, in bits per second (bps). Capacity of the pipe.

Throughput

Throughput is the actual rate achieved, always less than or equal to bandwidth (limited by the bottleneck link, congestion, protocol overhead).

Latency

Latency (delay) is the time for a bit to travel from source to destination. Total delay per hop:

delay = transmission + propagation + queuing + processing
 
transmission delay = packet size / bandwidth       (time to push bits onto the link)
propagation delay  = distance / signal speed        (~2 x 10^8 m/s in fiber)

Example: a 1500 byte packet on a 100 Mbps link: 12000 / 10^8 = 0.12 ms transmission. Across 3000 km of fiber: 3 x 10^6 / 2 x 10^8 = 15 ms propagation.

  • Round Trip Time (RTT): time for a message to go and the reply to return.
  • Bandwidth-delay product = bandwidth x RTT: the amount of data "in flight" needed to fill the pipe. Important for TCP window sizing.
  • Jitter: variation in delay; bad for voice and video.

OSI Model

The OSI (Open Systems Interconnection) model is a 7-layer reference model by ISO. Each layer serves the layer above and uses the layer below.

#LayerFunctionPDUExamplesDevices
7ApplicationNetwork services for appsDataHTTP, DNS, SMTP, FTP
6PresentationFormat, encryption, compressionDataTLS, JPEG, ASCII, JSON
5SessionEstablish, manage, end sessionsDataRPC, NetBIOS, session checkpoints
4TransportEnd-to-end delivery, ports, reliabilitySegment / DatagramTCP, UDP
3NetworkLogical addressing, routingPacketIP, ICMP, OSPFRouter
2Data LinkFraming, MAC addressing, error detectionFrameEthernet, Wi-Fi, PPP, ARPSwitch, bridge
1PhysicalBits on the mediumBitCables, voltages, radioHub, repeater

Mnemonic (top down): All People Seem To Need Data Processing. Bottom up: Please Do Not Throw Sausage Pizza Away.

TCP/IP Model

The TCP/IP model is the practical model the internet is built on.

TCP/IP layerOSI layersProtocols
ApplicationApplication, Presentation, SessionHTTP, DNS, SMTP, SSH, TLS
TransportTransportTCP, UDP, QUIC
InternetNetworkIP, ICMP, IGMP
Network Access (Link)Data Link, PhysicalEthernet, Wi-Fi

Some books use 5 layers (splitting Link into Data Link and Physical).

OSI vs TCP/IP

OSITCP/IP
Theoretical reference modelPractical, implemented model
7 layers4 (or 5) layers
Model came before protocolsProtocols came first, model described them
Strict separation of service, interface, protocolLess strict

Encapsulation

As data goes down the stack, each layer adds its own header (and the data link layer a trailer). This is encapsulation. The receiver strips headers going up (decapsulation).

Application:              [ HTTP data ]
Transport:          [TCP hdr][ HTTP data ]                 = segment
Network:     [IP hdr][TCP hdr][ HTTP data ]                = packet
Data Link: [Eth hdr][IP hdr][TCP hdr][ HTTP data ][FCS]    = frame
Physical:  0101010111010...                                = bits

PDU

The Protocol Data Unit is the name of the data unit at each layer: data, segment (TCP) or datagram (UDP), packet, frame, bits.

Each router only processes up to layer 3; a switch up to layer 2. Hosts process all layers.

Quick revision

  • LAN small and fast, WAN large; internet is packet switched.
  • Delay = transmission + propagation + queuing + processing.
  • OSI 7 layers; TCP/IP 4 layers.
  • PDUs: segment (L4), packet (L3), frame (L2), bit (L1).
  • Router = L3, switch = L2, hub = L1.