Mode of data transfer -> Circuit Switching & Packet Switching

The

Imagine you want to send a long message from Computer A to Computer B.

  • Circuit switching: establish one fixed route first, then send everything along that route.
  • Packet switching: break the message into packets, then send each packet independently through the network.

Circuit Switching

  • Connection-Oriented Communication
    • A connection must be established before data transmission begins.
    • All data follows the same path throughout the communication.
    • The connection is terminated after transmission is complete.
    • Example: early telephone systems established a fixed path between the caller and receiver.
    • It is not implemented at the network layer.

Packet Switching

  • Connectionless Communication
    • No connection is established before data transmission begins.
    • Data is divided into smaller units called packets.
    • Each packet is individually addressed and sent to the receiver.
    • Each packet may take a different path to reach the destination.
    • Receiving computer wait for all packets of the message and reassembles the packets into the original message before delivering the message to the upper level.
    • Network layer in the Internet is packet-switched network.
FeatureCircuit switchingPacket switching
Connection established first?YesNo
Data divided into packets?Not in the same independent-routing senseYes
RouteSame fixed routeEach packet is handled independently
ResourcesRoute or capacity is reservedNetwork resources are shared
Order of arrivalNormally in orderMay arrive out of order
EfficiencyCan waste reserved capacityMore efficient use of network capacity
Main exampleEarly telephone systemsThe Internet

Model Definition

Circuit switching is a method of data transmission in which a dedicated connection is established between the sender and receiver before communication begins. All data is then transmitted along the same fixed path throughout the entire communication.

Packet switching is a method of data transmission in which a message is divided into smaller units called packets. Each packet is individually addressed and transmitted independently through the network, possibly taking a different route. At the destination, the packets are reordered and reassembled to form the original message.

Differences, Advantages and Disadvantages

FeatureCircuit switchingPacket switching
ConnectionA connection must be established firstNo connection is established first
RouteAll data travels along the same fixed pathPackets are sent independently and may take different paths
Data transmissionData is sent as a continuous streamThe message is divided into packets and reassembled at the destination
AdvantagesDisadvantages
Data arrives in the correct orderTime is needed to establish the connection
Delay is predictable after connectionReserved network resources may be wasted
No need to reorder and reassemble packetsThe connection fails if the fixed path fails
AdvantagesDisadvantages
Network resources are shared efficientlyPackets may arrive out of order
No connection setup is requiredPackets may be lost during transmission
Packets can use an alternative route if one route is unavailableDifferent routes may cause variable delays

Protocol

Definition

A set of rules, standards, or procedures that govern how data is transmitted, received, and interpreted between devices in a communication network.

ProtocolPurpose
Internet Protocol version 4 (IPv4)Responsible for packetising, forwarding and delivering packets at the network layer.
Internet Control Message Protocol version 4 (ICMPv4)Supports the unreliable and connectionless IPv4 protocol by handling errors that may occur during network-layer delivery.
Internet Group Management Protocol (IGMP)Supports IPv4 multicasting, allowing data to be sent to a group of devices.
Address Resolution Protocol (ARP)Connects the network and data-link layers by mapping network-layer addresses, such as IP addresses, to data-link-layer addresses, such as MAC addresses.

IP

Definition

An unreliable connectionless protocol responsible for source-to-destination delivery

Address Resolution Protocol (ARP)

  • Protocol used for sending error message, performing diagnostics, control the flow of data

Internet Control Message Protocol / Internet Group Message Protocol

  • Protocol that enables one host to send one stream of data to many hosts at the same time.

IP Address

  • Every host on a TCP/IP network needs to have a unique address. With this unique address, it is possible to send data from host to host.
  • Every packet contains addressing information in the header, and the IP address in the header is used to route packets

IPv4

  • 32-bit address that uniquely identifies every host on a network

IPv6

  • 128-bits addresses

  • 8 groups of 4 hex digits (16 bits)

    • eg. EFDC:BA62:7654:3312:EFDC:BA72:7653:3210
  • IPv6 Zero Compression

    • IPv6 addresses containing many zeros can be shortened using zero compression.
    • Step 1: Remove leading zeros
      • Leading zeros within each group can be removed.
      • Example: 0008 becomes 8, and 0800 becomes 800.
    • Step 2: Use double-colon notation
      • Consecutive groups containing only zeros can be replaced with ::.
      • :: can only be used once in an IPv6 address.
  • Example

    • Original: 1080:0000:0000:0000:0008:0800:200C:417A
    • Step 1: 1080:0:0:0:8:800:200C:417A
    • Step 2: 1080::8:800:200C:417A
FeatureIPv4IPv6
Address size32 bits128 bits
Address formatDotted decimalHexadecimal, colon-separated
Number of addressesApproximately 2³²Approximately 2¹²⁸
Header sizeVariableFixed and simplified
BroadcastSupportedReplaced by multicast

IPv4 Classes

ClassNetwork PortionHost PortionRangeUsage
A8 bits (first bit = 0) → 2^7 networks24 bits → 2^24 hosts0.0.0.0 – 127.255.255.255Very large networks
B16 bits (first two bits = 10) → 2^14 networks16 bits → 2^16 hosts128.0.0.0 – 191.255.255.255Medium networks
C24 bits (first three bits = 110) → 2^21 networks8 bits → 2^8 hosts192.0.0.0 – 223.255.255.255Small networks
DFirst four bits = 1110N/A224.0.0.0 – 239.255.255.255Multicasting
EFirst four bits = 1111N/A240.0.0.0 – 255.255.255.255Experimental/future use

Class A

A Class A address has:

Network.Host.Host.Host
  • First 8 bits are the network portion.
  • Remaining 24 bits are the host portion.
  • The first binary bit is always 0.
  • 0.0.0.0 is reserved.
  • 127.0.0.0 is reserved for loopback.

For one Class A network:

possible host combinations.

However:

  • All host bits 0 represent the network address.
  • All host bits 1 represent the broadcast address.

Therefore:

usable host addresses.

Class B

A Class B address has:

Network.Network.Host.Host
  • First 16 bits are the network portion.
  • Remaining 16 bits are the host portion.
  • The first two binary bits are 10.

For each Class B network:

usable host addresses.

Example:

Network address:    172.16.0.0
Broadcast address:  172.16.255.255

Class C

A Class C address has:

Network.Network.Network.Host
  • First 24 bits are the network portion.
  • Remaining 8 bits are the host portion.
  • The first three binary bits are 110.

For each Class C network:

usable host addresses.

Example:

Network address:    192.168.1.0
Broadcast address:  192.168.1.255

Class D&E

ClassPurpose
DMulticasting: transmitting data to a selected group of devices
EReserved for experimental or future use

IPv4 Limitations

  • Inflexible and cannot adapt to every network size.
  • Address exhaustion (used too quickly).
  • Inefficient routing tables (too large).

Solutions

  • Subnetting
    • The process of dividing a large network into smaller, more manageable subnetworks, or subnets.
    • Helps solve the shortage of network addresses in classful addressing, especially for Class B networks.
    • Allows one network prefix to be used for multiple physical networks.
    • Helps organise networks more efficiently.
    • Reduces broadcast traffic.