CSC263 Computer Networks

Computer NetworksUnit 213 min read

Physical Layer & Network Media – Topologies, Guided & Unguided Media, Subnetting, Sockets

Unit 2 of Computer Networks: this note explains the physical layer functions, various network topologies, guided and unguided transmission media, wireless links, subnetting of a Class C network, socket programming for UDP/TCP, and related concepts needed for TU exams.

Key points

  • The physical layer converts bits into measurable signals and defines the mechanical, electrical, and procedural aspects of the medium.
  • Guided media (twisted‑pair, coaxial, fiber) differ in bandwidth, attenuation, and cost; unguided media (radio, microwave, infrared, satellite) rely on free‑space propagation.
  • Ring topology provides deterministic access but suffers from single‑point failure; other topologies have distinct trade‑offs.
  • Subnetting a Class C address into three subnets yields a /26 mask, giving 4 sub‑networks with 62 usable hosts each.
  • UDP is connectionless and low‑overhead, while TCP provides reliable, connection‑oriented services; socket APIs illustrate both.
  • Understanding media characteristics, topology choices, and socket behavior is essential for solving typical TU exam questions.

1. Role of the Physical Layer

Function Description
Bit‑to‑Signal Conversion Maps binary data (0/1) to electrical, optical, or radio signals.
Transmission & Reception Sends signals onto the medium and recovers them at the receiver.
Line Coding & Modulation Defines how bits are represented (NRZ, Manchester) and how carrier waves are modulated (ASK, FSK, PSK).
Synchronization Provides clock recovery to align sender and receiver timing.
Physical Topology Definition Determines the layout of cables, connectors, and devices (bus, star, ring, mesh).
Medium Specification Sets standards for voltage levels, impedance, attenuation, and maximum length.

The physical layer does not interpret data; it merely ensures that a clean, timed signal reaches the next layer.


2. Network Topologies

2.1 Definition

A network topology is the geometric arrangement of nodes and links in a network, describing how devices are physically connected.

2.2 Common Physical Topologies

Topology Physical Layout Typical Media Advantages Disadvantages
Bus Single backbone cable with taps Coaxial, twisted‑pair Simple, low cost Collision domain large; difficult to isolate faults
Star Central hub/switch with point‑to‑point links Twisted‑pair, fiber Easy to manage, fault isolation Hub is a single point of failure; more cable
Ring Each node connects to two neighbours forming a closed loop Twisted‑pair (Token Ring), fiber Deterministic access (token passing) Failure of one link breaks the ring; latency grows with nodes
Mesh Every node may connect to multiple others Fiber, wireless High redundancy, fault tolerance Expensive, complex cabling
Tree (Hybrid) Hierarchical combination of star and bus Twisted‑pair, fiber Scalable, easy to expand Root failure impacts whole branch

Ring Topology – In‑Depth

  • Operation: A token circulates; only the node possessing the token may transmit.
  • Merits: Predictable bandwidth, no collisions, easy to implement priority schemes.
  • Demerits: A single broken link or malfunctioning node halts the entire network; adding/removing nodes requires temporary shutdown.

3. Guided Transmission Media

Guided (bounded) media confine the signal within a physical conduit.

3.1 Twisted‑Pair Cable

Type Bandwidth Max Length (100 Mbps) Cost Typical Use
UTP (Unshielded) 100 MHz (Cat 5e) – 500 MHz (Cat 6a) 100 m Low Ethernet LANs
STP (Shielded) Similar to UTP but with foil braid 100 m Moderate Environments with EMI
  • How it works: Pairs of wires are twisted to cancel electromagnetic interference.
  • Advantages: Cheap, flexible, easy to install.
  • Disadvantages: Limited bandwidth, susceptible to crosstalk over long distances.

3.2 Coaxial Cable

  • Structure: Central conductor → dielectric → metallic shield → outer jacket.
  • Bandwidth: Up to 10 Gbps (modern RG‑6) over short runs.
  • Max Length: ~500 m for 10 Mbps Ethernet (10BASE‑2).
  • Pros: Better shielding, higher bandwidth than UTP.
  • Cons: Bulkier, more expensive, difficult to splice.

3.3 Optical Fiber

Variant Core Diameter Bandwidth Attenuation Typical Distance
Single‑mode 8–10 µm >10 Tbps 0.2 dB/km >40 km (DWDM)
Multi‑mode 50–62.5 µm 10–100 Gbps 2–3 dB/km ≤2 km (LAN)
  • Principle: Light pulses travel by total internal reflection.
  • Advantages: Extremely high capacity, immune to EMI, long reach.
  • Disadvantages: High installation cost, delicate handling, requires optical transceivers.

3.4 Comparison Table

