TCP/IP (Transmission Control Protocol / Internet Protocol)
A protocol suite: a set of protocols…
- Similar concept to the OSI model…
Layering
Each layer receives the same object sent by the corresponding layer at the source.
Benefits of Layering
- Modularity: grouping of specific functions into layers makes it easier to design, understand and troubleshoot.
- Interoperability: standardized layers and functions allow cross-compatibility for software, as long as they follow the same protocols for each layer.
- Flexibility and abstraction: changes made to one layer should not affect the functionality of other layers.
- Simplified troubleshooting: network issues can be diagnosed by layers.
- Standardization: provides a common language and framework for implementing network protocols.
Key Characteristics of the TCP/IP Suite
- Designed to work over any underlying network infrastructure.
- Runs over any sort of hardware.
- Flexible and scalable.
TCP/IP Layers

Physical Layer
- Supports all standard and proprietary protocols.
- Communication between two nodes (computer or router).
- Communicates in bits.
Data Link Layer
- Supports all standard and proprietary protocols.
- Communication between two nodes.(computer or router)
- Communicates in frames (packets that encapsulate data received from above, plus optional trailer for error detection…ect).
Network Layer
- Selects the best path for data to travel.
- Mainly uses the Internet Protocol (IP).
- Includes various supporting protocols for IP.

Transport Layer
- Responsible for source-to-destination and end-to-end conversations.
- Transmission Control Protocol (TCP): connection-based, reliable.
- User Datagram Protocol (UDP): connectionless, faster but unreliable.
Application Layer
- Responsible for exchange of information between transport and application processes.
- Contains many high-level protocols for different uses:
- HTTP, FTP, SMTP, POP, Telnet, DNS, etc.

encapsulation process of TCPIP
- HTTP, FTP, SMTP, POP, Telnet, DNS, etc.
Modes of Data Transfer
Circuit Switching
Definition
a network communication method that establishes a dedicated communications channel(the circuit) through the network before communication
- Connection established before the start of data transfer (between network layers).
- Data moves through the same path defined by the connection.
- Example: early telephone systems.
Advantages
- Guaranteed data rate.
- Reliable.
- Quality of Service (QoS).
- Security.
- Ease of management.
- Compatibility.
Disadvantages
- Limited scalability.
- Resource-intensive.
- Inefficient
- Some latency.
Packet Switching
Definition
packet switching is a method of data transmission where data is broken down into small units called packets, and transmitted over the network.
each packet takes the best route possible and travels independently to reach the destination host
packets are assigned sequential number for reassembly at destination host
- Connectionless.
- Data fragmented into manageable packets.
- Packets are individually addressed and sent to the recipient.
- Packets may take different routes.
- The network layer is in charge of reassembly and delivery.
Detailed Process
- Routing: selection of best path to destination.
- IP is responsible for packet sending.
Host A:
- Packet is encapsulated with IP header containing source and destination addresses.
- Consults routing table:
- If Host B is on the same network, data is sent directly.
- Else, data is sent to the default gateway (another device set as the default IP).
- Packets are fragmented if they exceed the MTU (Maximum Transmission Unit).
Router:
- Receives and validates the packet (checks for corruption and destination).
- Looks at the destination IP.
- Consults the routing table for the next hop.
- Fragments packets into smaller units if needed.
- Passes packet to data link layer.
- Process repeats until destination.
Host B:
- Validates packet for errors.
- Extracts and caches data.
- Reassembles fragments.
- Passes data to transport layer once complete.
- Cached data has a reassembly timer:
- If timer expires, cache is destroyed and error is sent for retransmission.
Main Differences Between Circuit and Packet Switching
- Circuit switching: connection-based, all data follows the same path.
- Packet switching: connectionless, data is broken into smaller packets that travel independently.
Protocols
Definition
A standardized set of rules that dictates how data is transmitted formatted and received between network devices
it is something akin to a common language between devices
Features of a Protocol
- Ensure compatibility and interoperability between systems, software and devices.
- Define how data is formatted and organized in transmission.
- Define how devices initiate, maintain, and terminate connections.
- Define how errors are handled.
Common Network Protocols
- IPv4: packetizing, forwarding, and delivery
- ICMPv4(Internet control message protocol version 4): handles errors during delivery.
- IGMP(Internet group management protocol): supports multicasting.
- ARP(Address resolution protocol): connects network and data link layers by mapping IP to MAC addresses.
Internet Protocol (IP)
IPv4
- Unreliable: packets may be corrupted, lost, out of order, delayed, or congested.
- Connectionless: each packet is handled independently and can follow different routes.
- Responsible for source-to-destination delivery.
Process (host to source):
- IP header is added with source and destination addresses.
- If destination is on the same network (same subnet mask), packet is sent directly.
- Else, packet is sent to default gateway/router (indirect delivery).
- Packet may be fragmented according to MTU.
- MAC address of next hop is obtained via ARP of the destination IP before passing to data link layer.
ARP (Address Resolution Protocol)
- Maps IP addresses to hardware (MAC) addresses.
- Checks ARP cache:
-
If entry found, it is used (2–10 minute lifespan).
-
Else, sends an ARP request (broadcast).
- All nodes in local network receive the ARP request.
- Destination node with matching IP responds with its hardware address.
-
ICMP (Internet Control Message Protocol) (informational)
- Used for error messages, diagnostics, and controlling data flow.
- Example: ICMP source-quench packet tells sender to slow down.
- Ping uses ICMP echo request/reply to test connectivity.
IGMP (Internet Group Management Protocol) (informational)
-
Enables one host to send a data stream to many hosts simultaneously (multicast).
Internet Control Message Protocol (ICMP)
• Protocol used for sending error message, performing diagnostics, control the flow of
data
• ICMP source-quench packet sent by router to a source host to tell the
host to slow down because the router is overloaded.
• PING sent 4 ICMP echo request packets to test for connectivity
• Internet Group Message Protocol (IGMP)
• Protocol that enables one host to send one stream of data to many hosts at the
same time.
• Multicast – move streams of data to hosts concurrently
IP Addresses
IPv4 (Logical Address)
- 32-bit software-assigned address.
- Prefix of
nbits defines the network. - Suffix of
32-nbits defines the host.

