# CCNA Subnetting Cheat Sheet

**VantagePoint Networks -- Study Guide Series**

---

| Field              | Value                                      |
|--------------------|--------------------------------------------|
| Document ID        | VPN-SG-CCNA-001                            |
| Version            | 1.0                                        |
| Author             | <AUTHOR_NAME>                              |
| Target Exam        | Cisco CCNA 200-301                         |
| Effective Date     | <EFFECTIVE_DATE>                           |
| Organisation       | <ORGANISATION_NAME>                        |

---

## Table of Contents

1. [Complete CIDR Reference Table](#1-complete-cidr-reference-table)
2. [Powers of 2 Table](#2-powers-of-2-table)
3. [The Magic Number Method](#3-the-magic-number-method)
4. [Worked Examples](#4-worked-examples)
5. [Private IP Address Ranges (RFC 1918)](#5-private-ip-address-ranges-rfc-1918)
6. [Common Port Numbers](#6-common-port-numbers)
7. [IPv4 Header Diagram](#7-ipv4-header-diagram)
8. [Routing Protocol Reference](#8-routing-protocol-reference)
9. [Spanning Tree Protocol Reference](#9-spanning-tree-protocol-reference)
10. [Quick Reference Summary](#10-quick-reference-summary)

---

## 1. Complete CIDR Reference Table

### CIDR Notation, Subnet Masks, and Host Counts (/0 through /32)

| CIDR  | Subnet Mask         | Wildcard Mask       | Total Addresses      | Usable Hosts         | Class     |
|-------|---------------------|---------------------|----------------------|----------------------|-----------|
| /0    | 0.0.0.0             | 255.255.255.255     | 4,294,967,296        | 4,294,967,294        | Default   |
| /1    | 128.0.0.0           | 127.255.255.255     | 2,147,483,648        | 2,147,483,646        |           |
| /2    | 192.0.0.0           | 63.255.255.255      | 1,073,741,824        | 1,073,741,822        |           |
| /3    | 224.0.0.0           | 31.255.255.255      | 536,870,912          | 536,870,910          |           |
| /4    | 240.0.0.0           | 15.255.255.255      | 268,435,456          | 268,435,454          |           |
| /5    | 248.0.0.0           | 7.255.255.255       | 134,217,728          | 134,217,726          |           |
| /6    | 252.0.0.0           | 3.255.255.255       | 67,108,864           | 67,108,862           |           |
| /7    | 254.0.0.0           | 1.255.255.255       | 33,554,432           | 33,554,430           |           |
| /8    | 255.0.0.0           | 0.255.255.255       | 16,777,216           | 16,777,214           | Class A   |
| /9    | 255.128.0.0         | 0.127.255.255       | 8,388,608            | 8,388,606            |           |
| /10   | 255.192.0.0         | 0.63.255.255        | 4,194,304            | 4,194,302            |           |
| /11   | 255.224.0.0         | 0.31.255.255        | 2,097,152            | 2,097,150            |           |
| /12   | 255.240.0.0         | 0.15.255.255        | 1,048,576            | 1,048,574            |           |
| /13   | 255.248.0.0         | 0.7.255.255         | 524,288              | 524,286              |           |
| /14   | 255.252.0.0         | 0.3.255.255         | 262,144              | 262,142              |           |
| /15   | 255.254.0.0         | 0.1.255.255         | 131,072              | 131,070              |           |
| /16   | 255.255.0.0         | 0.0.255.255         | 65,536               | 65,534               | Class B   |
| /17   | 255.255.128.0       | 0.0.127.255         | 32,768               | 32,766               |           |
| /18   | 255.255.192.0       | 0.0.63.255          | 16,384               | 16,382               |           |
| /19   | 255.255.224.0       | 0.0.31.255          | 8,192                | 8,190                |           |
| /20   | 255.255.240.0       | 0.0.15.255          | 4,096                | 4,094                |           |
| /21   | 255.255.248.0       | 0.0.7.255           | 2,048                | 2,046                |           |
| /22   | 255.255.252.0       | 0.0.3.255           | 1,024                | 1,022                |           |
| /23   | 255.255.254.0       | 0.0.1.255           | 512                  | 510                  |           |
| /24   | 255.255.255.0       | 0.0.0.255           | 256                  | 254                  | Class C   |
| /25   | 255.255.255.128     | 0.0.0.127           | 128                  | 126                  |           |
| /26   | 255.255.255.192     | 0.0.0.63            | 64                   | 62                   |           |
| /27   | 255.255.255.224     | 0.0.0.31            | 32                   | 30                   |           |
| /28   | 255.255.255.240     | 0.0.0.15            | 16                   | 14                   |           |
| /29   | 255.255.255.248     | 0.0.0.7             | 8                    | 6                    |           |
| /30   | 255.255.255.252     | 0.0.0.3             | 4                    | 2                    | P2P Link  |
| /31   | 255.255.255.254     | 0.0.0.1             | 2                    | 2 (RFC 3021)         | P2P Link  |
| /32   | 255.255.255.255     | 0.0.0.0             | 1                    | 1 (host route)       | Host      |

**Key formulas:**
- Total addresses = 2^(32 - prefix length)
- Usable hosts = 2^(32 - prefix length) - 2 (subtract network and broadcast)
- Wildcard mask = 255.255.255.255 - subnet mask

---

## 2. Powers of 2 Table

This table is essential for rapid subnetting calculations.

| Exponent | Value        | Common Use                                |
|----------|--------------|-------------------------------------------|
| 2^0      | 1            | /32 host route                            |
| 2^1      | 2            | /31 point-to-point link (RFC 3021)        |
| 2^2      | 4            | /30 point-to-point link (2 usable)        |
| 2^3      | 8            | /29 smallest practical subnet (6 usable)  |
| 2^4      | 16           | /28 small subnet (14 usable)              |
| 2^5      | 32           | /27 subnet (30 usable)                    |
| 2^6      | 64           | /26 subnet (62 usable)                    |
| 2^7      | 128          | /25 subnet (126 usable)                   |
| 2^8      | 256          | /24 Class C equivalent (254 usable)       |
| 2^9      | 512          | /23 (510 usable)                          |
| 2^10     | 1,024        | /22 (1,022 usable)                        |
| 2^11     | 2,048        | /21 (2,046 usable)                        |
| 2^12     | 4,096        | /20 (4,094 usable)                        |
| 2^13     | 8,192        | /19 (8,190 usable)                        |
| 2^14     | 16,384       | /18 (16,382 usable)                       |
| 2^15     | 32,768       | /17 (32,766 usable)                       |
| 2^16     | 65,536       | /16 Class B equivalent (65,534 usable)    |
| 2^17     | 131,072      |                                           |
| 2^18     | 262,144      |                                           |
| 2^19     | 524,288      |                                           |
| 2^20     | 1,048,576    | /12 (1,048,574 usable)                    |
| 2^21     | 2,097,152    |                                           |
| 2^22     | 4,194,304    |                                           |
| 2^23     | 8,388,608    |                                           |
| 2^24     | 16,777,216   | /8 Class A equivalent (16,777,214 usable) |

**Memorisation tip:** Each step doubles. Start from 2^10 = 1,024 and work up or down.

---

## 3. The Magic Number Method

The Magic Number Method is the fastest way to calculate subnet boundaries without binary conversion.

### How It Works

1. **Identify the interesting octet** -- the octet where the subnet mask is NOT 0 and NOT 255
2. **Calculate the magic number** -- subtract the interesting octet value from 256
3. **Multiples of the magic number** define the subnet boundaries in that octet

### Formula

```
Magic Number = 256 - (subnet mask value in the interesting octet)
```

### Step-by-Step Process

1. Write the subnet mask
2. Find the interesting octet (the one that is not 0 or 255)
3. Magic Number = 256 - interesting octet value
4. Network addresses are multiples of the magic number in that octet
5. Broadcast address = next network address - 1
6. First usable host = network address + 1
7. Last usable host = broadcast address - 1

---

## 4. Worked Examples

### Example 1: Find the subnet for 192.168.1.130/26

**Given:** IP = 192.168.1.130, Mask = /26 = 255.255.255.192

**Step 1:** Interesting octet = 4th octet (192)

**Step 2:** Magic Number = 256 - 192 = 64

**Step 3:** List subnet boundaries in the 4th octet: 0, 64, 128, 192

**Step 4:** 130 falls between 128 and 192

**Result:**
- Network address: 192.168.1.128
- First usable host: 192.168.1.129
- Last usable host: 192.168.1.191
- Broadcast address: 192.168.1.191
- Usable hosts: 62

Wait -- let me correct that:
- Broadcast address: 192.168.1.191 (next subnet 192 minus 1)
- Last usable host: 192.168.1.190

**Verification:** 192 - 128 = 64 addresses. 64 - 2 = 62 usable. Correct.

---

### Example 2: Find the subnet for 10.45.67.200/21

**Given:** IP = 10.45.67.200, Mask = /21 = 255.255.248.0

**Step 1:** Interesting octet = 3rd octet (248)

**Step 2:** Magic Number = 256 - 248 = 8

**Step 3:** List subnet boundaries in the 3rd octet: 0, 8, 16, 24, 32, 40, 48, 56, 64, 72...

**Step 4:** 67 falls between 64 and 72

**Result:**
- Network address: 10.45.64.0
- First usable host: 10.45.64.1
- Last usable host: 10.45.71.254
- Broadcast address: 10.45.71.255
- Usable hosts: 2,046

**Verification:** 8 x 256 = 2,048 addresses. 2,048 - 2 = 2,046 usable. Correct.

---

### Example 3: How many /28 subnets fit in 172.16.5.0/24?

**Given:** Parent network = /24, subnets needed = /28

**Step 1:** Difference in prefix = 28 - 24 = 4 bits borrowed

**Step 2:** Number of subnets = 2^4 = 16

**Step 3:** Hosts per subnet = 2^(32-28) - 2 = 16 - 2 = 14

**Result:**
- 16 subnets, each with 14 usable hosts
- Subnet boundaries (4th octet): 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240

| Subnet # | Network Address  | First Host       | Last Host        | Broadcast        |
|----------|------------------|------------------|------------------|------------------|
| 1        | 172.16.5.0       | 172.16.5.1       | 172.16.5.14      | 172.16.5.15      |
| 2        | 172.16.5.16      | 172.16.5.17      | 172.16.5.30      | 172.16.5.31      |
| 3        | 172.16.5.32      | 172.16.5.33      | 172.16.5.46      | 172.16.5.47      |
| 4        | 172.16.5.48      | 172.16.5.49      | 172.16.5.62      | 172.16.5.63      |
| ...      | ...              | ...              | ...              | ...              |
| 16       | 172.16.5.240     | 172.16.5.241     | 172.16.5.254     | 172.16.5.255     |

---

### Example 4: Design subnets for 192.168.10.0/24 with the following requirements

| Department  | Hosts Needed |
|-------------|-------------|
| Engineering | 50          |
| Sales       | 25          |
| Management  | 10          |
| Server VLAN | 5           |
| P2P Links   | 2 links     |

**Rule:** Always allocate the largest subnet first.

**Step 1: Engineering (50 hosts)**
- Need 50 hosts. Next power of 2 >= 52 (hosts + network + broadcast) = 64 = 2^6
- Prefix = 32 - 6 = /26 (62 usable hosts)
- Subnet: 192.168.10.0/26 (range .0 to .63)

**Step 2: Sales (25 hosts)**
- Need 25 hosts. Next power of 2 >= 27 = 32 = 2^5
- Prefix = 32 - 5 = /27 (30 usable hosts)
- Subnet: 192.168.10.64/27 (range .64 to .95)

**Step 3: Management (10 hosts)**
- Need 10 hosts. Next power of 2 >= 12 = 16 = 2^4
- Prefix = 32 - 4 = /28 (14 usable hosts)
- Subnet: 192.168.10.96/28 (range .96 to .111)

**Step 4: Server VLAN (5 hosts)**
- Need 5 hosts. Next power of 2 >= 7 = 8 = 2^3
- Prefix = 32 - 3 = /29 (6 usable hosts)
- Subnet: 192.168.10.112/29 (range .112 to .119)

**Step 5: P2P Links (2 links, 2 hosts each)**
- /30 per link (2 usable hosts each)
- Link 1: 192.168.10.120/30 (range .120 to .123)
- Link 2: 192.168.10.124/30 (range .124 to .127)

**Summary:**

| Department  | Subnet              | Range              | Usable Hosts | Allocated |
|-------------|---------------------|--------------------|-------------|-----------|
| Engineering | 192.168.10.0/26     | .0 - .63           | 62          | 50        |
| Sales       | 192.168.10.64/27    | .64 - .95          | 30          | 25        |
| Management  | 192.168.10.96/28    | .96 - .111         | 14          | 10        |
| Server VLAN | 192.168.10.112/29   | .112 - .119        | 6           | 5         |
| P2P Link 1  | 192.168.10.120/30   | .120 - .123        | 2           | 2         |
| P2P Link 2  | 192.168.10.124/30   | .124 - .127        | 2           | 2         |
| Remaining   | 192.168.10.128/25   | .128 - .255        | 126         | -         |

Remaining address space: 192.168.10.128 to 192.168.10.255 (/25) available for future use.

---

### Example 5: Given 10.0.0.0/8, what is the subnet mask for 500 subnets?

**Step 1:** Find the number of bits needed for 500 subnets
- 2^9 = 512 (this is the smallest power of 2 that is >= 500)
- Bits to borrow = 9

**Step 2:** New prefix = 8 + 9 = /17

**Step 3:** Subnet mask for /17 = 255.255.128.0

**Step 4:** Hosts per subnet = 2^(32-17) - 2 = 2^15 - 2 = 32,766

**Result:**
- 512 subnets available (500 required, 12 spare)
- Each subnet supports 32,766 hosts
- Subnet mask: 255.255.128.0 (/17)

---

## 5. Private IP Address Ranges (RFC 1918)

### RFC 1918 Private Address Space

| Class   | Range                         | CIDR Notation   | Subnet Mask     | Total Addresses | Subnets Available     |
|---------|-------------------------------|-----------------|-----------------|-----------------|----------------------|
| Class A | 10.0.0.0 - 10.255.255.255    | 10.0.0.0/8      | 255.0.0.0       | 16,777,216      | 1 Class A network     |
| Class B | 172.16.0.0 - 172.31.255.255  | 172.16.0.0/12   | 255.240.0.0     | 1,048,576       | 16 Class B networks   |
| Class C | 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | 255.255.0.0     | 65,536          | 256 Class C networks  |

### Other Special-Use Addresses

| Range                           | Purpose                              | Reference       |
|---------------------------------|--------------------------------------|-----------------|
| 0.0.0.0/8                      | "This" network                       | RFC 791         |
| 127.0.0.0/8                    | Loopback                             | RFC 1122        |
| 169.254.0.0/16                 | Link-local (APIPA)                   | RFC 3927        |
| 192.0.2.0/24                   | Documentation (TEST-NET-1)           | RFC 5737        |
| 198.51.100.0/24                | Documentation (TEST-NET-2)           | RFC 5737        |
| 203.0.113.0/24                 | Documentation (TEST-NET-3)           | RFC 5737        |
| 198.18.0.0/15                  | Benchmarking                         | RFC 2544        |
| 100.64.0.0/10                  | Carrier-grade NAT (CGN/CGNAT)        | RFC 6598        |
| 224.0.0.0/4                    | Multicast                            | RFC 5771        |
| 240.0.0.0/4                    | Reserved (formerly Class E)          | RFC 1112        |
| 255.255.255.255/32             | Limited broadcast                    | RFC 919         |

---

## 6. Common Port Numbers

### Top 30 Ports for CCNA

| Port    | Protocol | Service                        | Description                              |
|---------|----------|--------------------------------|------------------------------------------|
| 20      | TCP      | FTP Data                       | File Transfer Protocol (data channel)    |
| 21      | TCP      | FTP Control                    | File Transfer Protocol (control channel) |
| 22      | TCP      | SSH                            | Secure Shell (remote access, SFTP, SCP)  |
| 23      | TCP      | Telnet                         | Unencrypted remote terminal access       |
| 25      | TCP      | SMTP                           | Simple Mail Transfer Protocol            |
| 53      | TCP/UDP  | DNS                            | Domain Name System                       |
| 67      | UDP      | DHCP Server                    | Dynamic Host Configuration Protocol      |
| 68      | UDP      | DHCP Client                    | DHCP client responses                    |
| 69      | UDP      | TFTP                           | Trivial File Transfer Protocol           |
| 80      | TCP      | HTTP                           | Hypertext Transfer Protocol              |
| 110     | TCP      | POP3                           | Post Office Protocol v3                  |
| 123     | UDP      | NTP                            | Network Time Protocol                    |
| 143     | TCP      | IMAP                           | Internet Message Access Protocol         |
| 161     | UDP      | SNMP                           | Simple Network Management Protocol       |
| 162     | UDP      | SNMP Trap                      | SNMP notifications (trap/inform)         |
| 179     | TCP      | BGP                            | Border Gateway Protocol                  |
| 389     | TCP/UDP  | LDAP                           | Lightweight Directory Access Protocol    |
| 443     | TCP      | HTTPS                          | HTTP over TLS/SSL                        |
| 445     | TCP      | SMB                            | Server Message Block (file sharing)      |
| 465     | TCP      | SMTPS                          | SMTP over TLS (implicit)                 |
| 514     | UDP      | Syslog                         | System Logging Protocol                  |
| 587     | TCP      | SMTP Submission                | Mail submission (STARTTLS)               |
| 636     | TCP      | LDAPS                          | LDAP over TLS/SSL                        |
| 993     | TCP      | IMAPS                          | IMAP over TLS/SSL                        |
| 995     | TCP      | POP3S                          | POP3 over TLS/SSL                        |
| 1433    | TCP      | MS SQL                         | Microsoft SQL Server                     |
| 1521    | TCP      | Oracle DB                      | Oracle Database listener                 |
| 3306    | TCP      | MySQL                          | MySQL Database                           |
| 3389    | TCP      | RDP                            | Remote Desktop Protocol                  |
| 5060    | TCP/UDP  | SIP                            | Session Initiation Protocol (VoIP)       |

### Port Ranges

| Range             | Name             | Description                           |
|-------------------|------------------|---------------------------------------|
| 0 - 1023          | Well-Known Ports | Reserved for common services (IANA)   |
| 1024 - 49151      | Registered Ports | Vendor-specific applications          |
| 49152 - 65535     | Dynamic/Ephemeral | Temporary client-side ports          |

---

## 7. IPv4 Header Diagram

```
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version|  IHL  |Type of Service|          Total Length         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Identification        |Flags|      Fragment Offset    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Time to Live |    Protocol   |         Header Checksum       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                       Source Address                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Destination Address                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Options (if IHL > 5)                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```

### IPv4 Header Fields

| Field              | Size (bits) | Description                                                |
|--------------------|-------------|------------------------------------------------------------|
| Version            | 4           | IP version (always 4 for IPv4)                             |
| IHL                | 4           | Internet Header Length in 32-bit words (min 5 = 20 bytes)  |
| Type of Service    | 8           | DSCP (6 bits) + ECN (2 bits) -- QoS marking               |
| Total Length       | 16          | Total packet size in bytes (header + data), max 65,535     |
| Identification     | 16          | Fragment identification -- unique per original datagram    |
| Flags              | 3           | Bit 0: Reserved. Bit 1: DF (Don't Fragment). Bit 2: MF (More Fragments) |
| Fragment Offset    | 13          | Position of fragment in original datagram (in 8-byte units)|
| Time to Live (TTL) | 8           | Hop count limit (decremented by 1 at each router)         |
| Protocol           | 8           | Upper-layer protocol (1=ICMP, 6=TCP, 17=UDP, 89=OSPF)     |
| Header Checksum    | 16          | Error detection for header only (recalculated at each hop) |
| Source Address     | 32          | Sender IP address                                          |
| Destination Address | 32         | Receiver IP address                                        |
| Options            | Variable    | Optional (rarely used): record route, timestamp, etc.      |

### Common Protocol Numbers

| Number | Protocol | Description                    |
|--------|----------|--------------------------------|
| 1      | ICMP     | Internet Control Message Protocol |
| 2      | IGMP     | Internet Group Management Protocol |
| 6      | TCP      | Transmission Control Protocol  |
| 17     | UDP      | User Datagram Protocol         |
| 47     | GRE      | Generic Routing Encapsulation  |
| 50     | ESP      | Encapsulating Security Payload |
| 51     | AH       | Authentication Header          |
| 88     | EIGRP    | Enhanced Interior Gateway Routing Protocol |
| 89     | OSPF     | Open Shortest Path First       |

---

## 8. Routing Protocol Reference

### Administrative Distance (AD) Table

Administrative Distance determines route preference when multiple routing protocols provide a route to the same destination. Lower AD is preferred.

| Route Source                    | Default AD | Notes                              |
|---------------------------------|------------|------------------------------------|
| Connected interface             | 0          | Directly connected networks        |
| Static route                    | 1          | Manually configured routes         |
| EIGRP summary route             | 5          | EIGRP auto-summary                 |
| External BGP (eBGP)            | 20         | Routes learned from external AS    |
| Internal EIGRP                  | 90         | Routes learned within EIGRP AS     |
| OSPF                            | 110        | All OSPF route types               |
| IS-IS                           | 115        | Intermediate System to Intermediate System |
| RIP                             | 120        | Routing Information Protocol       |
| External EIGRP                  | 170        | Routes redistributed into EIGRP    |
| Internal BGP (iBGP)            | 200        | Routes learned within same AS      |
| Unknown / Unreachable           | 255        | Route will never be used           |

### OSPF Quick Reference

| Parameter                    | Value / Details                                |
|------------------------------|------------------------------------------------|
| Algorithm                    | Dijkstra (SPF -- Shortest Path First)          |
| Metric                       | Cost (reference bandwidth / interface bandwidth)|
| Default reference bandwidth  | 100 Mbps                                       |
| Protocol number              | 89                                             |
| Multicast addresses          | 224.0.0.5 (AllSPFRouters), 224.0.0.6 (AllDRouters) |
| Hello timer (broadcast)      | 10 seconds                                     |
| Dead timer (broadcast)       | 40 seconds (4x hello)                          |
| Hello timer (NBMA)           | 30 seconds                                     |
| Dead timer (NBMA)            | 120 seconds (4x hello)                         |
| LSA types                    | Type 1 (Router), Type 2 (Network), Type 3 (Summary), Type 4 (ASBR Summary), Type 5 (External), Type 7 (NSSA External) |
| Area 0                       | Backbone area (all areas must connect to it)   |
| DR/BDR election              | Highest priority, then highest Router ID       |
| Default priority             | 1 (0 = will not participate in election)       |

### OSPF Cost Calculation

```
Cost = Reference Bandwidth / Interface Bandwidth

Default Reference Bandwidth = 100 Mbps

Examples:
  10 Mbps Ethernet:    100 / 10   = 10
  100 Mbps FastEthernet: 100 / 100 = 1
  1 Gbps GigabitEthernet: 100 / 1000 = 1 (problem! -- increase reference BW)
  10 Gbps:             100 / 10000  = 1 (same problem)

Recommendation: Set reference bandwidth to 100000 (100 Gbps):
  router ospf 1
    auto-cost reference-bandwidth 100000
```

### EIGRP Quick Reference

| Parameter                    | Value / Details                                |
|------------------------------|------------------------------------------------|
| Algorithm                    | DUAL (Diffusing Update Algorithm)              |
| Metric                       | Composite: bandwidth, delay, (reliability, load, MTU) |
| Protocol number              | 88                                             |
| Multicast address            | 224.0.0.10                                     |
| Hello timer (high-speed)     | 5 seconds                                      |
| Hold timer (high-speed)      | 15 seconds (3x hello)                          |
| Hello timer (low-speed)      | 60 seconds (T1 and below)                      |
| Hold timer (low-speed)       | 180 seconds (3x hello)                         |
| Administrative distance      | 90 (internal), 170 (external), 5 (summary)    |
| Maximum hop count            | 255 (default 100)                              |
| Load balancing               | Equal-cost (default), Unequal-cost (variance)  |

### BGP Quick Reference

| Parameter                    | Value / Details                                |
|------------------------------|------------------------------------------------|
| Algorithm                    | Best path selection (multiple attributes)      |
| Type                         | Path vector protocol                           |
| Port                         | TCP 179                                        |
| Administrative distance      | 20 (eBGP), 200 (iBGP)                         |
| Neighbour establishment      | Manual configuration (no auto-discovery)       |
| Session types                | eBGP (between ASes), iBGP (within AS)          |
| Keepalive timer              | 60 seconds                                     |
| Hold timer                   | 180 seconds                                    |
| Path selection order         | Weight > Local Preference > Originate > AS Path Length > Origin > MED > eBGP over iBGP > IGP Metric > Router ID |

---

## 9. Spanning Tree Protocol Reference

### STP Port States

| Port State    | Forwards Data? | Learns MACs? | Sends/Receives BPDUs? | Duration         |
|---------------|----------------|--------------|----------------------|------------------|
| Disabled      | No             | No           | No                   | Administrative   |
| Blocking      | No             | No           | Receives only        | 20 seconds (Max Age) |
| Listening     | No             | No           | Yes                  | 15 seconds (Fwd Delay) |
| Learning      | No             | Yes          | Yes                  | 15 seconds (Fwd Delay) |
| Forwarding    | Yes            | Yes          | Yes                  | Stable state     |

**Total convergence time (STP 802.1D):** 20 + 15 + 15 = 50 seconds (worst case)

### STP Timers

| Timer             | Default Value | Description                                      |
|-------------------|---------------|--------------------------------------------------|
| Hello Time        | 2 seconds     | Interval between BPDU transmissions by root      |
| Max Age           | 20 seconds    | Maximum age of a BPDU before discard             |
| Forward Delay     | 15 seconds    | Time spent in Listening and Learning states each |

### STP Variants

| Protocol      | Standard   | Convergence  | Instances            | Notes                         |
|---------------|------------|--------------|----------------------|-------------------------------|
| STP           | 802.1D     | 30-50 sec    | 1 (CST)              | Original, legacy              |
| PVST+         | Cisco      | 30-50 sec    | Per VLAN              | Cisco proprietary             |
| RSTP          | 802.1w     | 1-6 sec      | 1 (CST)              | Rapid convergence             |
| Rapid PVST+   | Cisco      | 1-6 sec      | Per VLAN              | Cisco proprietary, rapid      |
| MSTP          | 802.1s     | 1-6 sec      | Multiple (mapped)     | VLANs mapped to instances     |

### STP Port Roles

| Role            | Description                                              |
|-----------------|----------------------------------------------------------|
| Root Port       | Best path to root bridge (one per non-root switch)       |
| Designated Port | Best port on each segment toward root (forwards traffic) |
| Alternate Port  | Backup to root port (RSTP -- provides rapid failover)    |
| Backup Port     | Backup to designated port on shared segment (RSTP)       |
| Blocked Port    | Not forwarding (STP 802.1D)                              |

### Root Bridge Election

1. Lowest Bridge Priority wins (default 32768, configurable in increments of 4096)
2. If priority is tied, lowest MAC address wins
3. Bridge ID = Priority (4 bits) + Extended System ID/VLAN (12 bits) + MAC Address (48 bits)

**Setting root bridge:**
```
spanning-tree vlan <VLAN_ID> root primary      ! Sets priority to 24576 (or lower)
spanning-tree vlan <VLAN_ID> root secondary    ! Sets priority to 28672
spanning-tree vlan <VLAN_ID> priority <VALUE>  ! Manual priority (increments of 4096)
```

### PortFast and BPDU Guard

| Feature        | Command                                           | Purpose                                      |
|----------------|---------------------------------------------------|----------------------------------------------|
| PortFast       | `spanning-tree portfast`                          | Skip listening/learning, go straight to forwarding |
| PortFast (global) | `spanning-tree portfast default`              | Enable PortFast on all access ports          |
| BPDU Guard     | `spanning-tree bpduguard enable`                  | Err-disable port if BPDU is received         |
| BPDU Guard (global) | `spanning-tree portfast bpduguard default`  | Enable BPDU Guard on all PortFast ports      |
| Root Guard     | `spanning-tree guard root`                        | Prevent port from becoming root port         |
| Loop Guard     | `spanning-tree guard loop`                        | Prevent alternate/root port from transitioning to designated |

**Important:** PortFast should ONLY be enabled on access ports connected to end devices (PCs, printers, servers). Never enable on ports connecting to other switches.

---

## 10. Quick Reference Summary

### Subnetting Shortcuts

| If you need...          | Then...                                               |
|-------------------------|-------------------------------------------------------|
| Number of subnets       | 2^(borrowed bits)                                     |
| Hosts per subnet        | 2^(host bits) - 2                                     |
| Subnet mask from CIDR   | Set first N bits to 1, rest to 0                      |
| CIDR from subnet mask   | Count the consecutive 1-bits                          |
| Network address         | IP AND subnet mask (bitwise AND)                      |
| Broadcast address       | Network address OR wildcard mask (bitwise OR)         |
| Wildcard mask           | 255.255.255.255 - subnet mask                         |
| Next subnet             | Current network + magic number in interesting octet   |

### Binary-Decimal Quick Reference

| Binary     | Decimal |
|------------|---------|
| 10000000   | 128     |
| 11000000   | 192     |
| 11100000   | 224     |
| 11110000   | 240     |
| 11111000   | 248     |
| 11111100   | 252     |
| 11111110   | 254     |
| 11111111   | 255     |

### Exam Tips

1. **Memorise the powers of 2** from 2^0 to 2^16 at minimum
2. **Memorise the magic numbers:** 128, 64, 32, 16, 8, 4, 2, 1
3. **Always allocate largest subnets first** in VLSM problems
4. **Usable hosts = total - 2** (except /31 and /32)
5. **Network address** always has all host bits set to 0
6. **Broadcast address** always has all host bits set to 1
7. **Wildcard mask** is used in OSPF network statements and ACLs
8. **Practice, practice, practice** -- subnetting speed comes from repetition
9. **Double-check your work** by verifying that the broadcast of one subnet is one less than the network of the next
10. **On the exam:** write out the powers of 2 and magic numbers on your scratch paper immediately

---

**Document End**

*This document is the intellectual property of VantagePoint Networks. Unauthorised reproduction or distribution is prohibited.*

*VantagePoint Networks -- Study Guide Series*