Parameter Twisted‑Pair Coaxial Fiber (Multi‑mode)
Cost/ft $0.20–0.40 $0.30–0.60 $0.80–1.20
Max Data Rate 1 Gbps (Cat 6) 10 Gbps (RG‑6) 100 Gbps+
Max Segment Length 100 m 500 m 2 km
EMI Susceptibility High Moderate None
Installation Complexity Easy Moderate Difficult

4. Unguided (Wireless) Transmission Media

Signals propagate through free space without a physical conduit.

4.1 Radio Waves

  • Frequency: 30 kHz – 300 GHz.
  • Propagation: Ground wave, skywave, line‑of‑sight.
  • Applications: Wi‑Fi (2.4/5 GHz), cellular (LTE, 5G), broadcast radio.
  • Pros: Wide coverage, inexpensive infrastructure.
  • Cons: Prone to interference, limited bandwidth compared to fiber.

4.2 Microwaves

  • Frequency: 1 GHz – 300 GHz.
  • Propagation: Strict line‑of‑sight; requires repeaters for long distances.
  • Uses: Point‑to‑point backhaul, satellite uplink/downlink, radar.
  • Pros: High data rates, low latency.
  • Cons: Requires clear path, affected by rain fade.

4.3 Infrared (IR)

  • Wavelength: 700 nm – 1 mm.
  • Range: Up to a few meters, line‑of‑sight only.
  • Typical: Remote controls, IrDA ports on laptops.
  • Pros: No RF interference, secure (confined beam).
  • Cons: Very short range, blocked by obstacles.

4.4 Satellite Communication

  • Orbit Types: GEO (≈36,000 km), MEO, LEO.
  • Frequency Bands: C, Ku, Ka.
  • Advantages: Global coverage, useful for remote areas.
  • Disadvantages: High latency (≈500 ms for GEO), expensive transponder leasing.

5. Worked Example – Subnetting a Class C Network into Three Subnets

Problem: Given the network 192.168.10.0/24, create three subnets with roughly equal size.

Step‑by‑Step

  1. Determine required subnets: 3 → next power of two = 4 subnets.
  2. Borrow bits: 2 bits from the host portion (2² = 4).
  3. New subnet mask: /24 + 2 = /26 → binary 11111111.11111111.11111111.11000000 → decimal 255.255.255.192.
  4. Subnet increments: Increment = 256 – 192 = 64.
Subnet # Network Address First Host Last Host Broadcast
0 192.168.10.0/26 192.168.10.1 192.168.10.62 192.168.10.63
1 192.168.10.64/26 192.168.10.65 192.168.10.126 192.168.10.127
2 192.168.10.128/26 192.168.10.129 192.168.10.190 192.168.10.191
3 192.168.10.192/26 192.168.10.193 192.168.10.254 192.168.10.255
  • Usable subnets: We need only three, so we can discard the fourth (192.168.10.192/26) or reserve it for future growth.
  • Hosts per subnet: 2⁶ – 2 = 62 usable addresses.

Takeaway: Subnetting is a logical operation performed at the network layer, but the physical layer must support the resulting broadcast domains (e.g., VLANs on switches).


6. Socket Programming – UDP vs TCP

6.1 Conceptual Diagram

+-----------+          +-----------+
|  Client   |          |  Server   |
| (Socket)  | <----->  | (Socket)  |
+-----------+          +-----------+
   UDP/TCP               UDP/TCP
  • UDP: Connectionless, no handshake, best‑effort delivery.
  • TCP: Connection‑oriented, three‑way handshake, reliable, flow control.

6.2 Minimal Python Example (for illustration)

# udp_server.py
import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', 5005))

while True:
    data, addr = sock.recvfrom(1024)          # blocking receive
    print(f"Received {data} from {addr}")
    sock.sendto(b'ACK', addr)                # simple acknowledgment
# udp_client.py
import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(b'Hello UDP', ('192.168.10.10', 5005))
data, _ = sock.recvfrom(1024)
print(f"Server replied: {data}")
# tcp_server.py
import socket

srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
srv.bind(('0.0.0.0', 6000))
srv.listen(1)
conn, addr = srv.accept()
print(f"Connected by {addr}")
while True:
    data = conn.recv(1024)
    if not data: break
    conn.sendall(b'ACK')
conn.close()
# tcp_client.py
import socket

cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cli.connect(('192.168.10.10', 6000))
cli.sendall(b'Hello TCP')
print(cli.recv(1024))
cli.close()

Key Observations

  • UDP does not guarantee order or delivery; suitable for streaming, DNS, VoIP.
  • TCP establishes a virtual circuit (SYN, SYN‑ACK, ACK) before data transfer, ensuring reliability, flow control (window size), and congestion avoidance (slow start, AIMD).

