SEN2008 · Week 2 · Introduction : Overview of computer networks, Networking Basics, Protocol Layering, Physical Layer

Protocol layers and the physical layer

The OSI and TCP/IP layer models, encapsulation and overhead calculation, and bandwidth, bit rate and baud with the Nyquist and Shannon limits at the physical layer.

protocol layeringOSI modelTCP/IP modelencapsulationPDUsegmentdatagramframeheader overheadbandwidthbit ratebaud rateNyquist theoremShannon capacitySNRdecibelManchester encoding

This week we build the skeleton of the network. A network is a complex system in which dozens of protocols work together. The way to manage this complexity is layering: each layer provides a service, uses only the service of the layer below it, and “talks” only to the same layer on the other side. The exam has three types of questions: layer matching (which job belongs to which layer), encapsulation overhead, and physical-layer capacity calculation (Nyquist, Shannon).

Golden rules:

  1. Know the five layers and the PDU names by heart: message, segment, datagram, frame, bit.
  2. Encapsulation: each layer adds a header on the way down and strips it on the way up.
  3. Bandwidth is in Hz, bit rate is in bps. They are not the same thing.
  4. Noiseless channel: Nyquist. Noisy channel: Shannon. In Shannon the SNR must be a ratio; if dB is given, convert it.

Why layers?

Think of an airline trip: buy a ticket, check a bag, go through the gate, take off, fly, land, leave through the gate, collect the bag. Each step corresponds to the reverse step at the destination airport. The baggage handler doesn’t need to know how the pilot flies. The same holds in a network: a programmer writing HTTP doesn’t know whether the data goes over fiber or Wi-Fi.

Benefits of layering:

  • Modularity: changing one layer (5G instead of Wi-Fi) doesn’t break the others.
  • Clarity: each layer has a single responsibility.

The downside: some work is repeated at two layers (error checking at both the link and the transport layer), and one layer may need information from another.

The Internet (TCP/IP) model: 5 layers

LayerJobExample protocolsPDU
ApplicationNetwork applicationsHTTP, SMTP, DNS, SSHmessage
TransportProcess-to-process delivery, portsTCP, UDPsegment
NetworkHost-to-host, routingIP, ICMP, OSPF, BGPdatagram
LinkBetween two neighbouring nodesEthernet, Wi-Fi (802.11), PPPframe
PhysicalPutting bits on the wire / into the aircopper, fiber, radio codingbit

The OSI model: 7 layers

ISO’s OSI (Open Systems Interconnection) model has two more layers:

OSI layerJobWhere in TCP/IP?
7 Applicationapplication protocolApplication
6 Presentationdata format, encryption, compressionInside Application
5 Sessionsessions, synchronization, checkpointsInside Application
4 Transportend-to-end deliveryTransport
3 NetworkroutingNetwork
2 Data Linkframing, between neighboursLink
1 Physicalbit transmissionPhysical

TIP · memorizing the order. From bottom to top: “Please Do Not Throw Sausage Pizza Away” (Physical, Data Link, Network, Transport, Session, Presentation, Application).

Encapsulation

At the sending host, data moves from top to bottom. Each layer takes the packet from above as a payload and puts its own header in front of it:

Application : [ M ]                                   message
Transport   : [ Ht | M ]                              segment
Network     : [ Hn | Ht | M ]                         datagram
Link        : [ Hl | Hn | Ht | M | trailer ]          frame
Physical    : 0110101011...                           bit

At the receiver the reverse happens (decapsulation): each layer reads its own header, strips it, and hands the contents to the layer above. A router on the path looks only at the link and network headers; a switch only at the link header. End hosts process all five layers.

Worked example: overhead

1000 bytes of application data are sent with TCP (20 bytes), IPv4 (20 bytes) and Ethernet (14-byte header + 4-byte FCS = 18 bytes).

Frame      = 1000 + 20 + 20 + 18 = 1058 bytes
Efficiency = 1000 / 1058 = 0.9452  -> 94.52%
Overhead   = 58 / 1058   = 5.48%

