Networking Fundamentals

๐Ÿ“ Concept Note โ€” CSF & NS Unit II | Foundation for all network security topics


1. Networking Devices

Router

  • Operates at Layer 3 (Network) of OSI model
  • Connects different networks together (e.g., your home LAN โ†’ the Internet)
  • Uses IP addresses to forward packets between networks
  • Makes routing decisions based on a routing table
  • Each interface has its own IP address
  • Performs NAT (Network Address Translation) in home/office setups
Home LAN (192.168.1.x)  โ†โ†’  Router  โ†โ†’  ISP / Internet

Security relevance: Routers are the first line of defence โ€” misconfigured routers expose entire networks. Attackers target default credentials and firmware vulnerabilities.


Switch

  • Operates at Layer 2 (Data Link) of OSI model
  • Connects devices within the same network (LAN)
  • Uses MAC addresses to forward frames to the correct port
  • Maintains a MAC address table (CAM table) mapping MAC โ†’ port
  • Creates a dedicated collision domain per port (unlike Hub)
  • Layer 3 switches can also do routing
PC1 โ”€โ”
PC2 โ”€โ”คโ”€โ”€ Switch โ”€โ”€ Router โ”€โ”€ Internet
PC3 โ”€โ”˜
      All on same LAN (192.168.1.x)

Security relevance:

  • MAC flooding attack โ€” overflows CAM table โ†’ switch behaves like a hub โ†’ attacker sees all traffic
  • VLAN hopping โ€” attacker escapes their VLAN into another
  • ARP spoofing โ€” poisons ARP cache to redirect traffic through attacker

Hub

  • Operates at Layer 1 (Physical) of OSI model
  • The โ€œdumbโ€ ancestor of the switch
  • Receives a signal on one port โ†’ broadcasts it to ALL other ports
  • No intelligence โ€” does not look at MAC or IP addresses
  • All connected devices share one collision domain
  • Largely obsolete โ€” replaced by switches
PC1 sends frame โ†’ Hub โ†’ PC2, PC3, PC4 all receive it
                        โ†‘ Major security risk!

Security relevance: Any device on a hub-connected network can sniff all traffic with Wireshark โ€” no attack needed. This is why passive eavesdropping was trivial on old networks.

FeatureHubSwitch
Layer1 (Physical)2 (Data Link)
AddressingNoneMAC address
Sends frame toAll portsSpecific port
Collision domain1 shared1 per port
SecurityโŒ Very poorโœ… Better

Modem

  • Modulator / Demodulator
  • Converts digital signals โ†” analog signals for transmission over telephone lines, cable, or fiber
  • Sits at the boundary between your home network and the ISP
  • DSL modem, Cable modem, Fiber ONT are common types
  • Often combined with a router in home โ€œmodem-routerโ€ combo devices
Digital (PC) โ†’ Modem (modulates) โ†’ Analog (phone line) โ†’ ISP โ†’ Internet
Internet โ†’ ISP โ†’ Analog (phone line) โ†’ Modem (demodulates) โ†’ Digital (PC)

Bridge

  • Operates at Layer 2 (Data Link) of OSI model
  • Connects two network segments and filters traffic between them
  • Learns MAC addresses and decides whether to forward or block a frame
  • Reduces collision domains by dividing a large network into segments
  • A switch is essentially a multi-port bridge
Segment A โ”€โ”€โ”€โ”€ Bridge โ”€โ”€โ”€โ”€ Segment B
(PCs 1-5)  filter by MAC  (PCs 6-10)

Device Summary Table

DeviceOSI LayerAddresses UsedPrimary Function
HubLayer 1 โ€” PhysicalNoneBroadcast signal to all ports
BridgeLayer 2 โ€” Data LinkMAC addressConnect two LAN segments
SwitchLayer 2 โ€” Data LinkMAC addressForward frames to correct port
RouterLayer 3 โ€” NetworkIP addressConnect different networks
ModemLayer 1 โ€” PhysicalN/AConvert digital โ†” analog

2. Network Topologies

Network topology = the physical or logical arrangement of devices in a network.


