Network Security Mechanisms: Firewalls, VPNs, IDS and Worked Rule Traces

Follow one campus network through firewall decisions, VPN encapsulation and IDS metrics. Learn what each control protects, and what it cannot prove.

KnowledgeGate Team

Exam prep & CS education

Updated 5 Dec 20266 min read
Network Security Mechanisms: Firewalls, VPNs, IDS and Worked Rule Traces

It is easy to memorise firewall, encryption, VPN, IDS and authentication as five definitions. Trouble starts when a scenario asks which control belongs at which boundary. A campus learning-portal network illustrates an ordered firewall trace, a VPN overhead calculation and an IDS confusion matrix. The wider UGC NET CS Exam Preparation route supplies the Computer Networks context for these mechanisms.

Network Security Mechanisms Start with Assets, Flows and Security Goals

Student phone S44 has address 10.20.30.44 on student VLAN 30 (10.20.30.0/24). Administrator laptop A77 is on admin VLAN 10 (10.20.10.0/24). The learning application is 10.20.40.10, and its database is 10.20.50.20. Students need HTTPS to the application, administrators need SSH, and only the application needs a database connection.

Confidentiality protects credentials and lesson data from disclosure. Integrity protects marks and requests from unauthorised change. Availability keeps the portal reachable. Authenticity establishes the communicating identity, while accountability preserves events that can be attributed to an actor. Choose a mechanism only after naming the asset, adversary, flow and required property. The Computer Networks guide provides the prerequisite map of addresses, ports and routing. A security policy governs those flows; it does not replace the network model.

Map Each Mechanism to Its Boundary and Job

Mechanism

Boundary

Primary job

Running example

What it does not prove

Wireless link protection

Phone to access point

Protect and authenticate the radio link

S44 joins campus Wi-Fi

A portal action is authorised

TLS

Application client to service

Protect data and authenticate a validated service

S44 to 10.20.40.10:443

Which record may be read

Firewall

Zone boundary

Permit or deny network flows

VLAN 30 to app port 443

Business permission by itself

VPN

Tunnel endpoints

Protect traffic across an untrusted path

Remote A77 enters the admin network

The endpoint is trustworthy

IDS or IPS

Monitored path

Detect or block selected activity

Alert on scans

Complete detection or no false alarms

Logging

Systems and collector

Preserve events

Actor, flow and decision

An attempt will be prevented

Segmentation reduces reachability between zones. Least privilege narrows each permitted flow or action, limiting impact across these mechanisms.

Worked Firewall Example: Trace Four Packets Through Ordered Rules

This stateful policy first accepts packets in an established connection, then applies rules in order:

  1. Allow new TCP from 10.20.10.0/24 to 10.20.40.10 on destination port 22.

  2. Allow new TCP from 10.20.30.0/24 to 10.20.40.10 on destination port 443.

  3. Allow new TCP from 10.20.40.10 to 10.20.50.20 on destination port 5432.

  4. Deny and log everything else.

The first match decides the packet, while Rule 4 creates default deny, a policy style covered in NIST firewall guidance. Changing rule order can change the result, so treat order as policy.

Packet A, 10.20.30.44:51514 -> 10.20.40.10:443, fails Rule 1 on source and matches Rule 2, so it is allowed. Its reply, 10.20.40.10:443 -> 10.20.30.44:51514, is accepted by established state, not a broad reverse rule. Packet B, 10.20.30.44:51515 -> 10.20.40.10:22, matches none of Rules 1 to 3, so Rule 4 denies and logs it. Packet C, 10.20.40.10:53000 -> 10.20.50.20:5432, matches Rule 3. Packet D is an unsolicited new 10.20.50.20:5432 -> 10.20.40.10:53000; without established state, Rule 4 denies it. NAT, a changed port or an authenticated user cannot substitute for a least-privilege firewall rule.

Campus firewall path showing admin, student, app, and database zones with allow/deny rules and packet flow.

Encryption Scope and a Worked VPN Overhead Calculation

Wireless link security protects one radio hop. TLS protects an application connection to a validated service. A VPN protects traffic between tunnel endpoints. Encryption can provide confidentiality and support integrity and peer authentication within protocol scope. It cannot repair an infected endpoint, excessive permission or an unavailable server.