For small messages the efficiency collapses: a 1-byte keystroke (SSH) becomes a 59-byte frame. This is why protocols try to combine small packets.

PITFALL · number of headers. Each layer adds one header; the physical layer adds no header (the preamble is a separate topic). Ethernet also puts a trailer (FCS, CRC) at the end. You will compute this as the CRC in week 3.

Physical layer basics

The physical layer turns bits into signals: voltage on copper, light in fiber, radio waves in the air.

Basic concepts

TermMeaningUnit
BandwidthThe range of frequencies the channel passesHz
Bit rate (data rate)Bits transmitted per secondbps
Baud rate (symbol rate)Signal elements (symbols) transmitted per secondbaud
Signal level VVNumber of different values a symbol can takecount
SNRSignal power / noise powerratio or dB

If a symbol can take VV different values, it carries log⁡2V\log_2 V bits:

bit rate=baud rate×log⁡2V\text{bit rate} = \text{baud rate} \times \log_2 V

Example: at 9600 bps and 2400 baud, each symbol carries 9600/2400=49600/2400 = 4 bits, so 24=162^4 = 16 levels.

PITFALL · “bandwidth” in everyday language. In marketing, people say “100 Mbps bandwidth”. In a physical-layer question in this course, bandwidth means Hz. If a question says “bandwidth of 3 kHz”, that is a frequency range, not a bit rate.

Nyquist: the noiseless channel

On a noiseless channel with bandwidth BB Hz, at most 2B2B symbols per second can be sent. With VV levels:

CNyquist=2Blog⁡2VC_{Nyquist} = 2B\log_2 V

B = 3000 Hz, V = 2 :  2 x 3000 x 1 = 6,000 bps
B = 3000 Hz, V = 4 :  2 x 3000 x 2 = 12,000 bps

According to Nyquist, you can raise the rate without limit by increasing the number of levels. In reality, noise does not allow this.

Shannon: the noisy channel

Noise makes levels that are close to each other indistinguishable. The Shannon capacity is an absolute upper limit, independent of the number of levels:

CShannon=Blog⁡2(1+SNR)C_{Shannon} = B\log_2(1 + \text{SNR})

SNR is usually given in decibels:

SNRdB=10log⁡10(SNR)⟺SNR=10SNRdB/10\text{SNR}_{dB} = 10\log_{10}(\text{SNR}) \quad\Longleftrightarrow\quad \text{SNR} = 10^{\text{SNR}_{dB}/10}

dBRatio
10 dB10
20 dB100
30 dB1000
40 dB10,000

Worked example: a telephone line

B=3000B = 3000 Hz, SNR = 30 dB.

SNR ratio = 10^(30/10) = 1000
C = 3000 x log2(1 + 1000) = 3000 x 9.967 = 29,902 bps (approximately)

This limit is why classic dial-up modems got stuck at around 30 kbps.

Using the two formulas together

A common exam question: “How many levels are needed to reach the Shannon capacity?” First find CC from Shannon, then solve for VV in Nyquist.

B = 1 MHz, SNR = 255
Shannon: C = 10^6 x log2(256) = 8 Mbps
Nyquist: 8 x 10^6 = 2 x 10^6 x log2 V  ->  log2 V = 4  ->  V = 16

Line coding

CodingIdeaBaud / bit rate
NRZ1 is high voltage, 0 is low voltage1
NRZIChange the level when a 1 arrives1
ManchesterTransition in the middle of every bit (direction gives the bit)2
4B/5BSend 4 data bits as a 5-bit code5/4

In long runs of 0s or 1s, the receiver’s clock drifts with NRZ. Because Manchester makes a transition in every bit, the clock comes from the signal itself (self-clocking), but it needs twice the signal rate: 10 Mbps Ethernet is 20 Mbaud.

Transmission media

MediumTypeNote
Twisted pairguided, copperCat5e/6, 1-10 Gbps, short distance
Coaxialguided, coppercable TV, shared
Fiber opticguided, lightvery high speed, immune to noise, hard to eavesdrop on
Radio (Wi-Fi, cellular, satellite)unguidedbroadcasts, anyone can listen

