Computer Network Layers, functions, and protocols

Computer Networks · Competitive Exam Guide

Network Layers,
Functions & Protocols

The OSI & TCP/IP models, every layer’s job, key protocols, ports and devices — explained simply and built for quick revision.

SSCBanking · IBPS/SBI/RBIUPSCRailway · RRBState PSCDefence
Updated: May 2026 · 30 MCQs with explanations · Quick-revision sheet included
How to use this guide. Read top-to-bottom to learn (basic → advanced), or jump straight to the MCQ bank and the dark Quick Revision Sheet at the end for last-minute prep. The layer-function table and the port-number list are the two most-tested areas — memorize those first.
1

Start HereThe Two Network Models

Data travels across a network through a stack of layers. Two models describe this: the 7-layer OSI model (theoretical reference) and the 4-layer TCP/IP model (used on the real Internet).

OSI vs TCP/IP
FeatureOSI ModelTCP/IP Model
Number of layers74 (sometimes shown as 5)
Developed byISO (Intl. Org. for Standardization)DARPA / US DoD
NatureTheoretical / reference modelPractical model (runs the Internet)
Layers (top → down)Application, Presentation, Session, Transport, Network, Data Link, PhysicalApplication, Transport, Internet, Network Access
🧠
Memory trick (top → bottom): “All People Seem To Need Data Processing.”
Bottom → top: “Please Do Not Throw Sausage Pizza Away.”
2

The Core TableOSI Layers — Function, Protocols & Devices

This single table answers the majority of OSI questions. Learn each layer’s one main job, its key protocols, and the device that works there.

Most-Asked Layer Table
#LayerMain JobKey ProtocolsDevices
7ApplicationUser services — web, email, file transferHTTP/HTTPS, FTP, SMTP, DNS, SNMP, TelnetGateway, Proxy
6PresentationTranslation, encryption, compressionSSL/TLS, JPEG, MPEG, ASCIISoftware only
5SessionStart, manage & end sessions; syncNetBIOS, RPC, PPTPSoftware only
4TransportEnd-to-end delivery, segmentation, flow controlTCP, UDPFirewall, Load Balancer
3NetworkLogical (IP) addressing & routingIP, ICMP, ARP, IGMP, OSPFRouter, Layer-3 Switch
2Data LinkPhysical (MAC) addressing, framing, error detectionEthernet, PPP, HDLC, Frame RelaySwitch, Bridge, NIC, Wi-Fi AP
1PhysicalRaw bits, cables, electrical signalsStandards (RS-232, etc.)Hub, Repeater, Cable, Modem
One-liners examiners love Encryption → Layer 6 (Presentation) · Routing & IP addressing → Layer 3 (Network) · MAC addressing & framing → Layer 2 (Data Link) · End-to-end delivery → Layer 4 (Transport) · Dialog/sessions → Layer 5 (Session).
🔌
Device-to-layer memory: L1 Hub → L2 Switch → L3 Router → L4 Firewall → L7 Gateway.
3

Transport LayerTCP vs UDP

The Transport layer’s two protocols are a guaranteed exam question. TCP is reliable but slower; UDP is fast but offers no guarantee.

PointTCPUDP
ConnectionConnection-orientedConnection-less
ReliabilityReliable (acknowledgements)Unreliable (no ACK)
SpeedSlowerFaster
Handshake3-way (SYN, SYN-ACK, ACK)None
Flow controlYes (sliding window)No
Used forWeb, email, file transferVideo/voice streaming, DNS, online games
4

Memorize ThisCommon Protocols & Port Numbers

Port numbers are frequently asked one-mark questions. A port number is 16 bits (range 0–65535).

Important Ports
ProtocolPortUse
FTP20, 21File transfer
SSH22Secure remote login
Telnet23Remote login (insecure)
SMTP25Sending email
DNS53Domain name → IP
DHCP67, 68Auto-assign IP address
HTTP80Web (insecure)
POP3110Receiving email
IMAP143Receiving email (sync)
SNMP161Monitor network devices
HTTPS443Secure web (uses SSL/TLS)
✉️
SMTP Sends · POP3/IMAP Pull (receive) · HTTPS = HTTP + Secure (port 443).
5

Layer 3IP Addressing & Key Protocols

