Computer Networks
OSI vs TCP/IP, Transport Protocols, Subnetting/CIDR & Routing Protocols
1. Introduction to Computer Networks
• A computer network connects devices to exchange data and share resources.
• Networking uses protocols, addressing, routing and layered architectures.
• The Internet is a large interconnected collection of networks.
2. Network Layering
• Layering divides networking tasks into manageable functions.
• Each layer provides services to the layer above and uses services below.
• Layering improves interoperability, modularity and troubleshooting.
3. OSI Model
• OSI has seven layers: Physical, Data Link, Network, Transport, Session, Presentation and Application.
• Each layer has defined responsibilities.
• It is mainly a reference model for understanding network communication.
4. OSI Layer Functions
• Physical: bits and signaling.
• Data Link: frames, MAC addressing and local delivery.
• Network: logical addressing and routing.
• Transport: end-to-end delivery and reliability.
• Session/Presentation: session management, representation and translation.
• Application: services used by applications.
5. TCP/IP Model
• The TCP/IP architecture commonly uses four layers: Link, Internet, Transport and Application.
• Some descriptions use five layers by separating the Physical layer from the Link layer.
• TCP/IP reflects the protocol suite used by the Internet.
6. OSI vs TCP/IP
• OSI has seven conceptual layers; TCP/IP is organized around fewer practical protocol layers.
• OSI is primarily a reference model; TCP/IP combines architecture with widely deployed protocols.
• Both use layering and include transport and network/internet functions.
• The mapping between the two is not perfectly one-to-one.
7. Encapsulation & Decapsulation
• Application data is passed down the stack and encapsulated with headers.
• Transport layer creates segments/datagrams; network layer creates packets; link layer creates frames.
• At the receiver, headers are processed and removed as data moves upward.
• This enables each layer to perform its specific task.
8. Transport Layer
• Provides end-to-end communication between applications.
• Important functions include multiplexing, segmentation, flow control, reliability and congestion handling.
• The main Internet transport protocols are TCP and UDP.
9. TCP Overview
• TCP is connection-oriented and provides a reliable, ordered byte stream.
• It uses sequence numbers, acknowledgments and retransmissions.
• TCP also provides flow control and congestion control.
• Applications such as web traffic, file transfer and email commonly use TCP-based transports.
10. TCP Three-Way Handshake
• Step 1: Client sends SYN with an initial sequence number.
• Step 2: Server replies with SYN-ACK.
• Step 3: Client sends ACK.
• After the handshake, both sides can exchange application data.
• The handshake establishes connection state and initial sequence-number information.
11. TCP Reliability
• Sequence numbers identify byte positions.
• ACKs indicate successfully received data.
• Lost data can be retransmitted.
• Checksums help detect corruption.
• These mechanisms provide reliable, ordered delivery to the application.
12. TCP Flow Control
• Flow control protects the receiver from being overwhelmed.
• TCP uses a receive window to advertise how much additional data the receiver can accept.
• The sender adjusts its sending behavior according to the advertised window.
• Flow control is about receiver capacity, not network congestion.
13. TCP Congestion Control
• Congestion control protects the network from excessive traffic.
• TCP uses mechanisms such as congestion window, slow start and congestion avoidance.
• When congestion is inferred, the sender reduces its sending rate.
• Congestion control is different from receiver-side flow control.
14. UDP
• UDP is connectionless and provides an unreliable datagram service.
• It does not guarantee delivery, ordering or retransmission.
• UDP has low protocol overhead and supports applications that can tolerate loss or implement their own
recovery.
• Common uses include DNS, streaming, real-time applications and some modern Internet protocols.
15. TCP vs UDP
• TCP: connection-oriented, reliable, ordered byte stream, flow and congestion control.
• UDP: connectionless datagrams, no built-in delivery/order guarantee, low overhead.
• Choice depends on application requirements rather than simply speed.
16. IP Addressing
• An IP address identifies an interface within an IP network.
• IPv4 uses 32-bit addresses; IPv6 uses 128-bit addresses.
• Subnetting divides an address space into smaller network prefixes.
• Routers use destination prefixes to forward packets.
17. Subnetting Basics
• A subnet mask/prefix length separates network bits from host bits.
• IPv4 prefix notation uses CIDR, such as /24.
• For a traditional IPv4 subnet, host capacity depends on the number of host bits and reserved addresses.
• Subnetting improves address organization and routing efficiency.
18. CIDR
• CIDR = Classless Inter-Domain Routing.
• CIDR represents networks as address/prefix-length pairs, such as [Link]/24.
• It supports flexible allocation instead of fixed address classes.
• Route aggregation can combine multiple contiguous prefixes into a larger summarized route.
19. Subnetting Example
• Example: [Link]/24 has 256 total IPv4 addresses.
• Splitting it into /26 creates four equal-size subnets.
• Each /26 contains 64 addresses; traditional usable host count is 62 per subnet.
• The four network blocks begin at .0, .64, .128 and .192.
20. Routing
• Routing determines how packets travel between different IP networks.
• A router consults its routing table and selects an appropriate next hop.
• Routes may be learned directly, statically configured or dynamically exchanged by routing protocols.
• The best route is selected using protocol-specific rules and metrics.
21. RIP
• RIP is a distance-vector interior gateway protocol.
• It uses hop count as its routing metric.
• Its maximum usable hop count is 15; 16 represents unreachable.
• RIP is simple but has limited scalability compared with modern alternatives.
22. OSPF
• OSPF is a link-state interior gateway protocol.
• Routers exchange link-state information and build a topology database.
• Shortest Path First calculations are used to determine routes.
• OSPF supports hierarchical areas; Area 0 is the backbone area.
• It generally converges faster and scales better than RIP in larger networks.
23. BGP
• BGP is the principal inter-domain routing protocol used between autonomous systems.
• It is a path-vector protocol and makes routing decisions using policy and path attributes.
• BGP is fundamental to Internet-scale routing.
• Unlike RIP and OSPF, BGP is designed for inter-domain routing and policy control.
24. Routing Protocol Comparison
• RIP: distance vector, hop-count metric, simple and limited scalability.
• OSPF: link state, cost-based SPF, designed for scalable internal routing.
• BGP: path vector, policy-driven, used between autonomous systems.
• The appropriate protocol depends on network scope, policy and operational requirements.
25. Summary
• OSI and TCP/IP use layered networking architectures.
• TCP provides reliable transport with handshake, flow control and congestion control; UDP provides
lightweight datagrams.
• Subnetting and CIDR organize IP address space and support route aggregation.
• RIP, OSPF and BGP serve different routing roles and scales.
• Together, these concepts form core computer-networking knowledge.