Introduction: what this topic is and why it matters
A computer network moves data across many devices and layers. Every layer — from the physical wire up to the web application — can be attacked. Network attacks are deliberate attempts to steal, alter, disrupt, or eavesdrop on this data. Layer‑2 security focuses on the Data Link Layer (the switch/LAN layer), where attacks such as ARP spoofing, MAC flooding, and rogue DHCP quietly compromise an entire local network before firewalls higher up ever notice.
For BCS, Bank IT, and government IT‑officer exams this is one of the highest‑yield topics. Examiners repeatedly ask you to distinguish attacks (active vs passive, DoS vs DDoS, spoofing vs poisoning), to name the layer an attack lives on, to state one prevention per attack, and to solve a Caesar/Vigenère cipher by hand. This lesson builds every idea from first principles so you can answer both the conceptual MCQs and the short computational questions.
Learning objectives
By the end of this lesson you should be able to:
- Distinguish active attacks from passive attacks and give examples of each.
- Explain DoS and DDoS, describe a SYN flood, and list prevention techniques.
- Describe man‑in‑the‑middle (MITM) and how ARP spoofing/poisoning and DNS spoofing enable it.
- Explain Layer‑2 attacks: MAC flooding, DHCP starvation, rogue DHCP, and the defence of port security.
- Define IP spoofing, session hijacking, packet sniffing, and port scanning.
- Explain application attacks: buffer overflow, SQL injection (and prevention with prepared statements), XSS, and CSRF.
- Solve classical cipher problems: Caesar/shift cipher, Vigenère, and tell substitution from transposition.
- State the defensive role of firewall, WAF, IDS, IPS, and sandbox.