Security note: a wireless medium is a broadcast medium. Anyone within range can receive the signal. This is why encryption (WPA2/WPA3) is a must on Wi-Fi. Tapping fiber requires physical access and is much harder.

Common mistakes

Wrong ideaCorrect
Bandwidth = bit rateAt the physical layer, bandwidth is in Hz. You get to bit rate with Nyquist/Shannon.
Putting dB directly into ShannonFirst convert to a ratio with 10dB/1010^{dB/10}.
Blog⁡2VB\log_2 V in NyquistIt is 2Blog⁡2V2B\log_2 V. Don’t forget the factor 2.
Adding levels raises the rate without limitWith noise present, you cannot exceed the Shannon limit.
Baud = bit rate alwaysOnly when V=2V = 2. In general bit rate == baud ×log⁡2V\times \log_2 V.
A router processes the TCP headerA router has 3 layers: link + network. It normally doesn’t look at port information.
OSI and TCP/IP have the same number of layersOSI has 7, the Internet model has 5. No Session and Presentation.
Segment = frameA segment is the transport PDU, a frame is the link PDU.

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Which layer of the five-layer Internet (TCP/IP) model is responsible for delivering datagrams from the source host to the destination host across multiple networks?

  1. Application layer
  2. Transport layer
  3. Network layer
  4. Link layer
  5. Physical layer
Show answer
C) Network layer

The network layer (IP) carries a datagram from host to host, across many routers.
The transport layer carries data from process to process (port), and the link layer carries it only between two neighbouring nodes.

Question 2easy

What is the name of the protocol data unit (PDU) at the link layer?

  1. Message
  2. Segment
  3. Datagram
  4. Frame
Show answer
D) Frame

Application: message, transport: segment, network: datagram (packet), link: frame, physical: bit.
Memorize the order as "M-S-D-F-B".

Question 3easy

Which two OSI layers have no separate counterpart in the five-layer Internet model?

  1. Transport and Network
  2. Session and Presentation
  3. Data Link and Physical
  4. Application and Session
Show answer
B) Session and Presentation

OSI has 7 layers: Application, Presentation, Session, Transport, Network, Data Link, Physical.
In the Internet model, Presentation (encryption, compression, data format) and Session (synchronization, sessions) are not separate layers. If needed, the application does them itself.

Question 4easy

A noiseless channel has a bandwidth of 4000 Hz and the signal uses 8 discrete levels. What is the maximum data rate according to Nyquist?

Show answer
24,000 bps

Nyquist: C=2Blog⁡2V=2×4000×log⁡28=8000×3=24,000C = 2B\log_2 V = 2 \times 4000 \times \log_2 8 = 8000 \times 3 = 24{,}000 bps.

Question 5medium

A channel has bandwidth 1 MHz and a signal-to-noise ratio of 63 (as a plain ratio, not dB). What is its Shannon capacity?

Show answer
6 Mbps

Shannon: C=Blog⁡2(1+SNR)=106×log⁡264=106×6=6C = B\log_2(1 + \text{SNR}) = 10^6 \times \log_2 64 = 10^6 \times 6 = 6 Mbps.
The SNR is given here as a ratio, so there is no dB conversion.

Question 6medium

A telephone channel has bandwidth 2000 Hz and SNR = 20 dB. What is the Shannon capacity (round to the nearest bps)?

Show answer
13,316 bps

First convert dB to a ratio: SNR=1020/10=100\text{SNR} = 10^{20/10} = 100.C=2000×log⁡2(101)≈2000×6.658=13,316C = 2000 \times \log_2(101) \approx 2000 \times 6.658 = 13{,}316 bps.
Pitfall: if you put 20 directly into the formula you get 2000log⁡221≈87852000\log_2 21 \approx 8785, which is wrong.

Question 7medium

An application sends a 500-byte message using UDP (8-byte header) over IPv4 (20-byte header) over Ethernet (18 bytes of header plus trailer). What fraction of the transmitted frame is application data?

Show answer
91.58%