Remote A77 connects from public address 198.51.100.27. After authenticated tunnel establishment, it receives virtual admin address 10.20.10.77; only then does the firewall test its SSH flow to 10.20.40.10:22 against Rule 1. The address alone is insufficient. Require endpoint checks and a short-lived admin session.

The supplied path MTU is 1,500 bytes. Its 1,460-byte inner IPv4 packet contains a 20-byte IP header + 20-byte TCP header + 1,420-byte payload. Tunnel overhead is 52 bytes.

  • Encapsulated size = 1,460 + 52 = 1,512 bytes, which exceeds the MTU by 1,512 - 1,500 = 12 bytes.

  • Maximum inner packet = 1,500 - 52 = 1,448 bytes.

  • Maximum TCP payload = 1,448 - 20 - 20 = 1,408 bytes.

The result depends on the stated 52-byte overhead; a different tunnel format changes the maximum inner packet and payload.

Authentication, Authorisation and Segmentation on Mobile and Wireless Networks

Joining campus Wi-Fi authenticates S44's device or user to that network under the selected scheme. Portal login authenticates a portal identity. The application then authorises whether it may read lesson L8 or update result R12. Allowing port 443 proves only that the flow is permitted.

On a cafe network, S44 has address 172.16.8.24. A rogue access point can copy an SSID, which proves no trusted service identity. Validate the portal certificate, reject warnings, use the defined remote-access VPN, patch the device and revoke lost-device credentials. A VPN does not replace TLS or endpoint security.

If S44 is compromised, Rule 2 still limits direct reach to app port 443; the student VLAN cannot open database port 5432. An application flaw reachable over 443 still needs application-layer controls.

Worked IDS Example: Compute Precision, Recall and False-Positive Rate

An IDS observes and alerts. An IPS can block under policy. Signature detection seeks known patterns; behaviour or anomaly detection seeks deviations from a baseline. Neither is complete.

In one lab window, 1,000 flows include 40 malicious and 960 benign. The IDS alerts on 50; analysts confirm 32 as malicious.

  • TP = 32.

  • FP = 50 - 32 = 18.

  • FN = 40 - 32 = 8.

  • TN = 960 - 18 = 942.

  • Total check: 32 + 18 + 8 + 942 = 1,000.

The rates are:

  • Precision = TP / (TP + FP) = 32 / 50 = 64%.

  • Recall = TP / (TP + FN) = 32 / 40 = 80%.

  • False-positive rate = FP / (FP + TN) = 18 / 960 = 1.875%.

  • Accuracy = (TP + TN) / 1,000 = (32 + 942) / 1,000 = 97.4%.

Benign traffic makes accuracy look high despite eight missed attacks. Correlate alerts with firewall, application and identity logs before containment. An alert is not proof of compromise.

IDS confusion matrix for 1,000 flows showing true and false positives and negatives, rates, and missed attacks.

Network Security Traps and Representative Exam Patterns

  • A firewall controls reachability, not record-level authorisation.

  • Encryption protects a defined channel, not every endpoint or availability.

  • A VPN is a protected tunnel, not automatic endpoint trust.

  • IDS alerts need validation; IPS blocking can itself affect availability.

  • Authentication asks who or what proved an identity. Authorisation asks whether that identity may act.

  • A copied SSID does not prove a legitimate access point.

Questions may ask you to select a mechanism for a goal, trace ordered stateful rules, compare wireless, TLS and VPN boundaries, test tunnel size against MTU, complete a confusion matrix, or layer controls against a rogue access point or lateral movement. Identify the decisive field before calculating. Use UGC NET Computer Science Syllabus Areas: Paper 2 for wider revision context.

Short Version and the Next Practice Step

Name the asset and flow, state the property, identify the boundary, authenticate, apply least privilege, restrict reachability, protect the right channel and validate alerts. Preserve availability and recovery options.

Student HTTPS reaches Rule 2 while student SSH reaches default deny. The given VPN overhead reduces the maximum TCP payload from 1,420 to 1,408 bytes. The IDS gives 64% precision, 80% recall and a 1.875% false-positive rate. Structured learners can continue with NTA-UGC-NET Paper - 2; practice-focused learners can use the NTA UGC NET Paper - 2 Test Series. Redraw both diagrams, then change Rule 2's destination port or the IDS counts and recompute every decision.