Bus Topology

PC1 โ”€โ”€ PC2 โ”€โ”€ PC3 โ”€โ”€ PC4 โ”€โ”€ PC5
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
              Bus (Backbone cable)
  • All devices connected to a single central cable (the bus/backbone)
  • Data travels in both directions along the cable
  • Terminators at each end absorb signals to prevent reflection
  • If the backbone cable fails โ†’ entire network goes down
ProsCons
Simple and cheap to set upSingle point of failure (backbone)
Less cable neededPerformance degrades with more devices
Easy to extendDifficult to troubleshoot

Security: All traffic visible to all devices on the bus โ€” easy to sniff.


Star Topology

        PC1
         โ”‚
PC4 โ”€โ”€โ”€โ”€ Switch/Hub โ”€โ”€โ”€โ”€ PC2
         โ”‚
        PC3
  • All devices connect to a central hub or switch
  • Most common topology in modern LANs
  • If one device/cable fails โ†’ only that device is affected
  • If the central switch fails โ†’ entire network goes down
ProsCons
Easy to add/remove devicesCentral device = single point of failure
Easy to troubleshootMore cable needed than bus
Failure isolation (one device fails, rest work)Cost of central switch

Security: With a switch (not hub), traffic is isolated per port โ€” better than bus/hub topologies.


Ring Topology

    PC1
   /    \
PC4      PC2
   \    /
    PC3
  • Devices connected in a closed loop โ€” each device connects to exactly two neighbours
  • Data travels in one direction (unidirectional) or two directions (bidirectional/dual ring)
  • Uses token passing โ€” a device can only transmit when it holds the token
  • FDDI (Fiber Distributed Data Interface) used dual ring for fault tolerance
ProsCons
No collisions (token passing)One break in ring = network fails
Equal access for all devicesDifficult to add/remove devices
Predictable performanceSlower than star topology

Mesh Topology

PC1 โ”€โ”€โ”€ PC2
โ”‚ โ•ฒ   โ•ฑ โ”‚
โ”‚   โ•ณ   โ”‚
โ”‚ โ•ฑ   โ•ฒ โ”‚
PC3 โ”€โ”€โ”€ PC4
  • Every device connects to every other device
  • Full mesh: n(n-1)/2 connections for n devices
  • Partial mesh: only some devices have redundant connections
ProsCons
Highly redundant โ€” no single point of failureExtremely expensive (many cables)
Multiple paths for dataComplex configuration
Best fault toleranceDifficult to manage

Used in: The Internet itself is a form of partial mesh. Core network infrastructure.


Tree Topology (Hierarchical)

          Root Switch
         /            \
   Switch-A          Switch-B
   /     \           /     \
PC1     PC2       PC3     PC4
  • Hierarchical arrangement โ€” combination of star topologies
  • Root node at the top, branches below
  • Used in large enterprise networks โ€” campus networks, ISP backbones
ProsCons
Scalable and easy to expandRoot node failure = entire network down
Easy to manage hierarchicallyMore cabling than bus
Suitable for large networksHigher cost

Hybrid Topology

  • Combination of two or more topologies
  • Most real-world networks are hybrid
  • Example: A company might use star topology within each floor, connected via a ring backbone
Floor 1 (Star) โ”€โ”
Floor 2 (Star) โ”€โ”ผโ”€โ”€ Ring backbone โ”€โ”€ Internet (Router)
Floor 3 (Star) โ”€โ”˜

Topology Comparison

TopologyFault ToleranceCostScalabilityReal-world Use
BusโŒ Poorโœ… LowโŒ PoorOld coax networks, obsolete
Starโœ… GoodMediumโœ… GoodModern LAN (most common)
RingโŒ MediumMediumโŒ PoorSONET, FDDI, older networks
Meshโœ…โœ… BestโŒ HighโŒ ComplexInternet core, WAN
TreeMediumMediumโœ…โœ… BestEnterprise campus networks
HybridVariesVariesโœ…โœ… BestLarge enterprise networks

3. Communication Types

Simplex