7. Connection‑Oriented Network Services

  • Definition: Services that require a pre‑established logical connection before data exchange (e.g., TCP, X.25 virtual circuits).
  • Mechanisms:
    • Three‑Way Handshake (SYN, SYN‑ACK, ACK).
    • Sequence Numbers to detect loss and reorder packets.
    • Acknowledgments (ACK) and Retransmission timers.
    • Flow Control via sliding window.
  • Advantages: Reliable delivery, in‑order data, congestion control.
  • Disadvantages: Higher latency, overhead of connection setup/teardown, not suitable for real‑time burst traffic.

8. Client/Server vs Peer‑to‑Peer (P2P) – Physical Perspective

Aspect Client/Server Peer‑to‑Peer
Topology Typically star (central server) Mesh or hybrid (each peer can act as client & server)
Media Requirements High‑capacity link to server; clients may use low‑speed links. More uniform bandwidth; each peer must support both send/receive.
Scalability Server becomes bottleneck; needs load‑balancing hardware. Distributed load; scalability limited by aggregate peer resources.
Fault Tolerance Server failure cripples service. Failure of a single peer has limited impact.
Security Centralized control (firewalls, authentication). Decentralized; security must be handled at each node.

Physical layer considerations: a star topology for client/server often uses shielded twisted‑pair to the switch, while P2P mesh may rely on Wi‑Fi or Ethernet links among many nodes.


9. Types of Networks (LAN, MAN, WAN, PAN) – Quick Overview

Network Type Geographic Scope Typical Media Example
LAN (Local Area Network) ≤ 10 km (building/campus) Twisted‑pair, fiber, Wi‑Fi Office Ethernet
MAN (Metropolitan Area Network) 10 km – 100 km (city) Fiber, microwave City‑wide fiber backbone
WAN (Wide Area Network) > 100 km (national/international) Satellite, leased lines, MPLS Internet, ISP backbone
PAN (Personal Area Network) ≤ 10 m Bluetooth, IR, ZigBee Wearables, smartphone accessories

10. TCP/IP Model vs OSI Model – Layer Mapping

OSI Layer TCP/IP Equivalent Primary Protocols
Application Application HTTP, FTP, DNS, SMTP
Presentation — (functions in Application) TLS/SSL, JPEG, ASCII
Session — (functions in Application) NetBIOS, RPC
Transport Transport TCP, UDP
Network Internet IP, ICMP, IGMP
Data Link Network Access Ethernet, PPP, Wi‑Fi (IEEE 802.11)
Physical Network Access Physical media standards (IEEE 802.3, 802.3u)

Key Difference: TCP/IP collapses the top three OSI layers into a single Application layer, reflecting practical protocol implementations.


11. Software‑Defined Networking (SDN) – Brief Introduction

  • Concept: Decouple the control plane (decision‑making) from the data plane (packet forwarding).
  • Components:
    • Controller (centralized software, e.g., OpenDaylight).
    • Southbound APIs (OpenFlow, NETCONF) to program switches.
    • Northbound APIs for applications (REST, gRPC).
  • Features:
    • Programmability – network behavior can be changed by software without hardware upgrades.
    • Global View – controller sees the entire topology, enabling optimal routing and traffic engineering.
    • Automation – scripts can provision VLANs, QoS, security policies on demand.
  • Applications: Data‑center virtualization, traffic shaping, network slicing for 5G, campus network management.

12. Summary

The physical layer is the foundation upon which all higher‑layer protocols rely. Selecting the appropriate topology and media determines bandwidth, reliability, and cost. Guided media (twisted‑pair, coaxial, fiber) excel in controlled environments, while unguided media (radio, microwave, satellite) enable mobility and long‑distance connectivity. Understanding subnetting, socket programming, and connection‑oriented services equips students to design and troubleshoot real‑world networks. Finally, awareness of TCP/IP vs OSI, network types, and emerging SDN concepts prepares learners for both exam questions and industry practice.


Exam tip

  • Memorize the media comparison table (bandwidth, attenuation, max length) – many marks are given for a concise table.
  • Subnetting: Practice the “borrow‑bits” method; remember that the number of subnets = 2ⁿ and hosts per subnet = 2^(host‑bits) − 2. Write the steps clearly in the answer.
  • Topology question: Draw a quick ASCII diagram of the requested topology (e.g., ring) and list one merit and one demerit; examiners love a diagram plus bullet points.
  • Socket code: You never need to write full programs; a 3‑line snippet showing socket(), bind()/connect(), and send()/recv() earns full credit for “demonstrate”.
  • Connection‑oriented vs connectionless: Contrast TCP and UDP in a two‑column table; include handshake, reliability, and typical applications.
  • Time management: Allocate ~5 minutes for each sub‑question; start with the highest‑weight items (media tables, subnetting) to secure marks early.

Based on the TU BSc CSIT syllabus for Computer Networks (CSC263), unit 2.

Discussion

Loading…