Formula Vault · CN
Computer Networks
Sheet 1
Addressing & Subnetting
2 formulasCore concepts
- Class A: 1-126 (/8); Class B: 128-191 (/16); Class C: 192-223 (/24)
- Subnet mask for /n = n ones then (32-n) zeros
Key formulas
Test your recall
Can you recall the hosts in a /n subnet formula?
Reveal formula
\[ 2^{32-n}-2 \]
GATE traps 4 traps
Don't forget the −2
The '-2' in host-count formulas (network address + broadcast address) is frequently forgotten -- and some questions explicitly allow all-zeros/all-ones subnets, so read the problem statement carefully before subtracting.
Classful addressing is mostly historical
Class-based addressing (A/B/C) is essentially obsolete in real networks (replaced by CIDR) but still appears in GATE numericals -- don't assume a class-default mask applies if an explicit subnet mask is given.
Subnetting borrows from the host side
Subnetting increases network/subnet bits and decreases host bits -- a common sign error is subtracting from the wrong end when recomputing the mask.
Supernetting reverses subnetting
Supernetting (route aggregation) combines multiple smaller blocks into one larger prefix -- the reverse of subnetting; occasionally tested by asking you to aggregate several /24s.
Sheet 2
Transport Layer (TCP/UDP)
3 formulasCore concepts
- TCP header: 20 bytes minimum; UDP header: 8 bytes fixed
Key formulas
Test your recall
Can you recall the throughput (unsaturated) formula?
Reveal formula
\[ \frac{\text{Window size}}{RTT} \]
GATE traps 4 traps
UDP still has a checksum
UDP is connectionless with no reliability, ordering, or congestion control -- but it DOES still have a checksum for error detection; assuming UDP has zero error detection at all is a common overreach.
Stop-and-wait struggles on long fat networks
Stop-and-wait efficiency collapses when propagation delay is large relative to transmission time (long fat networks) -- this is exactly why sliding window protocols exist, a frequently tested 'why' question.
Handshake ≠ teardown sequence
TCP's three-way handshake (SYN, SYN-ACK, ACK) is for connection SETUP; a separate four-step exchange (FIN, ACK, FIN, ACK) handles graceful TEARDOWN -- mixing these two sequences up is a common mistake in step-numbered questions.
Window size has two ceilings
Window size is bounded by BOTH the sender's buffer and the sequence-number space (2^(sequence bits)) -- numericals sometimes test which constraint is actually the binding one.
Sheet 3
Data Link Layer & Routing
2 formulasCore concepts
- CRC: append (n-1) zero bits for an n-bit generator, divide, remainder = appended CRC bits
- Distance-vector (Bellman-Ford based) vs Link-state (Dijkstra based) routing
Key formulas
Test your recall
Can you recall the hamming code parity bits formula?
Reveal formula
\[ 2^r \ge m+r+1 \]
GATE traps 4 traps
GBN discards, SR buffers
Go-Back-N discards ALL out-of-order frames at the receiver; Selective Repeat buffers out-of-order frames individually -- this exact behavioral difference is what most GBN-vs-SR questions hinge on.
SR's window is half of GBN's
Selective Repeat's window bound is HALF that of Go-Back-N for the same sequence-number bits (2^(k-1) vs 2^k - 1) -- using the wrong formula for the wrong protocol is the single most common error on this topic.
Distance-vector can count to infinity
Distance-vector protocols suffer from 'count-to-infinity' on link failure -- split horizon and route poisoning only partially mitigate it, they don't fully fix it.
Hamming corrects 1, only detects 2
Hamming code corrects single-bit errors and can DETECT (not correct) double-bit errors -- conflating detection with correction capability is a common conceptual slip.
Sheet 4
Application Layer & Ports
1 formulaCore concepts
- DNS resolves names top-down: Root -> TLD (.com/.org) -> Authoritative name server
- HTTP is stateless -- each request is independent; cookies/sessions are the application-level workaround for tracking state
Key formulas
Well-Known Port Range
☆
\[ 0 \text{ to } 1023 \]
registered: 1024–49151, dynamic/private: 49152–65535
Test your recall
Can you recall the well-known port range formula?
Reveal formula
\[ 0 \text{ to } 1023 \]
Reference table
| Protocol | Port | Transport |
|---|---|---|
| HTTP | 80 | TCP |
| HTTPS | 443 | TCP |
| FTP (control) | 21 | TCP |
| FTP (data) | 20 | TCP |
| SSH | 22 | TCP |
| Telnet | 23 | TCP |
| SMTP | 25 | TCP |
| DNS | 53 | UDP / TCP |
| DHCP | 67, 68 | UDP |
| POP3 | 110 | TCP |
| IMAP | 143 | TCP |
| SNMP | 161 | UDP |
GATE traps 3 traps
DNS isn't strictly UDP
DNS uses UDP for regular queries (fast, best-effort, retried by the resolver on loss) but falls back to TCP for zone transfers and responses larger than 512 bytes -- assuming DNS is UDP-only is a common oversimplification GATE exploits.
FTP uses two connections
FTP uses TWO separate connections -- a control connection on port 21 that stays open for the whole session, and a data connection on port 20 opened per transfer -- most other application protocols (HTTP, SMTP) use just one.
Telnet and FTP are plaintext
Telnet and FTP send credentials in PLAINTEXT (no encryption) -- SSH (port 22) and SFTP are their secure replacements; GATE sometimes tests which protocols are inherently insecure.