Sender โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Receiver
       (one way only)
  • Communication flows in one direction only
  • Receiver cannot send back any data
  • Examples: Television broadcast, AM/FM radio, keyboard โ†’ CPU

Security relevance: Log forwarding from sensor โ†’ SIEM can be designed as simplex to prevent a compromised SIEM from sending commands back to sensors.


Half-Duplex

PC1 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ PC2   (PC1 sending)
PC1 โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ PC2   (PC2 sending โ€” but NOT simultaneously)
  • Communication in both directions, but not at the same time
  • One party must stop transmitting before the other can start
  • Examples: Walkie-talkie (โ€œoverโ€), older WiFi (802.11), CB radio

Network context: Early Ethernet with hubs was effectively half-duplex โ€” only one device could transmit at a time without collision.


Full-Duplex

PC1 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ PC2   (simultaneously)
PC1 โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ PC2   (simultaneously)
  • Communication in both directions simultaneously
  • Both parties can send and receive at the same time
  • Examples: Telephone call, modern Ethernet (switches), mobile phones

Network context: Modern switched Ethernet is full-duplex โ€” the switch gives each device a dedicated channel, eliminating collisions entirely. This doubles effective bandwidth.

FeatureSimplexHalf-DuplexFull-Duplex
DirectionOne-wayBoth, not simultaneousBoth, simultaneously
ExampleRadio broadcastWalkie-talkiePhone call
EfficiencyLowMediumHigh
Collision possible?N/AYesNo

4. Transmission Models

Analog Transmission

  • Data represented as a continuous waveform โ€” varies smoothly over time
  • Characterised by amplitude, frequency, and phase
  • Susceptible to noise and distortion over long distances โ€” signal degrades
  • Traditional telephone (PSTN), AM/FM radio, early modems
Analog signal (continuous wave):
     โ•ญโ”€โ•ฎ     โ•ญโ”€โ•ฎ     โ•ญโ”€โ•ฎ
โ”€โ”€โ”€โ”€โ•ฏ   โ•ฐโ”€โ”€โ”€โ•ฏ   โ•ฐโ”€โ”€โ”€โ•ฏ   โ•ฐโ”€โ”€โ”€โ”€

Signal degradation: As analog signal travels, noise adds on top of it โ€” you canโ€™t perfectly distinguish original signal from noise. Amplifiers boost the signal but also boost the noise.


Digital Transmission

  • Data represented as discrete binary values โ€” 0 (low voltage) or 1 (high voltage)
  • Signal is either ON or OFF โ€” no in-between states
  • Can be regenerated perfectly โ€” repeaters restore the original signal, not the noise
  • More resistant to noise, enables encryption, supports compression
  • Modern Ethernet, fiber optics, WiFi, USB, HDMI โ€” all digital
Digital signal (discrete):
     โ”Œโ”€โ”€โ”€โ”   โ”Œโ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”
โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”˜ โ””โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€
  0    1    0   1    1    0

Regeneration vs Amplification:

Analog: Signal + Noise โ†’ Amplifier โ†’ Louder Signal + Louder Noise โŒ
Digital: Signal + Noise โ†’ Repeater โ†’ Clean original signal restored โœ…
FeatureAnalogDigital
RepresentationContinuous waveDiscrete 0s and 1s
Noise immunityPoor โ€” noise accumulatesExcellent โ€” signal regenerated
Bandwidth efficiencyLowerHigher
Security (encryption)DifficultEasy โœ…
ExampleOld telephone, radioEthernet, WiFi, fiber

5. OSI Model (Open Systems Interconnection)

The OSI model is a conceptual framework that standardises how different network systems communicate. Developed by ISO in 1984.

