Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Notes  >  Computer Networks  >  Network Layer - Computer Networks - Computer Science Engineering (CSE)

Network Layer - Computer Networks - Computer Science Engineering (CSE)

1. Transport Layer

The transport layer provides logical communication between application processes running on different end systems. Transport protocols run in end systems and present services to applications; they rely on and enhance the services provided by the network layer.

  • Primary responsibilities: process-to-process communication, segmentation and reassembly, multiplexing and demultiplexing, connection management, flow control, error detection and (optionally) error recovery.
  • Placement: transport protocols are implemented in end systems only; they take application messages, break them into segments, and pass those segments to the network layer on the sender side, and reassemble received segments into application messages on the receiver side.
  • Multiple transport protocols: applications may choose different transport protocols depending on needs; the Internet commonly provides TCP and UDP.
  • Interaction with network layer: the network layer provides logical host-to-host delivery; the transport layer provides logical process-to-process delivery by using the network layer to move segments between hosts.
  • Typical transport services: reliable, in-order delivery and congestion control (as in TCP); lightweight, connectionless delivery without reliability or congestion control (as in UDP).

2. User Datagram Protocol (Udp)

UDP is a "no-frills" or "bare bones" transport protocol that offers a minimal, connectionless service on top of the Internet Protocol (IP).

  • Service model: connectionless; no handshake, each UDP datagram (segment) is independent of others.
  • Reliability: best-effort delivery - UDP datagrams may be lost, duplicated, or delivered out of order to the application.
  • Simplicity: small header, no connection state at sender or receiver, no retransmission or congestion-control mechanisms in UDP itself.
  • When UDP is used: applications that are loss-tolerant and rate-sensitive such as real-time audio/video streaming; also used for simple request-response protocols like DNS and management protocols such as SNMP.
  • Adding reliability: applications that use UDP may implement application-layer reliability and error recovery tailored to their needs (for example, selective retransmission, forward error correction).
2. User Datagram Protocol (Udp)

3. Transmission Control Protocol (Tcp)

TCP is a connection-oriented, reliable transport protocol that provides a byte-stream abstraction between two end hosts.

  • Point-to-point: each TCP connection is between exactly two end points (one sender, one receiver).
  • Reliable, in-order byte stream: TCP delivers bytes in order without message boundaries; the application writes and reads a stream of bytes.
  • Pipelining: TCP uses pipelining by keeping multiple bytes (segments) unacknowledged in flight; flow control and congestion control determine the window of bytes that may be outstanding.
3. Transmission Control Protocol (Tcp)
  • Full duplex: TCP connections carry data in both directions simultaneously on the same connection.
  • MSS: maximum segment size - the largest amount of data TCP will place in a single segment.
  • Connection-oriented: TCP performs a handshake (exchange of control messages) to initialise state at sender and receiver before data transfer begins.
  • Flow controlled: the sender is prevented from overwhelming the receiver by means of the receiver's advertised window.

3.1 TCP segment structure