The Network layer adds logical addresses (IP) and decides the route packets take across networks.

  • IP Address: Logical address of a device. IPv4 = 32 bits (e.g., 192.168.1.1), IPv6 = 128 bits.
  • MAC Address: Physical 48-bit address burned into the NIC (used for local delivery).
  • ARP resolves IP → MAC · RARP resolves MAC → IP.
  • DNS resolves a domain name → IP address.
  • DHCP automatically assigns IP addresses to devices.
  • ICMP reports errors & tests connectivity — used by the ping command.
  • IP is connection-less and performs packet fragmentation.
  • RIP & OSPF are routing protocols (RIP uses hop count; OSPF uses link state).
Quick contrast Logical addressing (IP) = Network Layer (L3). Physical addressing (MAC) = Data Link Layer (L2). IPv4 = 32-bit · IPv6 = 128-bit · MAC = 48-bit · Port = 16-bit.
6

HardwareNetworking Devices by Layer

Knowing which device works at which layer is a repeated favourite. Remember: the higher the device works, the “smarter” it is.

Devices & Their Layers
DeviceLayerWhat It Does
HubLayer 1 (Physical)Broadcasts data to all ports (no intelligence).
RepeaterLayer 1 (Physical)Regenerates/boosts a weak signal.
SwitchLayer 2 (Data Link)Forwards frames using MAC addresses (intelligent).
Bridge / NICLayer 2 (Data Link)Connects/segments networks; NIC gives a device its MAC.
RouterLayer 3 (Network)Connects different networks; routes packets by IP.
GatewayLayer 7 (Application)Connects two different network architectures/protocols.
Quick memory Hub = dumb broadcaster (L1) · Switch = smart, uses MAC (L2) · Router = connects networks, uses IP (L3) · Gateway = protocol translator (L7).
7

Practice Bank30 MCQs with Explanations

Cover the answer and test yourself first. Questions follow recent exam trends.

Section 1 · OSI & TCP/IP Models
Q1The OSI model has how many layers?
  • A. 5
  • B. 6
  • C. 7
  • D. 8
Ans CSeven layers, from Physical to Application.
Q2The topmost layer of the OSI model is:
  • A. Transport
  • B. Presentation
  • C. Application
  • D. Network
Ans CApplication (Layer 7) is closest to the user.
Q3The TCP/IP model has how many layers?
  • A. 5
  • B. 4
  • C. 6
  • D. 7
Ans BApplication, Transport, Internet, Network Access.
Q4The Internet layer of TCP/IP corresponds to which OSI layer?
  • A. Data Link
  • B. Network
  • C. Transport
  • D. Session
Ans BIt maps to the OSI Network layer.
Q5Which TCP/IP layer handles framing & physical addressing?
  • A. Internet
  • B. Transport
  • C. Application
  • D. Network Access
Ans DThe Network Access layer = OSI Data Link + Physical.
Section 2 · Layer Functions
Q6Which OSI layer provides end-to-end communication?
  • A. Network
  • B. Transport
  • C. Data Link
  • D. Session
Ans BThe Transport layer ensures complete end-to-end transfer.
Q7Routing of packets between networks happens at which layer?
  • A. Data Link
  • B. Network
  • C. Physical
  • D. Transport
Ans BLayer 3 handles logical addressing & routing.
Q8Error detection & MAC addressing are functions of which layer?
  • A. Data Link
  • B. Network
  • C. Session
  • D. Application
Ans ALayer 2 does framing, MAC addressing & error detection.
Q9Encryption & compression are primarily handled at which layer?
  • A. Session
  • B. Transport
  • C. Presentation
  • D. Application
Ans CThe Presentation layer handles translation, encryption & compression.
Q10Dialog control & session management are done by:
  • A. Presentation
  • B. Session
  • C. Data Link
  • D. Transport
Ans BThe Session layer starts, manages & ends sessions.
Q11Which layer converts data into electrical signals (raw bits)?
  • A. Transport
  • B. Presentation
  • C. Network
  • D. Physical
Ans DThe Physical layer transmits raw 0s and 1s.
Q12Segmentation of data occurs at which layer?
  • A. Network
  • B. Transport
  • C. Data Link
  • D. Physical
Ans BThe Transport layer breaks data into segments.
Section 3 · Protocols
Q13Which protocol is connection-oriented and reliable?
  • A. UDP
  • B. TCP
  • C. IP
  • D. ARP
Ans BTCP uses acknowledgements & a 3-way handshake.
Q14The 3-way handshake (SYN, SYN-ACK, ACK) is used by:
  • A. UDP
  • B. TCP
  • C. ICMP
  • D. DHCP