Encapsulation: each layer adds its own header.
Frame size =500+8+20+18=546= 500 + 8 + 20 + 18 = 546 bytes.
Efficiency =500/546≈0.9158=91.58%= 500 / 546 \approx 0.9158 = 91.58\%.

Question 8medium

A modem transmits 4800 symbols per second using 16-QAM (16 distinct symbols). What is the bit rate?

Show answer
19,200 bps

Each symbol carries log⁡216=4\log_2 16 = 4 bits. Bit rate =baud×log⁡2V=4800×4=19,200= \text{baud} \times \log_2 V = 4800 \times 4 = 19{,}200 bps.
Baud (symbols/s) and bits/s are equal only for a 2-level signal.

Question 9medium

You need 36 kbps over a noiseless channel with bandwidth 3 kHz. What is the minimum number of signal levels required?

Show answer
64

Nyquist: 36000=2×3000×log⁡2V36000 = 2 \times 3000 \times \log_2 V, so log⁡2V=6\log_2 V = 6 and V=26=64V = 2^6 = 64 levels.

Question 10medium

With Manchester encoding, a 10 Mbps Ethernet link needs what signal (baud) rate?

  1. 5 Mbaud
  2. 10 Mbaud
  3. 20 Mbaud
  4. 40 Mbaud
Show answer
C) 20 Mbaud

Manchester makes a transition in the middle of every bit, so there are 2 signal elements per bit. Baud =2×10=20= 2 \times 10 = 20 Mbaud.
In return, the receiver can easily synchronize its clock (self-clocking).

Question 11hard

A channel has bandwidth 1 MHz and SNR = 255. (a) What is the Shannon capacity? (b) How many signal levels are needed to reach that rate by Nyquist?

Show answer
8 Mbps, 16 levels

(a) C=106×log⁡2(256)=8×106C = 10^6 \times \log_2(256) = 8 \times 10^6 bps = 8 Mbps.
(b) 8×106=2×106×log⁡2V8 \times 10^6 = 2 \times 10^6 \times \log_2 V, so log⁡2V=4\log_2 V = 4 and V=16V = 16.
Shannon gives the upper limit; Nyquist tells you how many levels it takes to reach that limit.

Question 12hard

A router forwards a packet. Which headers does it examine and possibly rewrite, and which does it normally leave untouched?

  1. It processes only the transport header
  2. It processes the link and network headers; it does not process transport or application headers
  3. It processes all five layers' headers
  4. It processes only the physical layer
Show answer
B) It processes the link and network headers; it does not process transport or application headers

A router is a 3-layer device: physical, link, network. It strips the link header of the incoming frame, looks at the IP header and forwards (decrements TTL, updates the checksum), and sends it with a new link header.
A switch has only 2 layers (physical, link), and hosts process all 5 layers. From a security view: a device that looks at the TCP port (firewall, NAT) knowingly breaks this layer separation.

Verification: Numerical answers were computed with node (verify/SEN2008/02.mjs): encapsulation overhead and efficiency, Nyquist 2B·log2(V), Shannon B·log2(1+SNR), dB conversion, relation between baud and bit rate. Concept questions were checked against textbook definitions.

Review card

TCP/IP (5): Application | Transport | Network | Link | Physical OSI (7): Application, Presentation, Session, Transport, Network, Data Link, Physical PDU: message -> segment -> datagram -> frame -> bit Encapsulation: each layer prepends a header; the receiver strips them in reverse order efficiency = data / (data + all headers) TCP 20, IPv4 20, UDP 8, Ethernet 18 host 5 layers, router 3 (phy, link, net), switch 2 (phy, link) bandwidth (Hz) ≠ bit rate (bps); bit rate = baud x log2(V) Nyquist (noiseless): C = 2 B log2 V Shannon (noisy): C = B log2(1 + SNR) SNR as a ratio! dB -> ratio: SNR = 10^(dB/10) 30 dB = 1000, 20 dB = 100, 10 dB = 10 Manchester: baud = 2 x bit rate (self-clocking) NRZ: baud = bit rate The Shannon limit cannot be beaten by adding levels