IPv6
- 128-bit address with 2^128 possibilities.
- Written in hexadecimal (32 hex digits).
- Example:
EFDC:BA62:7654:3312:EFDC:BA72:7653:3210.
IPv4 can be embedded in IPv6
- IPv4 address
192.168.2.100→::C0A8:0264.
Zero Compression
-
Leading zeros can be dropped.
-
Consecutive zeros can be replaced with
::(once per address). -
Example:
1080:0000:0000:0000:0008:0800:200C:417A- →
1080:0:0:0:8:800:200C:417A - →
1080::8:800:200C:417A.


IPv4 Classes
characteristics:
fixed length prefix - represents unique network addresses
different types of fixed lengths(classes) to accommodate for different sizes of networks

Class A
8 bit network portion
first bit is always 0 (in binary)
- 2^7 possible combinations
- 0.0.0.0 is used for special / default routing
- 127.0.0.0 is used for loop-back
- usable addresses are hence 2^7 - 2
Host(24 bits)
- 2^24 combinations
- all host bits 0: eg: 10.0.0.0
- this is network address
- all host bits are 1: eg. 10.255.255.255
- broadcast address
- hence usable class a is 2^24 -2
this applies to the rest of the classes, but with varying n, adjust accordingly
also the other classes, or at least ABC do not have any special network portion
| Class | Network Portion | Host Portion | Range | Usage |
|---|---|---|---|---|
| A | 8 bits (first bit = 0) → 2^7 networks | 24 bits → 2^24 hosts | 0.0.0.0 – 127.255.255.255 | Very large networks |
| B | 16 bits (first two bits = 10) → 2^14 networks | 16 bits → 2^16 hosts | 128.0.0.0 – 191.255.255.255 | Medium networks |
| C | 24 bits (first three bits = 110) → 2^21 networks | 8 bits → 2^8 hosts | 192.0.0.0 – 223.255.255.255 | Small networks |
| D | First four bits = 1110 | N/A | 224.0.0.0 – 239.255.255.255 | Multicasting |
| E | First four bits = 1111 | N/A | 240.0.0.0 – 255.255.255.255 | Experimental/future use |
Network Address: identifies a network segment and not specific to a device
- used to route packets
Broadcast Address: used to send a message to all hosts on the network at once
last address
Multicast: sends to a selected group of devices.
network masking;
n leftmost bits set to 1s corresponding to class of IP

extract network address from IP by performing AND operation on the IP using the mask(convert to binary first)
IPv4 Limitations
- Inflexible and cannot adapt to every network size.
- Address exhaustion (used too quickly).
- Inefficient routing tables (too large).
Solutions (Workarounds)
- Subnetting:
-
multiple physical networks share one single network prefix(basically a lot more address efficient)
-
Divides larger networks into smaller subnetworks.
-
Isolates certain network portions
-
Reduces broadcast traffic
-
Supports hierarchical routing.
- internet forwards packet to correct site using internet portion
- site’s routers use physical network to select correct physical network at site
- correct network’s router uses host to identify host

-
Types:
- Fixed-length subnetting: all subnets same size.
- Variable-length subnetting: subnets of different sizes.
-
Advantages: flexible, efficient address usage.
-
Disadvantages: harder to implement, addresses may be interpreted differently.
-
Subnet masking: 32-bit mask with 1s for network prefix, 0s for host.
-

-
NAT (Network Address Translation):
- Maps(translates) private local addresses to public ones and back.
- Allows multiple devices to share one public IP.

-
Private IP ranges:
- 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16…
-
CIDR (Classless Inter-Domain Routing):
- prevent Ip exhaustion
- More flexible than classful addressing.
- Uses
/nnotation to define prefix length.- first address rightmost(32-n) bits to 0s
- last address rightmost(32-n) bits to 1s
- Supports route aggregation.
- for information only- combines multiple specific IPS into a single route, basically something similar to subnetting
- Applies to both public and private networks.
- Packets containing private addresses are non-routable on the public Internet
- Private IP ranges (from RFC 1918) like
192.168.0.0/16,10.0.0.0/8, and172.16.0.0/12are not forwarded over the public Internet. - If a packet with a private source or destination IP accidentally reaches a public router, it will be dropped immediately, as public networks do not route private IPs.
- Private IP ranges (from RFC 1918) like
- NAT is used to translate private IPs into public IPS to access the Internet
- basically to derive the network and broadcast:
- network:
- do a logical and with a mask with leftmost /n number of bits set to one
- broadcast:
- last 32-n number of bits set to 1s, and convert back to decimal.
- network:
-
IPv6 adoption: this is probably just the better solution, sometimes band aids only complicate things
Network Devices
Hub
- Operates at physical layer
- Broadcasts data to all ports when recieving on one port.
- No filtering, shared bandwidth → collisions.
Switch
- Operates at data link layer.
- Uses MAC addresses to forward data only to intended host.
- reduces unnecessary traffic (because you aren’t broadcasting to everyone)
- Reduces traffic, supports full duplex, separate collision domains.
- connections have dedicated collision domains
Router
- Operates at network layer.
- Forwards data packets between networks using IP.
- determines optimal path for data transmission
- Supports NAT, DHCP, firewall functions.