Ans BIt establishes a reliable TCP connection.
Q15Which protocol resolves an IP address to a MAC address?
  • A. DNS
  • B. DHCP
  • C. ARP
  • D. ICMP
Ans CARP finds the MAC for a known IP.
Q16The “ping” command uses which protocol?
  • A. HTTP
  • B. UDP
  • C. ICMP
  • D. RARP
Ans CICMP is used for error reporting & connectivity tests.
Q17Which protocol assigns IP addresses dynamically?
  • A. DNS
  • B. DHCP
  • C. FTP
  • D. ICMP
Ans BDHCP auto-assigns IPs (uses UDP, ports 67/68).
Q18SMTP is used for:
  • A. Receiving email
  • B. Sending email
  • C. File transfer
  • D. Remote login
Ans BSMTP sends; POP3/IMAP receive.
Q19Which protocol resolves domain names to IP addresses?
  • A. FTP
  • B. DNS
  • C. DHCP
  • D. SNMP
Ans BDNS = the Internet’s “phonebook” (port 53).
Q20Which is NOT an Application-layer protocol?
  • A. HTTP
  • B. FTP
  • C. SMTP
  • D. ARP
Ans DARP works at the Network/Data Link layer.
Q21Which of the following is a routing protocol?
  • A. RIP
  • B. SMTP
  • C. FTP
  • D. DHCP
Ans ARIP (Routing Information Protocol) chooses paths by hop count.
Section 4 · Ports & Addressing
Q22HTTPS uses which port?
  • A. 80
  • B. 443
  • C. 21
  • D. 110
Ans BPort 443; secures HTTP using SSL/TLS.
Q23DNS uses which port?
  • A. 20
  • B. 23
  • C. 53
  • D. 110
Ans CPort 53 for domain name resolution.
Q24FTP uses which ports?
  • A. 20 & 21
  • B. 23
  • C. 53
  • D. 80
Ans APort 20 (data) and 21 (control).
Q25IPv6 address size is:
  • A. 32 bits
  • B. 64 bits
  • C. 128 bits
  • D. 256 bits
Ans CIPv6 = 128-bit; IPv4 = 32-bit.
Q26A port number is how many bits?
  • A. 8 bits
  • B. 16 bits
  • C. 32 bits
  • D. 64 bits
Ans B16 bits → range 0 to 65535.
Section 5 · Devices
Q27A switch operates at which layer?
  • A. Layer 1
  • B. Layer 2
  • C. Layer 3
  • D. Layer 7
Ans BSwitches forward frames using MAC addresses (Data Link).
Q28A router operates at which layer?
  • A. Layer 2
  • B. Layer 3
  • C. Layer 4
  • D. Layer 7
Ans BRouters route packets using IP addresses (Network).
Q29A hub operates at which layer?
  • A. Layer 1
  • B. Layer 2
  • C. Layer 3
  • D. Layer 7
Ans AHubs are Physical-layer devices that broadcast to all ports.
Q30Which device connects two networks using different protocols/architectures?
  • A. Hub
  • B. Switch
  • C. Repeater
  • D. Gateway
Ans DA Gateway translates between different network types (L7).
8

Print & MemorizeQuick Revision Sheet

Models

  • OSI = 7 layers (ISO) · TCP/IP = 4 layers (DARPA).
  • OSI order (top→down): Application, Presentation, Session, Transport, Network, Data Link, Physical.
  • Mnemonic: “All People Seem To Need Data Processing.”

Layer → Function

  • Encryption → L6 · Sessions → L5 · Segmentation/end-to-end → L4.
  • Routing & IP addressing → L3 · MAC & framing → L2 · Raw bits → L1.

Protocols & Addressing

  • TCP = reliable, 3-way handshake · UDP = fast, no guarantee.
  • ARP: IP→MAC · DNS: name→IP · DHCP: auto-IP · ICMP: ping/errors.
  • IPv4 = 32-bit · IPv6 = 128-bit · MAC = 48-bit · Port = 16-bit.

Ports

  • FTP 20/21 · SSH 22 · Telnet 23 · SMTP 25 · DNS 53 · DHCP 67/68.
  • HTTP 80 · POP3 110 · IMAP 143 · SNMP 161 · HTTPS 443.

Devices

  • Hub → L1 · Switch → L2 · Router → L3 · Gateway → L7.
Tip: The layer-function table (Part 2) and the port list (Part 4) together cover most one-mark questions from this topic — revise them last before any exam.