The TCP segment header contains fields used for reliable transfer and connection control:

  • Source port and destination port (identify application processes).
  • Sequence number (seq #) - byte-stream number of the first data byte in the segment.
  • Acknowledgment number (ACK) - next sequence number the sender of the ACK expects to receive (cumulative ACK).
  • Header length, flags (SYN, ACK, FIN, RST, PSH, URG), window size, checksum, urgent pointer, and optional fields.
3.1 TCP segment structure

3.2 TCP sequence numbers, ACKs and RTT estimation

  • Sequence numbers: identify bytes in the TCP byte stream and allow receivers to reorder and detect missing data.
  • ACKs: cumulative acknowledgements indicate the sequence number of the next expected byte. TCP typically acknowledges bytes cumulatively.
  • Handling out-of-order segments: the TCP specification leaves certain implementation choices open; receivers commonly buffer out-of-order segments until missing bytes are received or until upper-layer timeouts occur.
  • Round-Trip Time (RTT) and retransmission timeout: accurate RTT estimation is critical for setting the retransmission timeout (RTO). If the timeout is too short, unnecessary retransmissions occur; if too long, recovery from loss is slow.
  • SampleRTT: measured time between sending a segment and receiving its ACK (ignoring retransmitted segments).
  • Estimated RTT: to smooth variation, TCP uses an exponential weighted moving average:
    EstimatedRTT = (1 - α) × EstimatedRTT + α × SampleRTT
    Typical value: α = 0.125.

4. Congestion Control

Congestion occurs when the aggregate offered load to the network exceeds its capacity to carry that load, resulting in queueing and packet loss. Congestion is distinct from flow control (which prevents a fast sender from overwhelming a slow receiver).

  • Manifestations of congestion: packet loss due to router buffer overflow, long queueing delays in routers, and reduced effective throughput (goodput).
  • Why it matters: congestion increases end-to-end delays, causes retransmissions that waste link capacity, and can drastically reduce overall network performance; it is among the top problems network designers address.

Causes and costs - illustrative scenarios

  • Scenario 1 (simple overload): multiple senders transmit through a single router; with unlimited buffers but no retransmission, packets may still be delayed; when buffers are finite, overflow and packet drops occur.
  • Scenario 2 (finite buffers & retransmission): when dropped packets trigger retransmission, the network can carry multiple copies of the same packet, wasting capacity and potentially worsening congestion; this reduces goodput for a given offered load.
  • Scenario 3 (multihop and timeouts): when multiple senders on multihop paths time out and retransmit, upstream capacity used for packets that are ultimately dropped is wasted; such interaction across flows can cause global performance degradation.

Approaches to congestion control

  • End-to-end congestion control: receivers and senders infer congestion from end-system observations such as packet loss and delay; TCP's congestion control algorithms (slow start, congestion avoidance, fast retransmit, fast recovery) operate without explicit network feedback.
  • Network-assisted congestion control: the network (routers or switches) provides explicit feedback to end systems. Examples include single-bit congestion indicators (DECbit), ECN (Explicit Congestion Notification) in IP/TCP, or explicit rate settings where routers specify allowed send rates.

Network-layer mechanisms related to congestion

  • Queue management: drop-tail (simple tail drop) and active queue management (e.g., RED - Random Early Detection) aim to control buffer occupancy and signal congestion before buffers overflow.
  • Scheduling and queueing disciplines: FIFO, priority queuing, fair queuing and variants are used to allocate link capacity among flows and provide differentiated service.
  • Quality of Service (QoS) approaches: IntServ (per-flow resource reservation) and DiffServ (class-based marking and forwarding) are network-layer and layer-2/3 techniques to provide differentiated treatment of traffic under congestion.

5. Network Layer - Core Concepts And Functions

The network layer (also called the routing and forwarding layer) is responsible for host-to-host packet delivery across one or more networks. It performs forwarding of packets from input interfaces to appropriate output interfaces and routing to determine the end-to-end path.

Forwarding versus routing

  • Forwarding: the action taken by a router to move an incoming packet to an outgoing interface based on the routing table (fast, per-packet operation).
  • Routing: the control-plane function that computes paths and builds the routing table; routing algorithms run in routers and exchange information to establish consistent forwarding state.

Addressing and naming

  • IP addressing: logical addressing that identifies hosts (IPv4: 32-bit addresses; IPv6: 128-bit addresses).
  • Subnetting and CIDR: dividing the address space into subnets and using Classless Inter-Domain Routing for route aggregation and efficient address allocation.
  • ARP: Address Resolution Protocol maps IP addresses to link-layer (MAC) addresses on the same LAN.
  • NAT: Network Address Translation allows private address spaces to be mapped to public addresses for Internet access, with implications for end-to-end connectivity.

IPv4 header and fragmentation

  • IPv4 header: contains source and destination addresses, TTL, protocol field, header checksum, fragmentation fields (Identification, Flags, Fragment Offset).
  • Fragmentation: when a packet is too large for a link MTU, routers or the sending host may fragment it into smaller pieces which are reassembled at the destination; fragmentation affects performance and reliability.

Routing algorithms and protocols

  • Distance-vector routing: routers exchange reachability information with neighbours (example protocol: RIP); convergence can suffer from count-to-infinity problems mitigated by techniques such as split horizon and poison reverse.
  • Link-state routing: each router builds a complete map of network topology using link-state advertisements and computes shortest paths (example protocol: OSPF using Dijkstra's algorithm).
  • Path-vector routing: used in inter-domain routing (example protocol: BGP) where path attributes and policies determine route selection.
  • Routing metrics and policy: metrics such as hop count, delay, bandwidth, and administrative policies are used by routing protocols to choose best paths.
  • Hierarchical routing: used to scale large networks by aggregating routes and reducing routing-table size and update traffic.

Forwarding table and longest-prefix match

  • Routing/forwarding table: contains entries mapping destination prefixes to next hops and output interfaces.
  • Longest-prefix match: when multiple entries match a destination IP, the entry with the most specific (longest) prefix is chosen for forwarding.

Control messages and diagnostics

  • ICMP: Internet Control Message Protocol is used by IP for error reporting and diagnostics (e.g., destination unreachable, time exceeded, echo request/reply for ping).
  • Traceroute: uses ICMP or UDP with varying TTLs to discover the sequence of routers along a path and measure per-hop delays.

Additional network-layer technologies

  • MPLS: Multiprotocol Label Switching forwards packets based on short, fixed-length labels to enable traffic engineering and faster forwarding.
  • Traffic engineering: techniques to route traffic to meet performance objectives (minimise delay, balance load across links).
  • Security considerations: IPsec provides network-layer confidentiality, integrity and authentication for IP packets; network-layer security interacts with addressing and routing design.

6. Summary

The transport and network layers together enable end-to-end communication across the Internet. The transport layer (TCP, UDP) provides process-to-process services and implements reliability, flow control and congestion control as required by applications. The network layer provides host-to-host packet delivery, addressing, routing and forwarding across heterogeneous networks, and contains mechanisms for congestion signalling, diagnostics and quality-of-service. Understanding how these layers interact is essential for designing and troubleshooting networked systems.

The document Network Layer - Computer Networks - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Computer Networks.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
21 videos|147 docs|66 tests

FAQs on Network Layer - Computer Networks - Computer Science Engineering (CSE)

1. What is the purpose of the network layer in computer science engineering?
Ans. The network layer is responsible for routing and forwarding data packets across different networks. It ensures that data is correctly delivered from the source to the destination by establishing logical paths, choosing the best route, and controlling congestion.
2. How does the network layer handle addressing in computer science engineering?
Ans. The network layer uses IP (Internet Protocol) addressing to assign unique addresses to devices connected to a network. These addresses are used to identify the source and destination of data packets, allowing routers to correctly forward them to the intended recipient.
3. What are the key protocols used in the network layer of computer science engineering?
Ans. Some of the key protocols used in the network layer include IP (Internet Protocol), ICMP (Internet Control Message Protocol), ARP (Address Resolution Protocol), and OSPF (Open Shortest Path First). These protocols play crucial roles in addressing, routing, error reporting, and network discovery.
4. How does the network layer handle congestion control in computer science engineering?
Ans. The network layer implements various congestion control mechanisms to manage network congestion and prevent packet loss. These mechanisms include traffic shaping, traffic policing, and queuing algorithms such as Random Early Detection (RED) and Weighted Fair Queuing (WFQ).
5. What are the challenges faced by the network layer in computer science engineering?
Ans. The network layer faces challenges such as scalability, security, and quality of service (QoS) management. As networks grow larger and more complex, ensuring efficient routing, protecting against threats, and maintaining desired service levels become increasingly difficult tasks for the network layer.
Related Searches
shortcuts and tricks, video lectures, Network Layer - Computer Networks - Computer Science Engineering (CSE), Objective type Questions, Summary, practice quizzes, Network Layer - Computer Networks - Computer Science Engineering (CSE), study material, Semester Notes, Viva Questions, MCQs, Sample Paper, Exam, past year papers, Important questions, mock tests for examination, pdf , Extra Questions, ppt, Previous Year Questions with Solutions, Network Layer - Computer Networks - Computer Science Engineering (CSE), Free;