Mnemonic (top to bottom): All People Seem To Need Data Processing Application โ†’ Presentation โ†’ Session โ†’ Transport โ†’ Network โ†’ Data Link โ†’ Physical

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  7. Application   โ”‚ HTTP, FTP, DNS, SMTP   โ”‚  โ† User/App interaction
โ”‚  6. Presentation  โ”‚ SSL/TLS, JPEG, ASCII   โ”‚  โ† Data format/encryption
โ”‚  5. Session       โ”‚ NetBIOS, RPC, SQL      โ”‚  โ† Session management
โ”‚  4. Transport     โ”‚ TCP, UDP               โ”‚  โ† End-to-end delivery
โ”‚  3. Network       โ”‚ IP, ICMP, ARP, OSPF    โ”‚  โ† Logical addressing/routing
โ”‚  2. Data Link     โ”‚ Ethernet, MAC, PPP     โ”‚  โ† Physical addressing/frames
โ”‚  1. Physical      โ”‚ Cables, Hubs, Bits     โ”‚  โ† Raw bit transmission
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Layer 1 โ€” Physical Layer

  • Transmits raw bits (0s and 1s) over a physical medium
  • Deals with: voltage levels, cable types, connectors, pin layouts, signal timing
  • Devices: Hub, repeater, cable, modem
  • Protocols/Standards: Ethernet physical (RJ-45), RS-232, USB, Bluetooth physical layer

Security: Physical layer attacks โ€” wiretapping, cable cutting, hardware keyloggers, rogue devices.


  • Provides node-to-node data transfer within the same network
  • Packages bits into frames, adds MAC addresses (source + destination)
  • Handles error detection (CRC checksum) and flow control
  • Divided into two sublayers:
    • MAC (Media Access Control) โ€” physical addressing, media access
    • LLC (Logical Link Control) โ€” flow control, error checking
  • Devices: Switch, bridge, NIC
  • Protocols: Ethernet, PPP, HDLC, ARP (partially)

Security: ARP poisoning, MAC spoofing, MAC flooding, VLAN hopping all target Layer 2.


Layer 3 โ€” Network Layer

  • Handles logical addressing (IP addresses) and routing between networks
  • Determines the best path for data to travel from source to destination
  • Breaks data into packets, adds IP header (source IP, destination IP, TTL)
  • Devices: Router, Layer 3 switch
  • Protocols: IPv4, IPv6, ICMP, OSPF, BGP, RIP

Security: IP spoofing, routing attacks, ICMP-based attacks (ping flood, smurf attack), route poisoning.


Layer 4 โ€” Transport Layer

  • Provides end-to-end communication between applications
  • Segmentation โ€” breaks large data into segments, reassembles at destination
  • Two main protocols with different characteristics:
FeatureTCPUDP
ConnectionConnection-oriented (3-way handshake)Connectionless
ReliabilityGuaranteed delivery (ACK)Best-effort
OrderIn-order deliveryNo ordering
SpeedSlower (overhead)Faster
Use caseHTTP, SSH, FTP, emailDNS, video streaming, VoIP, gaming
  • Port numbers identify specific applications (80=HTTP, 443=HTTPS, 22=SSH)

Security: SYN flood (TCP handshake exploit), port scanning (Nmap targets Layer 4), firewall rules operate at Layer 4.


Layer 5 โ€” Session Layer

  • Manages sessions (connections) between applications
  • Establishes, maintains, and terminates sessions
  • Handles session checkpointing โ€” ability to resume after a failure
  • Protocols: NetBIOS, RPC (Remote Procedure Call), PPTP, SQL sessions

Security: Session hijacking attacks target Layer 5 โ€” stealing a valid session token to impersonate an authenticated user.


Layer 6 โ€” Presentation Layer

  • Translates data between the application format and the network format
  • Handles: Encryption/decryption, data compression, character encoding (ASCII, Unicode)
  • Ensures data sent by one system can be read by another (format independence)
  • Protocols: SSL/TLS (encryption), JPEG/PNG (image format), MPEG, ASCII, UTF-8

Security: SSL/TLS stripping attacks, weak cipher negotiation attacks operate at Layer 6. This is where HTTPS encryption happens.


Layer 7 โ€” Application Layer

  • The layer closest to the end user
  • Provides network services directly to applications
  • Not the application itself โ€” but the protocols applications use
  • Protocols: HTTP/HTTPS, FTP, SFTP, DNS, SMTP, POP3, IMAP, SSH, Telnet, SNMP, DHCP

