Knowledge / Information Technology / Network security: firewalls, VPN and IDS

Network security: firewalls, VPN and IDS

Information Technology (B.E./B.Tech) · Information security · free study notes for exams, placements and interviews

In short

Network security is the set of controls that protect data in transit and control which hosts and services can reach each other: firewalls enforce a policy on traffic, VPNs create an authenticated and encrypted tunnel across an untrusted network, and intrusion detection/prevention systems watch traffic for attack patterns. It is the perimeter-and-segmentation layer of defence in depth, and the layer a student is most likely to be asked to configure in a first job. It carries dedicated marks in university Information Security / Cryptography and Network Security papers and in GATE CS/IT (network attacks, IPsec, firewalls), and dominates interviews for network and security engineer roles at TCS, Infosys, Wipro, HCL, Tech Mahindra, Cisco, Palo Alto Networks, Fortinet, Airtel, Jio, banks and the CERT-In empanelled audit firms. In Indian practice it is governed by the IT Act 2000, the CERT-In Directions of April 2022, RBI/SEBI cyber-security frameworks and ISO/IEC 27033.

Explained

Threat model: what network defences are defending against

Firewalls: types, working and architectures

VPN: tunnelling, IPsec and TLS-based VPNs

IDS and IPS: detection, placement and accuracy

Supporting network controls

Indian standards, Acts and practice

Key points

Formulas and examples

TPR (recall, detection rate) = TP / (TP + FN); FPR = FP / (FP + TN); FNR = 1 − TPR
Precision (PPV) = TP / (TP + FP); Accuracy = (TP + TN) / (TP + TN + FP + FN); F1 = 2·P·R / (P + R)
Bayes: P(attack | alert) = p·TPR / [ p·TPR + (1 − p)·FPR ], where p = prevalence (base rate) of attacks
Packet rate pps = Throughput (bits/s) / (8 × average packet size in bytes)
Firewall throughput at a given packet size = rated pps × packet size (bytes) × 8 (bits/s)
ESP tunnel-mode overhead (bytes) = outer IP (20, IPv4) + ESP header 8 (SPI 4 + sequence 4) + IV (16 for AES-CBC) + padding + pad-length 1 + next-header 1 + ICV (12 for HMAC-SHA1-96 / 16 for SHA-256-128); the encrypted block (payload + padding + 2) must be a multiple of the cipher block size (16 for AES)
TCP MSS to advertise = tunnel MTU − inner IP header (20) − TCP header (20)
Link bandwidth needed = concurrent users × average per-user rate × (1 + tunnel overhead fraction)
Availability A = MTBF / (MTBF + MTTR); for two independent devices in parallel, U_pair = U₁ × U₂, A_pair = 1 − U_pair

Example 1 - IDS alert quality (base rate fallacy). An NIDS inspects 10,00,000 (1 million) sessions a day. Attacks are 0.01% of sessions (p = 0.0001). Sensor: TPR = 99%, FPR = 0.5%.

Example 2 - IPsec MTU and MSS clamping. Ethernet path MTU 1500 B; ESP tunnel mode, AES-128-CBC + HMAC-SHA1-96, IPv4.

Example 3 - Sizing a site-to-site VPN link. 200 concurrent users average 300 kbps each across a 100 Mbps leased line, over the tunnel of Example 2.

Example 4 - Firewall rating vs packet size (small-packet DoS). A firewall is rated "1 Gbps throughput, 5,00,000 pps".

Example 5 - HA firewall availability. Each firewall: MTBF = 50,000 h, MTTR = 4 h.

FeaturePacket filterStatefulProxy (ALG)NGFW
OSI layer3–43–4 (+ state)73–7
Keeps session stateNoYesYes (terminates)Yes
Sees application contentNoNoYesYes (with TLS decryption)
SpeedHighestHighLowestModerate (hardware-assisted)
User identity / app-IDNoNoPossibleYes
IPsec VPNTLS/SSL VPN
LayerNetwork (L3)Transport/application
PortsIP 50/51, UDP 500, UDP 4500TCP/UDP 443
ClientDedicated client, managed deviceBrowser or light client; BYOD-friendly
Access grantedFull subnet-levelPer-application (or full with client)
NAT / firewall traversalNeeds NAT-T, often blockedAlmost always passes
Typical useSite-to-site, trusted laptopsRemote/contractor access, portals
FirewallIDSIPS
PositionInline, policy pointOut-of-band (SPAN/TAP)Inline
Decision basisRules on headers/appsSignatures, anomaliesSignatures, anomalies
ActionAllow/denyAlert and log onlyDrop, reset, rate-limit
Failure costBlocked business trafficMissed or noisy alertsFalse positive = outage
# Stateful iptables skeleton: default deny, allow established, SSH from LAN only
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s 192.168.10.0/24 -p tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -m conntrack --ctstate NEW -j ACCEPT
iptables -A INPUT -j LOG --log-prefix "FW-DROP: "

# Snort/Suricata rule anatomy: action proto src port -> dst port (options)
alert tcp any any -> 10.0.0.0/24 22 (msg:"SSH brute force"; flow:to_server;
  threshold:type threshold, track by_src, count 10, seconds 60; sid:1000101; rev:1;)

Where it is used

Interview questions

Common mistakes

Related topics

Information security fundamentals · Cryptography basics · Security operations: SOC and SIEM · Ethical hacking and penetration testing · Cloud security · Computer networks: TCP/IP protocol stack

Open in the Knowledge reader →Find jobs →