Security: Most web attacks target Layer 7 โ€” SQLi, XSS, CSRF, directory traversal, credential brute force. WAFs (Web Application Firewalls) protect Layer 7.


OSI Layer Data Units (PDUs)

LayerPDU NameWhat it Contains
7. ApplicationDataApplication payload
6. PresentationDataFormatted/encrypted data
5. SessionDataSession info
4. TransportSegment (TCP) / Datagram (UDP)Port numbers + data
3. NetworkPacketIP header + segment
2. Data LinkFrameMAC header + packet
1. PhysicalBitsRaw 0s and 1s

Encapsulation (Sender) vs Decapsulation (Receiver)

SENDER (adding headers going down):
App Data โ†’ [Session][Presentation][Application Data]
         โ†’ [Transport Header][Data]  = Segment
         โ†’ [Network Header][Segment] = Packet
         โ†’ [MAC Header][Packet][FCS] = Frame
         โ†’ 01010110101...              = Bits

RECEIVER (stripping headers going up): reverse process

6. TCP/IP Model

The TCP/IP model is the practical model that actually runs the Internet. Developed by DARPA in the 1970s.

Unlike OSI (7 layers), TCP/IP has 4 layers โ€” it collapses several OSI layers together.

TCP/IP Model              OSI Equivalent
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  4. Application  โ”‚  =   โ”‚ 7. Application     โ”‚
โ”‚                  โ”‚      โ”‚ 6. Presentation    โ”‚
โ”‚                  โ”‚      โ”‚ 5. Session         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค      โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  3. Transport    โ”‚  =   โ”‚ 4. Transport       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค      โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  2. Internet     โ”‚  =   โ”‚ 3. Network         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค      โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  1. Network      โ”‚  =   โ”‚ 2. Data Link       โ”‚
โ”‚     Access       โ”‚      โ”‚ 1. Physical        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Combines OSI Data Link + Physical
  • Handles physical transmission of data on the local network
  • MAC addressing, frame creation, physical medium
  • Protocols: Ethernet, Wi-Fi (802.11), ARP

Layer 2 โ€” Internet Layer

  • Corresponds to OSI Network Layer
  • Logical addressing and routing across networks
  • Protocols: IP (IPv4/IPv6), ICMP, IGMP

Layer 3 โ€” Transport Layer

  • Corresponds to OSI Transport Layer
  • End-to-end data transfer between applications
  • Protocols: TCP, UDP

Layer 4 โ€” Application Layer

  • Combines OSI Session + Presentation + Application
  • All application-level protocols
  • Protocols: HTTP, HTTPS, DNS, FTP, SSH, SMTP, DHCP, Telnet

OSI vs TCP/IP โ€” Quick Comparison

FeatureOSI ModelTCP/IP Model
Layers74
TypeConceptual/theoreticalPractical/implemented
Developed byISO (1984)DARPA (1970s)
PurposeUniversal reference frameworkInternet communication
Application protocolsLayers 5, 6, 7Single Application layer
Transport protocolsLayer 4Layer 3 (Transport)
PhysicalLayer 1Part of Network Access
Used forLearning, troubleshootingActual internet

๐Ÿ’ก Exam tip: OSI is the theoretical model you use to understand and explain networking. TCP/IP is the real model the internet actually uses. Both are tested together.


7. How It All Connects โ€” Security Mapping

OSI LayerTCP/IP LayerDevicesAttacksDefences
7 ApplicationApplicationProxy, WAFSQLi, XSS, phishingWAF, input validation, HTTPS
6 PresentationApplicationโ€”SSL strippingTLS 1.3, HSTS
5 SessionApplicationโ€”Session hijackingSecure cookies, re-auth
4 TransportTransportFirewallSYN flood, port scanFirewall, rate limiting
3 NetworkInternetRouterIP spoofing, ICMP floodACLs, ingress filtering
2 Data LinkNetwork AccessSwitchARP poison, MAC floodDynamic ARP inspection, port security
1 PhysicalNetwork AccessHubWiretapping, hardware tapPhysical security, encrypted cable