# CCNA

Notes and current progress on my CCNA studies.

# Jeremy's IT Lab: CCNA 200-301 Course Index

This index provides a comprehensive breakdown of the CCNA 200-301 complete course by Jeremy's IT Lab, including direct links to lectures, labs, and extra resources.

Playlist Link:[ Jeremy's IT Lab CCNA Playlist](https://www.google.com/search?q=https://www.youtube.com/playlist%3Flist%3DPLxbwE86jKRgMpuZuLBivzlM8s2Dk5lPyQ)

<div dir="ltr" id="bkmrk-day-topic-content-ty" style="text-align:left;"><table><colgroup><col style="width:71px;"></col><col style="width:239px;"></col><col style="width:109px;"></col><col style="width:92px;"></col><col style="width:71px;"></col></colgroup><tbody><tr><td>Day

</td><td>Topic

</td><td>Content Type

</td><td>Duration

</td><td>Link

</td></tr><tr><td>Day 1

</td><td>Network Devices

</td><td>Lecture

</td><td>30:26

</td><td>[Watch](https://www.youtube.com/watch?v=H8W9oMNSuwo)

</td></tr><tr><td>  
</td><td>Anki Flashcards

</td><td>Extra

</td><td>14:56

</td><td>[Watch](https://www.youtube.com/watch?v=6Atw8oMtVTA)

</td></tr><tr><td>  
</td><td>Packet Tracer Introduction

</td><td>Lab

</td><td>15:18

</td><td>[Watch](https://www.youtube.com/watch?v=a1Im6GYaSno)

</td></tr><tr><td>Day 2

</td><td>Interfaces and Cables

</td><td>Lecture

</td><td>35:52

</td><td>[Watch](https://www.youtube.com/watch?v=ieTH5lVhNaY)

</td></tr><tr><td>  
</td><td>Connecting Devices

</td><td>Lab

</td><td>5:33

</td><td>[Watch](https://www.youtube.com/watch?v=K6Qt23sY68Y)

</td></tr><tr><td>Day 3

</td><td>How the TCP/IP Model Actually Works

</td><td>Lecture

</td><td>42:42

</td><td>[Watch](https://www.youtube.com/watch?v=yM-XNq9ADlI)

</td></tr><tr><td>  
</td><td>OSI Model

</td><td>Lab

</td><td>8:05

</td><td>[Watch](https://www.youtube.com/watch?v=7nmYoL0t2tU)

</td></tr><tr><td>Day 4

</td><td>Intro to the CLI

</td><td>Lecture

</td><td>31:06

</td><td>[Watch](https://www.youtube.com/watch?v=IYbtai7Nu2g)

</td></tr><tr><td>  
</td><td>Basic Device Security

</td><td>Lab

</td><td>10:26

</td><td>[Watch](https://www.youtube.com/watch?v=SDocmq1c05s)

</td></tr><tr><td>Day 5

</td><td>Ethernet LAN Switching (Part 1)

</td><td>Lecture

</td><td>38:13

</td><td>[Watch](https://www.youtube.com/watch?v=u2n762WG0Vo)

</td></tr><tr><td>Day 6

</td><td>Ethernet LAN Switching (Part 2)

</td><td>Lecture

</td><td>33:41

</td><td>[Watch](https://www.youtube.com/watch?v=5q1pqdmdPjo)

</td></tr><tr><td>  
</td><td>Analyzing Ethernet Switching

</td><td>Lab

</td><td>10:29

</td><td>[Watch](https://www.youtube.com/watch?v=Ig0dSaOQDI8)

</td></tr><tr><td>Day 7

</td><td>IPv4 Addressing (Part 1)

</td><td>Lecture

</td><td>40:21

</td><td>[Watch](https://www.youtube.com/watch?v=3ROdsfEUuhs)

</td></tr><tr><td>Day 8

</td><td>IPv4 Addressing (Part 2)

</td><td>Lecture

</td><td>30:42

</td><td>[Watch](https://www.youtube.com/watch?v=FiAatRd84XI)

</td></tr><tr><td>  
</td><td>Configuring IP Addresses

</td><td>Lab

</td><td>10:06

</td><td>[Watch](https://www.youtube.com/watch?v=e1jbvyMeS5I)

</td></tr><tr><td>Day 9

</td><td>Switch Interfaces

</td><td>Lecture

</td><td>32:28

</td><td>[Watch](https://www.youtube.com/watch?v=cCqluocfQe0)

</td></tr><tr><td>  
</td><td>Configuring Interfaces

</td><td>Lab

</td><td>11:54

</td><td>[Watch](https://www.youtube.com/watch?v=rzDb5DoBKRk)

</td></tr><tr><td>Day 10

</td><td>IPv4 Header

</td><td>Lecture

</td><td>30:11

</td><td>[Watch](https://www.youtube.com/watch?v=aQB22y4liXA)

</td></tr><tr><td>Day 11

</td><td>Routing Fundamentals (Part 1)

</td><td>Lecture

</td><td>31:00

</td><td>[Watch](https://www.youtube.com/watch?v=aHwAm8GYbn8)

</td></tr><tr><td>  
</td><td>Static Routing (Part 2)

</td><td>Lecture

</td><td>37:44

</td><td>[Watch](https://www.youtube.com/watch?v=YCv4-_sMvYE)

</td></tr><tr><td>  
</td><td>Configuring Static Routes

</td><td>Lab 1

</td><td>12:29

</td><td>[Watch](https://www.youtube.com/watch?v=XHxOtIav2k8)

</td></tr><tr><td>  
</td><td>Troubleshooting Static Routes

</td><td>Lab 2

</td><td>9:45

</td><td>[Watch](https://www.youtube.com/watch?v=3z8YGEVFTiA)

</td></tr><tr><td>Day 12

</td><td>The Life of a Packet

</td><td>Lecture

</td><td>20:13

</td><td>[Watch](https://www.youtube.com/watch?v=4YrYV2io3as)

</td></tr><tr><td>  
</td><td>Life of a Packet

</td><td>Lab

</td><td>15:36

</td><td>[Watch](https://www.youtube.com/watch?v=bfsEqDeHbpI)

</td></tr><tr><td>Day 13

</td><td>Subnetting (Part 1)

</td><td>Lecture

</td><td>28:54

</td><td>[Watch](https://www.youtube.com/watch?v=bQ8sdpGQu8c)

</td></tr><tr><td>Day 14

</td><td>Subnetting (Part 2)

</td><td>Lecture

</td><td>24:47

</td><td>[Watch](https://www.youtube.com/watch?v=IGhd-0di0Qo)

</td></tr><tr><td>Day 15

</td><td>Subnetting (Part 3 - VLSM)

</td><td>Lecture

</td><td>23:53

</td><td>[Watch](https://www.youtube.com/watch?v=z-JqCedc9EI)

</td></tr><tr><td>  
</td><td>Subnetting (VLSM)

</td><td>Lab

</td><td>14:59

</td><td>[Watch](https://www.youtube.com/watch?v=Rn_E1Qv8--I)

</td></tr><tr><td>Day 16

</td><td>VLANs (Part 1)

</td><td>Lecture

</td><td>23:45

</td><td>[Watch](https://www.youtube.com/watch?v=cjFzOnm6u1g)

</td></tr><tr><td>  
</td><td>VLANs (Part 1)

</td><td>Lab

</td><td>11:02

</td><td>[Watch](https://www.youtube.com/watch?v=-tq7f3xtyLQ)

</td></tr><tr><td>Day 17

</td><td>VLANs (Part 2)

</td><td>Lecture

</td><td>40:01

</td><td>[Watch](https://www.youtube.com/watch?v=Jl9OOzNaBDU)

</td></tr><tr><td>  
</td><td>VLANs (Part 2)

</td><td>Lab

</td><td>23:23

</td><td>[Watch](https://www.youtube.com/watch?v=iRkFE_lpYgc)

</td></tr><tr><td>Day 18

</td><td>VLANs (Part 3)

</td><td>Lecture

</td><td>32:32

</td><td>[Watch](https://www.youtube.com/watch?v=OkPB028l2eE)

</td></tr><tr><td>  
</td><td>VLANs (Part 3)

</td><td>Lab

</td><td>25:19

</td><td>[Watch](https://www.youtube.com/watch?v=MQcCr3QW1vE)

</td></tr><tr><td>Day 19

</td><td>DTP/VTP

</td><td>Lecture

</td><td>37:34

</td><td>[Watch](https://www.youtube.com/watch?v=JtQV_0Sjszg)

</td></tr><tr><td>  
</td><td>DTP/VTP

</td><td>Lab

</td><td>18:47

</td><td>[Watch](https://www.youtube.com/watch?v=ngTns2vF_44)

</td></tr><tr><td>Day 20

</td><td>Spanning Tree Protocol (Part 1)

</td><td>Lecture

</td><td>38:39

</td><td>[Watch](https://www.youtube.com/watch?v=j-bK-EFt9cY)

</td></tr><tr><td>  
</td><td>Analyzing STP

</td><td>Lab

</td><td>18:55

</td><td>[Watch](https://www.youtube.com/watch?v=Ev9gy7B5hx0)

</td></tr><tr><td>Day 21

</td><td>Spanning Tree Protocol (Part 2)

</td><td>Lecture

</td><td>42:18

</td><td>[Watch](https://www.youtube.com/watch?v=nWpldCc8msY)

</td></tr><tr><td>  
</td><td>PortFast (STP Toolkit)

</td><td>Lecture

</td><td>17:34

</td><td>[Watch](https://www.youtube.com/watch?v=zqzppl4LOwk)

</td></tr><tr><td>  
</td><td>BPDU Guard &amp; BPDU Filter

</td><td>Lecture

</td><td>24:24

</td><td>[Watch](https://www.youtube.com/watch?v=jfC_AeJnuhY)

</td></tr><tr><td>  
</td><td>Root Guard

</td><td>Lecture

</td><td>19:44

</td><td>[Watch](https://www.youtube.com/watch?v=2XE_PgkvSic)

</td></tr><tr><td>  
</td><td>Loop Guard

</td><td>Lecture

</td><td>18:49

</td><td>[Watch](https://www.youtube.com/watch?v=uJ5_Klha0ig)

</td></tr><tr><td>  
</td><td>Configuring STP (PVST+)

</td><td>Lab

</td><td>17:09

</td><td>[Watch](https://www.youtube.com/watch?v=5rpaeJNig2o)

</td></tr><tr><td>Day 22

</td><td>Rapid Spanning Tree Protocol

</td><td>Lecture

</td><td>43:01

</td><td>[Watch](https://www.youtube.com/watch?v=EpazNsLlPps)

</td></tr><tr><td>  
</td><td>Rapid STP

</td><td>Lab

</td><td>19:50

</td><td>[Watch](https://www.youtube.com/watch?v=YG7r4XHy2JU)

</td></tr><tr><td>Day 23

</td><td>EtherChannel

</td><td>Lecture

</td><td>41:33

</td><td>[Watch](https://www.youtube.com/watch?v=xuo69Joy_Nc)

</td></tr><tr><td>  
</td><td>Configuring EtherChannel

</td><td>Lab

</td><td>25:03

</td><td>[Watch](https://www.youtube.com/watch?v=8gKF2fMMjA8)

</td></tr><tr><td>Day 24

</td><td>Dynamic Routing

</td><td>Lecture

</td><td>44:38

</td><td>[Watch](https://www.youtube.com/watch?v=xSTgb8JLkvs)

</td></tr><tr><td>  
</td><td>Floating Static Routes

</td><td>Lab

</td><td>23:20

</td><td>[Watch](https://www.youtube.com/watch?v=KuKC0G3LZc8)

</td></tr><tr><td>Day 25

</td><td>RIP &amp; EIGRP

</td><td>Lecture

</td><td>43:42

</td><td>[Watch](https://www.youtube.com/watch?v=N8PiZDld6Zc)

</td></tr><tr><td>  
</td><td>Configuring EIGRP

</td><td>Lab

</td><td>26:14

</td><td>[Watch](https://www.youtube.com/watch?v=ffnJ5oBIObY)

</td></tr><tr><td>Day 26

</td><td>OSPF Part 1

</td><td>Lecture

</td><td>39:40

</td><td>[Watch](https://www.youtube.com/watch?v=pvuaoJ9YzoI)

</td></tr><tr><td>  
</td><td>Configuring OSPF (1)

</td><td>Lab

</td><td>22:07

</td><td>[Watch](https://www.youtube.com/watch?v=LeLRWjfylcs)

</td></tr><tr><td>Day 27

</td><td>OSPF Part 2

</td><td>Lecture

</td><td>36:55

</td><td>[Watch](https://www.youtube.com/watch?v=VtzfTA21ht0)

</td></tr><tr><td>  
</td><td>Configuring OSPF (2)

</td><td>Lab

</td><td>22:10

</td><td>[Watch](https://www.youtube.com/watch?v=UEyQW-EcnY8)

</td></tr><tr><td>Day 28

</td><td>OSPF Part 3

</td><td>Lecture

</td><td>47:53

</td><td>[Watch](https://www.youtube.com/watch?v=3ew26ujkiDI)

</td></tr><tr><td>  
</td><td>Configuring OSPF (3)

</td><td>Lab

</td><td>21:25

</td><td>[Watch](https://www.youtube.com/watch?v=Goekjm3bK5o)

</td></tr><tr><td>Day 29

</td><td>First Hop Redundancy Protocols (FHRP)

</td><td>Lecture

</td><td>40:25

</td><td>[Watch](https://www.youtube.com/watch?v=43WnpwQMolo)

</td></tr><tr><td>  
</td><td>Configuring HSRP

</td><td>Lab

</td><td>22:01

</td><td>[Watch](https://www.youtube.com/watch?v=uho5Z2nFhb8)

</td></tr><tr><td>Day 30

</td><td>TCP &amp; UDP

</td><td>Lecture

</td><td>33:59

</td><td>[Watch](https://www.youtube.com/watch?v=LIEACBqlntY)

</td></tr><tr><td>  
</td><td>Wireshark Demo (TCP/UDP)

</td><td>Lab

</td><td>11:15

</td><td>[Watch](https://www.youtube.com/watch?v=pJKFahkqMU8)

</td></tr><tr><td>Day 31

</td><td>IPv6 Part 1

</td><td>Lecture

</td><td>39:26

</td><td>[Watch](https://www.youtube.com/watch?v=ZNuXyOXae5U)

</td></tr><tr><td>  
</td><td>Configuring IPv6 (Part 1)

</td><td>Lab

</td><td>18:02

</td><td>[Watch](https://www.youtube.com/watch?v=BdsIahtrWIA)

</td></tr><tr><td>Day 32

</td><td>IPv6 Part 2

</td><td>Lecture

</td><td>39:33

</td><td>[Watch](https://www.youtube.com/watch?v=BrTMMOXFhDU)

</td></tr><tr><td>  
</td><td>Configuring IPv6 (Part 2)

</td><td>Lab

</td><td>21:02

</td><td>[Watch](https://www.youtube.com/watch?v=Zfhpd7dl6QI)

</td></tr><tr><td>Day 33

</td><td>IPv6 Part 3

</td><td>Lecture

</td><td>43:50

</td><td>[Watch](https://www.youtube.com/watch?v=rwkHfsWQwy8)

</td></tr><tr><td>  
</td><td>Configuring IPv6 (Part 3)

</td><td>Lab

</td><td>19:17

</td><td>[Watch](https://www.youtube.com/watch?v=WSBEVFANMmc)

</td></tr><tr><td>Day 34

</td><td>Standard ACLs

</td><td>Lecture

</td><td>46:51

</td><td>[Watch](https://www.youtube.com/watch?v=z023_eRUtSo)

</td></tr><tr><td>  
</td><td>Standard ACLs

</td><td>Lab

</td><td>27:01

</td><td>[Watch](https://www.youtube.com/watch?v=sJ8PXmiAkvs)

</td></tr><tr><td>Day 35

</td><td>Extended ACLs

</td><td>Lecture

</td><td>40:55

</td><td>[Watch](https://www.youtube.com/watch?v=dUttKY_CNXE)

</td></tr><tr><td>  
</td><td>Extended ACLs

</td><td>Lab

</td><td>22:08

</td><td>[Watch](https://www.youtube.com/watch?v=1cuMzWBrEYs)

</td></tr><tr><td>Day 36

</td><td>CDP &amp; LLDP

</td><td>Lecture

</td><td>39:23

</td><td>[Watch](https://www.youtube.com/watch?v=_hnMZBzXRRk)

</td></tr><tr><td>  
</td><td>CDP &amp; LLDP

</td><td>Lab

</td><td>24:37

</td><td>[Watch](https://www.youtube.com/watch?v=4s8qqL7R9W8)

</td></tr><tr><td>Day 37

</td><td>NTP

</td><td>Lecture

</td><td>42:46

</td><td>[Watch](https://www.youtube.com/watch?v=qGJaJx7OfUo)

</td></tr><tr><td>  
</td><td>NTP

</td><td>Lab

</td><td>19:08

</td><td>[Watch](https://www.youtube.com/watch?v=Miys7Ft9wWI)

</td></tr><tr><td>Day 38

</td><td>DNS

</td><td>Lecture

</td><td>30:11

</td><td>[Watch](https://www.youtube.com/watch?v=4C6eeQes4cs)

</td></tr><tr><td>  
</td><td>DNS

</td><td>Lab

</td><td>17:31

</td><td>[Watch](https://www.youtube.com/watch?v=7D_FapNrRUM)

</td></tr><tr><td>Day 39

</td><td>DHCP

</td><td>Lecture

</td><td>37:02

</td><td>[Watch](https://www.youtube.com/watch?v=hzkleGAC2_Y)

</td></tr><tr><td>  
</td><td>DHCP

</td><td>Lab

</td><td>17:49

</td><td>[Watch](https://www.youtube.com/watch?v=cgMsoIQB9Wk)

</td></tr><tr><td>Day 40

</td><td>SNMP

</td><td>Lecture

</td><td>29:21

</td><td>[Watch](https://www.youtube.com/watch?v=HXu0Ifj0oWU)

</td></tr><tr><td>  
</td><td>SNMP

</td><td>Lab

</td><td>13:37

</td><td>[Watch](https://www.youtube.com/watch?v=v8WxIytUdS4)

</td></tr><tr><td>Day 41

</td><td>Syslog

</td><td>Lecture

</td><td>27:58

</td><td>[Watch](https://www.youtube.com/watch?v=RaQPSKQ4J5A)

</td></tr><tr><td>  
</td><td>Syslog

</td><td>Lab

</td><td>14:03

</td><td>[Watch](https://www.youtube.com/watch?v=-R_CYM6Wm-Y)

</td></tr><tr><td>Day 42

</td><td>SSH

</td><td>Lecture

</td><td>31:07

</td><td>[Watch](https://www.youtube.com/watch?v=AvgYqI2qSD4)

</td></tr><tr><td>  
</td><td>SSH

</td><td>Lab

</td><td>15:50

</td><td>[Watch](https://www.youtube.com/watch?v=QnHq7iCOtTc)

</td></tr><tr><td>Day 43

</td><td>FTP &amp; TFTP

</td><td>Lecture

</td><td>30:55

</td><td>[Watch](https://www.youtube.com/watch?v=50hcfsoBf4Q)

</td></tr><tr><td>  
</td><td>FTP &amp; TFTP

</td><td>Lab

</td><td>15:36

</td><td>[Watch](https://www.youtube.com/watch?v=W9PLvA2wZ28)

</td></tr><tr><td>Day 44

</td><td>NAT (Part 1)

</td><td>Lecture

</td><td>32:10

</td><td>[Watch](https://www.youtube.com/watch?v=2TZCfTgopeg)

</td></tr><tr><td>  
</td><td>Static NAT

</td><td>Lab

</td><td>14:12

</td><td>[Watch](https://www.youtube.com/watch?v=vir6n_NVZFw)

</td></tr><tr><td>Day 45

</td><td>NAT (Part 2)

</td><td>Lecture

</td><td>29:40

</td><td>[Watch](https://www.youtube.com/watch?v=kILDNs4KjYE)

</td></tr><tr><td>  
</td><td>Dynamic NAT

</td><td>Lab

</td><td>15:01

</td><td>[Watch](https://www.youtube.com/watch?v=vNs1xxiwGJs)

</td></tr><tr><td>Day 46

</td><td>QoS (Part 1)

</td><td>Lecture

</td><td>32:33

</td><td>[Watch](https://www.youtube.com/watch?v=H6FKJMiiL6E)

</td></tr><tr><td>  
</td><td>Voice VLANs

</td><td>Lab

</td><td>20:18

</td><td>[Watch](https://www.youtube.com/watch?v=kGX76QNIjsE)

</td></tr><tr><td>Day 47

</td><td>QoS (Part 2)

</td><td>Lecture

</td><td>41:46

</td><td>[Watch](https://www.youtube.com/watch?v=4vurfhVjcMM)

</td></tr><tr><td>  
</td><td>QoS

</td><td>Lab

</td><td>15:41

</td><td>[Watch](https://www.youtube.com/watch?v=63tD4t8189k)

</td></tr><tr><td>Day 48

</td><td>Security Fundamentals

</td><td>Lecture

</td><td>38:40

</td><td>[Watch](https://www.youtube.com/watch?v=VvFuieyTTSw)

</td></tr><tr><td>  
</td><td>Kali Linux Demo

</td><td>Lab

</td><td>10:25

</td><td>[Watch](https://www.youtube.com/watch?v=EBs47-0ZD-A)

</td></tr><tr><td>Day 49

</td><td>Port Security

</td><td>Lecture

</td><td>34:28

</td><td>[Watch](https://www.youtube.com/watch?v=sHN3jOJIido)

</td></tr><tr><td>  
</td><td>Port Security

</td><td>Lab

</td><td>17:03

</td><td>[Watch](https://www.youtube.com/watch?v=zZwhrxKeGj8)

</td></tr><tr><td>Day 50

</td><td>DHCP Snooping

</td><td>Lecture

</td><td>28:23

</td><td>[Watch](https://www.youtube.com/watch?v=qYYeg2kz1yE)

</td></tr><tr><td>  
</td><td>DHCP Snooping

</td><td>Lab

</td><td>15:41

</td><td>[Watch](https://www.youtube.com/watch?v=YMom_e545H4)

</td></tr><tr><td>Day 51

</td><td>Dynamic ARP Inspection

</td><td>Lecture

</td><td>32:50

</td><td>[Watch](https://www.youtube.com/watch?v=HwbTKaIvL6s)

</td></tr><tr><td>  
</td><td>Dynamic ARP Inspection

</td><td>Lab

</td><td>20:53

</td><td>[Watch](https://www.youtube.com/watch?v=oLF2mbmYMAk)

</td></tr><tr><td>Day 52

</td><td>LAN Architectures

</td><td>Lecture

</td><td>28:06

</td><td>[Watch](https://www.youtube.com/watch?v=PvyEcLhmNBk)

</td></tr><tr><td>  
</td><td>STP &amp; FHRP Synchronization

</td><td>Lab

</td><td>19:11

</td><td>[Watch](https://www.youtube.com/watch?v=BgIEhyoETgU)

</td></tr><tr><td>Day 53

</td><td>WAN Architectures

</td><td>Lecture

</td><td>37:34

</td><td>[Watch](https://www.youtube.com/watch?v=BW3fQgdf4-w)

</td></tr><tr><td>  
</td><td>GRE Tunnels

</td><td>Lab

</td><td>22:04

</td><td>[Watch](https://www.youtube.com/watch?v=_MMuU5viinM)

</td></tr><tr><td>Day 54

</td><td>Virtualization &amp; Cloud (Part 1)

</td><td>Lecture

</td><td>38:41

</td><td>[Watch](https://www.youtube.com/watch?v=_S3greGajJA)

</td></tr><tr><td>  
</td><td>Containers (Part 2)

</td><td>Lecture

</td><td>13:33

</td><td>[Watch](https://www.youtube.com/watch?v=K731pAS22Aw)

</td></tr><tr><td>  
</td><td>VRF (Part 3)

</td><td>Lecture

</td><td>18:03

</td><td>[Watch](https://www.youtube.com/watch?v=Ge4644KUvh4)

</td></tr><tr><td>  
</td><td>Oracle VirtualBox

</td><td>Lab

</td><td>8:43

</td><td>[Watch](https://www.youtube.com/watch?v=swqADfQk2jM)

</td></tr><tr><td>Day 55

</td><td>Wireless Fundamentals

</td><td>Lecture

</td><td>35:57

</td><td>[Watch](https://www.youtube.com/watch?v=zuYiktLqNYQ)

</td></tr><tr><td>Day 56

</td><td>Wireless Architectures

</td><td>Lecture

</td><td>38:21

</td><td>[Watch](https://www.youtube.com/watch?v=uX1h0F6wpBY)

</td></tr><tr><td>Day 57

</td><td>Wireless Security

</td><td>Lecture

</td><td>33:53

</td><td>[Watch](https://www.youtube.com/watch?v=wHXKo9So5y8)

</td></tr><tr><td>Day 58

</td><td>Wireless Configuration

</td><td>Lecture

</td><td>46:38

</td><td>[Watch](https://www.youtube.com/watch?v=r9o6GFI87go)

</td></tr><tr><td>  
</td><td>Wireless LANs

</td><td>Lab

</td><td>17:28

</td><td>[Watch](https://www.youtube.com/watch?v=Il8ev78fcqw)

</td></tr><tr><td>Day 59

</td><td>Intro to Network Automation (Part 1)

</td><td>Lecture

</td><td>33:27

</td><td>[Watch](https://www.youtube.com/watch?v=4tsBgMCPVuc)

</td></tr><tr><td>  
</td><td>AI &amp; Machine Learning (Part 2)

</td><td>Lecture

</td><td>41:49

</td><td>[Watch](https://www.youtube.com/watch?v=Fn_kAv35W5A)

</td></tr><tr><td>Day 60

</td><td>JSON, XML, &amp; YAML

</td><td>Lecture

</td><td>28:56

</td><td>[Watch](https://www.youtube.com/watch?v=nohde2-QNJ4)

</td></tr><tr><td>Day 61

</td><td>REST APIs (Part 1)

</td><td>Lecture

</td><td>31:45

</td><td>[Watch](https://www.youtube.com/watch?v=Luei0p-2h10)

</td></tr><tr><td>  
</td><td>REST API Authentication (Part 2)

</td><td>Lecture

</td><td>29:15

</td><td>[Watch](https://www.youtube.com/watch?v=bmqr_xpt6sc)

</td></tr><tr><td>Day 62

</td><td>Software-Defined Networking

</td><td>Lecture

</td><td>28:19

</td><td>[Watch](https://www.youtube.com/watch?v=7HhWCeXDTpA)

</td></tr><tr><td>Day 63

</td><td>Ansible, Puppet, &amp; Chef (Part 1)

</td><td>Lecture

</td><td>21:33

</td><td>[Watch](https://www.youtube.com/watch?v=Kog9gHTjALI)

</td></tr><tr><td>  
</td><td>Terraform (Part 2)

</td><td>Lecture

</td><td>22:29

</td><td>[Watch](https://www.youtube.com/watch?v=VAwUaffejWU)

</td></tr><tr><td>Final

</td><td>CCNA Mega Lab!

</td><td>Lab

</td><td>2:38:50

</td><td>[Watch](https://www.youtube.com/watch?v=2p7-MluKAgE)

</td></tr></tbody></table>

</div>

# Day 1: Network Devices and Fundamentals

# Networking Fundamentals

## Core Concepts

### What is a Network?

A network is a digital telecommunications system that allows nodes (devices) to share resources and communicate with each other.

### Device Roles

Client

- A device that accesses services or resources provided by another device
- Initiates requests to servers

Server

- A device that provides services, functions, or resources to client devices
- Responds to client requests

Note: Devices are not inherently "client" or "server"—the same device can fulfill either role depending on the context. Example: In a peer-to-peer (P2P) network, all devices act as both clients and servers.

---

## Network Devices by Function

### Switches (OSI Layer 2)

Purpose: Connect devices within a single LAN

Key Characteristics:

- Multiple network ports/interfaces for connecting end hosts
- Operate at Layer 2 (Data Link Layer) of the OSI model
- Enable device-to-device communication on the same local network
- Forward frames based on MAC addresses

What they do NOT do:

- Provide connectivity between different LANs
- Route traffic over the Internet
- Connect networks to the wider world

---

### Routers (OSI Layer 3)

Purpose: Connect multiple networks and route traffic between them

Key Characteristics:

- Fewer network interfaces than switches
- Operate at Layer 3 (Network Layer) of the OSI model
- Forward packets between LANs using IP addresses
- Enable communication across the Internet
- Can connect local networks to ISP networks

---

### Firewalls (OSI Layers 3–7)

Purpose: Control and monitor network traffic to enforce security policies

Key Characteristics:

- Specialty network security devices that filter traffic entering and exiting a network
- Operate at multiple OSI layers depending on filtering sophistication
- Monitor and enforce rules based on traffic patterns, protocols, and applications

Types:

Network-based Firewalls

- Dedicated hardware devices placed at network perimeter (inside or outside)
- Protect entire networks
- Examples: Cisco ASA, Palo Alto Networks, Fortinet FortiGate

Host-based Firewalls

- Software applications running on individual machines
- Protect only that specific device (e.g., Windows Defender Firewall, macOS firewall)
- Examples: Personal computers, servers

Next-Generation Firewalls (NGFW)

- Enhanced firewalls with advanced filtering capabilities
- Include features like:
    
    
    - Application-layer awareness
    - Intrusion prevention
    - Deep packet inspection
    - User/identity-based policies

---

## Summary Table

<div dir="ltr" id="bkmrk-device-osi-layer-pri" style="text-align:left;"><table><colgroup><col style="width:68px;"></col><col style="width:87px;"></col><col style="width:199px;"></col><col style="width:167px;"></col></colgroup><tbody><tr><td>Device

</td><td>OSI Layer

</td><td>Primary Function

</td><td>Scope

</td></tr><tr><td>Switch

</td><td>Layer 2

</td><td>Connect hosts on same LAN

</td><td>Single LAN

</td></tr><tr><td>Router

</td><td>Layer 3

</td><td>Connect different networks

</td><td>Multiple LANs/Internet

</td></tr><tr><td>Firewall

</td><td>Layers 3–7

</td><td>Control traffic via rules

</td><td>Network or host level

</td></tr></tbody></table>

</div>#   
  
  

# Day 2: Interfaces and Cables

# Interfaces and Cables

## Overview

Switches provide multiple ports for device connectivity—typically 24 ports on a standard switch.

These ports are RJ-45 (Registered Jack) connectors, the standard connection point for network devices.

---

## Ethernet: The Standard

### What is Ethernet?

Ethernet is a collection of standardized network protocols and hardware specifications that define how devices communicate over wired networks.

### Why Standards Matter

Network protocols and standards serve two critical purposes:

1. Communication standards — Enable devices from different manufacturers to communicate reliably
2. Hardware standards — Ensure physical compatibility between devices and cables

### Speed and Measurement

Connections between devices operate at specific speeds, measured in bits per second (bps).

- Bit = a single value: 0 or 1
- Byte = 8 bits

Speed Conversions:

<div dir="ltr" id="bkmrk-unit-bits-1-kilobit-" style="text-align:left;"><table><colgroup><col style="width:115px;"></col><col style="width:135px;"></col></colgroup><tbody><tr><td>Unit

</td><td>Bits

</td></tr><tr><td>1 kilobit (Kb)

</td><td>1,000

</td></tr><tr><td>1 megabit (Mb)

</td><td>1,000,000

</td></tr><tr><td>1 gigabit (Gb)

</td><td>1,000,000,000

</td></tr><tr><td>1 terabit (Tb)

</td><td>1,000,000,000,000

</td></tr></tbody></table>

</div>### Ethernet Standards

- Defined: IEEE 802.3 standard (established 1983)
- IEEE = Institute of Electrical and Electronics Engineers

---

## Copper Ethernet Cables (UTP)

### Ethernet Standards by Speed

<div dir="ltr" id="bkmrk-speed-common-name-st" style="text-align:left;"><table><colgroup><col style="width:79px;"></col><col style="width:141px;"></col><col style="width:79px;"></col><col style="width:103px;"></col><col style="width:109px;"></col></colgroup><tbody><tr><td>Speed

</td><td>Common Name

</td><td>Standard

</td><td>Cable Type

</td><td>Max Distance

</td></tr><tr><td>10 Mbps

</td><td>Ethernet

</td><td>802.3i

</td><td>10BASE-T

</td><td>100m

</td></tr><tr><td>100 Mbps

</td><td>Fast Ethernet

</td><td>802.3u

</td><td>100BASE-T

</td><td>100m

</td></tr><tr><td>1 Gbps

</td><td>Gigabit Ethernet

</td><td>802.3ab

</td><td>1000BASE-T

</td><td>100m

</td></tr><tr><td>10 Gbps

</td><td>10 Gigabit Ethernet

</td><td>802.3an

</td><td>10GBASE-T

</td><td>100m

</td></tr></tbody></table>

</div>Notation:

- BASE = Baseband Signaling (digital signal, single information channel)
- T = Twisted Pair (copper cable type)

### UTP Cables (Unshielded Twisted Pair)

What it is:

- Standard copper cabling for most Ethernet connections
- No metallic shield around the wires
- Contains twisted pairs of wires

Why twist the wires?

- The twisting protects against EMI (Electromagnetic Interference) from external sources
- Helps maintain signal integrity over distance

Wire Count by Speed:

- 10/100BASE-T: Uses 2 pairs (4 wires)
- 1000BASE-T / 10GBASE-T: Uses 4 pairs (8 wires)
    
    
    - All 4 pairs are bidirectional (can transmit and receive simultaneously)
    - This enables faster transmission than older standards

---

## Cable Pinout and Device Communication

### RJ-45 Connector Pin Layout

An RJ-45 plug has 8 pins numbered 1–8 at each end of the cable.

Devices use specific pins to transmit (TX) and receive (RX) data:

<div dir="ltr" id="bkmrk-device-type-tx-pins-" style="text-align:left;"><table><colgroup><col style="width:98px;"></col><col style="width:71px;"></col><col style="width:71px;"></col></colgroup><tbody><tr><td>Device Type

</td><td>TX Pins

</td><td>RX Pins

</td></tr><tr><td>Router

</td><td>1, 2

</td><td>3, 6

</td></tr><tr><td>Firewall

</td><td>1, 2

</td><td>3, 6

</td></tr><tr><td>PC

</td><td>1, 2

</td><td>3, 6

</td></tr><tr><td>Switch

</td><td>3, 6

</td><td>1, 2

</td></tr></tbody></table>

</div>### Full-Duplex Transmission

The pin arrangement enables full-duplex communication—devices can transmit and receive simultaneously because they use different pin pairs.

---

## Cable Types: Straight-Through vs. Crossover

### Straight-Through Cables

When to use:

- Connecting a PC or Router to a Switch
- Connecting a Firewall to a Switch
- Any device with TX on pins 1-2 to a device with RX on pins 1-2

Why it works:

- One end has pins arranged the same as the other end
- TX pins from one device connect to RX pins on the other device
- No pin swapping needed

### Crossover Cables

When to use:

- Connecting two similar devices directly (Router to Router, Switch to Switch, PC to PC)
- These devices have the same TX/RX pin configuration, so they would conflict with a straight-through cable

How it works:

- One end of the cable has pins swapped to create proper TX/RX alignment
- Pins are crossed: 1↔3, 2↔6, 3↔1, 6↔2

Crossover Pin Mapping:

End A → End B

PIN 1 → PIN 3

PIN 2 → PIN 6

PIN 3 → PIN 1

PIN 6 → PIN 2

#   


### Auto MDI-X

Modern equipment simplifies this:

- Most switches, routers, and PCs now include Auto MDI-X capability
- Devices automatically detect the neighbor's transmit pins and adjust their receive pins accordingly
- Works with either straight-through or crossover cables
- Eliminates the need to manually choose cable type

---

## Fiber-Optic Cables

### When to Use Fiber

Fiber-optic cables are used for high-speed, long-distance connections between network devices.

Standard: IEEE 802.3ae (and 802.3z for 1 Gbps)

### SFP Transceiver

SFP (Small Form-Factor Pluggable):

- A module that allows fiber-optic cables to connect to switches and routers
- Separate TX and RX cables (unlike copper which uses the same cable for both directions)
- Removes the need for pin management—fiber uses dedicated paths for each direction

### Fiber Cable Structure

A fiber-optic cable has 4 main components:

1. Core (glass or plastic)
2. Cladding (surrounds and protects core)
3. Buffer (protective layer)
4. Jacket (outer protective sheath)

### Two Types of Fiber

#### Single-Mode Fiber

Characteristics:

- Narrower core than multimode
- Light enters at a single angle (mode) using a laser-based transmitter
- Allows the longest cable distances of all Ethernet media
- More expensive (laser-based SFP transmitters are costly)

Use case: Long-distance backbone connections between buildings or data centers

#### Multimode Fiber

Characteristics:

- Wider core than single-mode
- Light enters at multiple angles (modes) using an LED-based transmitter
- Allows longer distances than UTP, but shorter than single-mode
- Less expensive than single-mode (LED-based transmitters are cheaper)

Use case: Medium-distance connections within a data center or building

### Fiber-Optic Standards

<div dir="ltr" id="bkmrk-standard-speed-mode-" style="text-align:left;"><table><colgroup><col style="width:115px;"></col><col style="width:69px;"></col><col style="width:139px;"></col><col style="width:173px;"></col></colgroup><tbody><tr><td>Standard

</td><td>Speed

</td><td>Mode

</td><td>Max Distance

</td></tr><tr><td>1000BASE-LX

</td><td>1 Gbps

</td><td>Multimode / Single

</td><td>550m (MM) / 5km (SM)

</td></tr><tr><td>10GBASE-SR

</td><td>10 Gbps

</td><td>Multimode

</td><td>400m

</td></tr><tr><td>10GBASE-LR

</td><td>10 Gbps

</td><td>Single

</td><td>10km

</td></tr><tr><td>10GBASE-ER

</td><td>10 Gbps

</td><td>Single

</td><td>30km

</td></tr></tbody></table>

</div>---

## UTP vs. Fiber-Optic: Comparison

### UTP (Unshielded Twisted Pair)

Advantages:

- Lower cost
- RJ-45 ports are inexpensive
- Simple to install and terminate

Disadvantages:

- Maximum distance: ~100m
- Vulnerable to EMI (Electromagnetic Interference)
- Security risk: Cables emit a faint signal that can be intercepted or copied
- Not suitable for long distances

### Fiber-Optic

Advantages:

- Longer maximum distances (hundreds of meters to tens of kilometers)
- No vulnerability to EMI
- More secure: Signals cannot leak from the cable; no risk of interception
- Suitable for long-distance and high-security applications

Disadvantages:

- Higher cost than UTP
- SFP ports are more expensive than RJ-45 ports
- Single-mode fiber is significantly more expensive than multimode
- Requires specialized installation and termination tools
- More fragile (fiber can break if bent too sharply)

---

## Quick Reference: When to Use What

<div dir="ltr" id="bkmrk-situation-media-reas" style="text-align:left;"><table><colgroup><col style="width:232px;"></col><col style="width:94px;"></col><col style="width:298px;"></col></colgroup><tbody><tr><td>Situation

</td><td>Media

</td><td>Reason

</td></tr><tr><td>PC to Switch (same building)

</td><td>UTP

</td><td>Cost-effective, sufficient distance

</td></tr><tr><td>Switch to Switch (same building)

</td><td>UTP or Fiber

</td><td>UTP for short runs; Fiber for long runs or security

</td></tr><tr><td>Router to Router (different buildings)

</td><td>Fiber

</td><td>Longer distances, EMI immunity

</td></tr><tr><td>Data center backbone

</td><td>Fiber

</td><td>Long distances, high throughput, security

</td></tr><tr><td>Home/office network

</td><td>UTP

</td><td>Cost, simplicity, Auto MDI-X

</td></tr></tbody></table>

</div>

# Day 3: OSI Model and TCP/IP Suite

# OSI Model &amp; TCP/IP Suite

## Networking Models: Overview

A networking model categorizes and provides structure for networking protocols and standards.

Protocol = A set of logical rules defining how network devices and software communicate and function.

Networking models help engineers understand which layer is responsible for which functions, making troubleshooting and design much easier.

---

## OSI Model

### What is the OSI Model?

OSI = Open Systems Interconnection Model

- Conceptual model created by ISO (International Organization for Standardization)
- Standardizes different functions in a network across 7 layers
- Purpose: Provide a reference framework for understanding how networks operate
- These 7 layers work together hierarchically to enable end-to-end communication

### Key Concept: Data Movement

As data moves through the layers, it follows two processes:

Encapsulation (Top → Bottom, Layers 7 → 1)

- Data travels DOWN the OSI stack
- Each layer adds its own header/trailer to the data
- Headers contain layer-specific information needed for that layer's function
- Happens at the sender's device

De-encapsulation (Bottom → Top, Layers 1 → 7)

- Data travels UP the OSI stack
- Each layer removes (strips) its header/trailer
- Extracts the information needed at that layer
- Happens at the receiver's device

### Key Concept: Layer Interactions

Adjacent-Layer Interaction

- Communication between different layers on the same device
- Example: Layer 5 sends data to Layer 4, Layer 4 adds header and sends to Layer 3

Same-Layer Interaction

- Communication between the same layer on different devices
- Example: The HTTP layer (Layer 7) on your PC browser talks to HTTP layer on a web server
- You can analyze one layer's interaction in isolation, ignoring what other layers do

---

## The 7 Layers of the OSI Model

### Layer 7 - APPLICATION

What it does:

- Closest to the end user
- Interacts directly with user applications and software
- Provides services that enable network communication for applications

Key Functions:

- Identifying and locating communication partners
- Synchronizing communication between applications
- Providing user-visible network services

Common Layer 7 Protocols:

- HTTP / HTTPS (web browsing)
- FTP (file transfer)
- SMTP / POP3 (email)
- DNS (domain name resolution)
- Telnet / SSH (remote login)

Who uses it: Application developers and end users

---

### Layer 6 - PRESENTATION

What it does:

- Translates data into an appropriate format for transmission
- Converts between application format and network transmission format
- Handles data encryption, compression, and translation

Key Functions:

- Data formatting and conversion
- Encryption/Decryption of data
- Data compression
- Character encoding (ASCII, Unicode, etc.)

Who uses it: Application developers

---

### Layer 5 - SESSION

What it does:

- Controls "dialogues" (sessions) between communicating applications
- Manages the connection lifecycle between local and remote applications

Key Functions:

- Establishing connections
- Managing (maintaining) connections
- Terminating connections
- Dialog control and synchronization

Common Session Layer Examples:

- Remote Desktop Protocol (RDP)
- X Window System

Who uses it: Application developers

---

### ⚠️ Important Note: Top 3 Layers

Network engineers rarely work directly with Layers 5-7.

These layers are the domain of application developers who design software to use networks. When troubleshooting network issues, most work happens at Layers 1-4.

---

### Layer 4 - TRANSPORT

What it does:

- Segments (breaks up) and reassembles data for communication between end hosts
- Provides HOST-TO-HOST (end-to-end) communication

Why segmentation matters:

- Large pieces of data are broken into smaller segments
- Smaller segments are easier to send across the network
- If an error occurs, only the affected segment needs retransmission (not the entire message)

Key Protocols:

- TCP (Transmission Control Protocol) — reliable, connection-oriented
- UDP (User Datagram Protocol) — fast, connectionless

PDU (Protocol Data Unit) at Layer 4:

- When Layer 7-5 data arrives at Layer 4, Layer 4 adds a Layer 4 Header
- Result: SEGMENT
- Format: \[DATA + L4 Header\]

Common Layer 4 Port Numbers (CCNA exam-relevant):

- TCP 80 (HTTP)
- TCP 443 (HTTPS)
- TCP 22 (SSH)
- UDP 53 (DNS)

---

### Layer 3 - NETWORK

What it does:

- Provides connectivity between different networks (outside the local LAN)
- Provides logical addressing using IP addresses (unlike Layer 2's MAC addresses)
- Performs path selection — determines the best route for data to travel from source to destination
- Works with routers to forward data between networks

Key Functions:

- IP addressing and routing
- Path selection using routing protocols
- Logical addressing (not physical)

Device operating at Layer 3:

- Routers — forward packets between networks based on IP addresses

PDU (Protocol Data Unit) at Layer 3:

- When Layer 4 header arrives at Layer 3, Layer 3 adds a Layer 3 Header
- Result: PACKET
- Format: \[DATA + L4 Header + L3 Header\]
- Contains: Source/destination IP addresses

Common Layer 3 Protocols:

- IP (IPv4, IPv6)
- ICMP (ping)
- IGMP

---

### Layer 2 - DATA LINK

What it does:

- Provides NODE-TO-NODE connectivity and data transfer
- Examples: PC to Switch, Switch to Router, Router to Router
- Defines how data is formatted for transmission over physical medium (e.g., UTP cables)
- Detects (and sometimes corrects) physical layer errors
- Uses Layer 2 addressing (MAC addresses) — separate from Layer 3 IP addresses

Key Functions:

- Node-to-node delivery
- Physical addressing (MAC addresses)
- Framing and error detection
- Media access control (determining who uses the network when)

Device operating at Layer 2:

- Switches — forward frames between ports based on MAC addresses

PDU (Protocol Data Unit) at Layer 2:

- When Layer 3 packet arrives at Layer 2, Layer 2 adds both a Header AND a Trailer
- Result: FRAME
- Format: \[L2 Header + DATA + L4 Header + L3 Header + L2 Trailer\]
- Contains: Source/destination MAC addresses

Common Layer 2 Protocols:

- Ethernet
- PPP (Point-to-Point Protocol)
- Frame Relay

---

### Layer 1 - PHYSICAL

What it does:

- Defines the physical characteristics of the network medium
- Converts digital bits into electrical or radio signals for transmission
- Receives signals and converts them back to digital bits

Key Functions:

- Physical medium specifications (copper, fiber, wireless)
- Voltage levels and signal timing
- Maximum transmission distances
- Physical connectors and cable specifications
- Bit transmission (0s and 1s)

Examples of Layer 1:

- RJ-45 connectors
- Ethernet cables (UTP, fiber-optic)
- Hub devices (simple repeaters)
- The actual wires and wireless frequencies

Related Reference:

- All content from your Networking Devices and Interfaces &amp; Cables notes is Layer 1 related

---

## OSI Model: PDU Summary

A PDU (Protocol Data Unit) is the formatted data at each layer of the OSI model. As data moves down the stack, each layer adds information to the PDU.

Encapsulation Process (Sender, Top to Bottom):

Layer 7-5: \[DATA\]

 ↓

Layer 4: \[DATA + L4 Header\] = SEGMENT

 ↓

Layer 3: \[DATA + L4 Header + L3 Header\] = PACKET

 ↓

Layer 2: \[L2 Header + DATA + L4 Header + L3 Header + L2 Trailer\] = FRAME

 ↓

Layer 1: Convert Frame to bits (0s and 1s) = BITS

#   


De-encapsulation Process (Receiver, Bottom to Top):

- Layer 1 converts bits to frame
- Layer 2 strips L2 header/trailer, checks for errors
- Layer 3 strips L3 header, checks IP address
- Layer 4 strips L4 header, hands data to upper layers
- Layers 5-7 process the original data

Quick Reference Table:

<div dir="ltr" id="bkmrk-osi-layer-pdu-name-h" style="text-align:left;"><table><colgroup><col style="width:87px;"></col><col style="width:92px;"></col><col style="width:179px;"></col><col style="width:181px;"></col></colgroup><tbody><tr><td>OSI Layer

</td><td>PDU Name

</td><td>Headers/Trailers Added

</td><td>Key Information

</td></tr><tr><td>7-5

</td><td>DATA

</td><td>None (origination)

</td><td>User data

</td></tr><tr><td>4

</td><td>SEGMENT

</td><td>Layer 4 Header

</td><td>Port numbers (TCP/UDP)

</td></tr><tr><td>3

</td><td>PACKET

</td><td>Layer 3 Header

</td><td>IP addresses

</td></tr><tr><td>2

</td><td>FRAME

</td><td>L2 Header + L2 Trailer

</td><td>MAC addresses

</td></tr><tr><td>1

</td><td>BITS

</td><td>None (transmission)

</td><td>0s and 1s

</td></tr></tbody></table>

</div>---

## TCP/IP Suite (Modern Model)

### What is TCP/IP?

TCP/IP Suite:

- Actual set of communications protocols used in the modern Internet and networks
- Named after two foundational protocols: TCP and IP
- Developed by U.S. Department of Defense through DARPA (Defense Advanced Research Projects Agency)
- This is the model actually deployed and in use today

### How is it Different from OSI?

Similarities:

- Both are layered models
- Both help organize network functions

Key Differences:

<div dir="ltr" id="bkmrk-aspect-osi-model-tcp" style="text-align:left;"><table><colgroup><col style="width:133px;"></col><col style="width:252px;"></col><col style="width:240px;"></col></colgroup><tbody><tr><td>Aspect

</td><td>OSI Model

</td><td>TCP/IP Model

</td></tr><tr><td>Layers

</td><td>7 layers

</td><td>4-5 layers (varies by source)

</td></tr><tr><td>Status

</td><td>Conceptual reference

</td><td>Practical, in-use model

</td></tr><tr><td>Development

</td><td>International standards body (ISO)

</td><td>U.S. Department of Defense (DARPA)

</td></tr><tr><td>Protocol specificity

</td><td>Generic, protocol-agnostic

</td><td>Built around TCP/IP protocols

</td></tr><tr><td>Use

</td><td>Teaching and troubleshooting framework

</td><td>Actual implementation

</td></tr></tbody></table>

</div>### TCP/IP Model Layers (Simplified)

Most commonly shown as 4 layers:

1. Application Layer (Layers 5-7 in OSI)
    
    
    - Protocols: HTTP, HTTPS, FTP, SMTP, DNS, SSH
2. Transport Layer (Layer 4 in OSI)
    
    
    - Protocols: TCP, UDP
3. Internet Layer (Layer 3 in OSI)
    
    
    - Protocols: IP, ICMP
4. Link Layer (Layers 1-2 in OSI)
    
    
    - Protocols: Ethernet, PPP
    - Physical medium and hardware

### OSI vs. TCP/IP: Why OSI Still Matters

Although TCP/IP is the working model:

- OSI model still influences how network engineers think and talk about networks
- CCNA exam heavily emphasizes OSI model concepts
- OSI's 7-layer breakdown is clearer for teaching individual functions
- Both models coexist in professional environments

---

## Quick Reference: Which Device Operates at Which Layer?

<div dir="ltr" id="bkmrk-device-osi-layer-fun" style="text-align:left;"><table><colgroup><col style="width:89px;"></col><col style="width:87px;"></col><col style="width:266px;"></col></colgroup><tbody><tr><td>Device

</td><td>OSI Layer

</td><td>Function

</td></tr><tr><td>Hub

</td><td>Layer 1

</td><td>Repeats signals

</td></tr><tr><td>Switch

</td><td>Layer 2

</td><td>Forwards frames by MAC address

</td></tr><tr><td>Router

</td><td>Layer 3

</td><td>Forwards packets by IP address

</td></tr><tr><td>Firewall

</td><td>Layer 3-7

</td><td>Filters traffic based on multiple criteria

</td></tr><tr><td>PC / Server

</td><td>Layers 1-7

</td><td>All layers

</td></tr></tbody></table>

</div>---

## Key Takeaways for CCNA

✅ Understand encapsulation/de-encapsulation — This is fundamental to how networks work

✅ Know what each layer does — Particularly Layers 1-4 for network engineers

✅ Understand PDU names — Segment, Packet, Frame, Bits (test questions often ask "what is this called?")

✅ Know device-to-layer mapping — Switches at Layer 2, Routers at Layer 3

✅ Understand adjacent vs. same-layer interaction — Helps with troubleshooting concepts

✅ TCP/IP is the real model — OSI is the teaching model; they're used together in practice

# Day 4: Introduction to the CLI

# Introduction to the CLI (Command Line Interface)

## Overview

The CLI (Command Line Interface) is the text-based interface used to configure Cisco network devices.

Contrast: A GUI (Graphical User Interface) is a visual, point-and-click interface—less common in Cisco device administration.

---

## Accessing the CLI: Physical Connection

### Console Port Connection

When you first configure a Cisco device, you must physically connect via the Console Port.

Cable Options:

- Rollover Cable (DB9 serial to RJ45)
    
    
    - Connects serial port on your computer to the RJ45 console port on the device
- USB Adapter (DB9 serial to USB)
    
    
    - For computers without a native serial port (most modern laptops)

### Terminal Emulator

To actually access the CLI after connecting the console cable:

1. Open a Terminal Emulator application on your PC
    
    
    - Popular choices: PuTTY, Cisco Packet Tracer, SecureCRT, Tera Term
2. Configure the connection as "Serial" with Cisco default settings (see below)

### Cisco Default Serial Settings

These are the standard configuration settings for console access to Cisco devices:

<div dir="ltr" id="bkmrk-setting-value-speed-" style="text-align:left;"><table><colgroup><col style="width:136px;"></col><col style="width:123px;"></col></colgroup><tbody><tr><td>Setting

</td><td>Value

</td></tr><tr><td>Speed (Baud Rate)

</td><td>9600 bits/second

</td></tr><tr><td>Data Bits

</td><td>8

</td></tr><tr><td>Stop Bits

</td><td>1

</td></tr><tr><td>Parity

</td><td>None

</td></tr><tr><td>Flow Control

</td><td>None

</td></tr></tbody></table>

</div>---

## Cisco CLI Modes

The CLI is organized into different modes, each with different capabilities and prompts.

### Mode 1: User EXEC Mode (User Mode)

How to enter: This is the default mode when you first connect to the device.

Prompt: Router&gt; (greater-than symbol)

Capabilities:

- Very limited access
- Can view some basic information about the device
- Cannot make ANY changes to the device configuration
- Read-only mode

Common User EXEC Commands:

- enable — Switch to Privileged EXEC mode
- ? — Display available commands
- help — Get help

### Mode 2: Privileged EXEC Mode

How to enter: Type enable from User EXEC mode (may require password)

Prompt: Router# (hash/pound symbol)

Capabilities:

- Full access to view device configuration
- Can restart the device
- Can save configuration files
- Can change the system clock/time
- Still cannot make configuration changes
- This mode is for "executing" commands, not entering configuration

Common Privileged EXEC Commands:

- configure terminal (or conf t) — Enter Global Configuration Mode
- show running-config — View current active configuration
- show startup-config — View configuration that loads on reboot
- write or write memory — Save running config to startup config
- exit — Go back to User EXEC mode

### Mode 3: Global Configuration Mode

How to enter: From Privileged EXEC mode, type configure terminal or conf t

Prompt: Router(config)# (the word "config" appears in the prompt)

Capabilities:

- Can make changes to the device configuration
- Enter commands that modify how the device operates
- Can set passwords, configure interfaces, enable services, etc.
- Changes made here affect the running configuration (active config)

How to exit: Type exit to return to Privileged EXEC mode

Important: Changes made in Global Configuration Mode are temporary—they affect the running configuration but are lost if the device restarts. You must save them (with write or copy running-config startup-config) to make them permanent.

---

## CLI Navigation Helpers

### Question Mark (?)

The ? key provides context-sensitive help at ANY time and in ANY mode.

Uses:

View all available commands in current mode:  
  
Router# ?

1. Lists every command available at this prompt level

View commands that start with a specific letter or prefix:  
  
Router(config)# conf ?

2. Lists all commands starting with "conf"

View required parameters for a command:  
  
Router# configure ?

3. Shows what parameters are needed to complete the configure command

Pro tip: This is one of the most important tools in Cisco CLI—always use ? when you're unsure what to do.

### TAB Key (Command Completion)

Press TAB to auto-complete a partially entered command.

How it works:

- Type the first few letters of a command
- Press TAB
- If the command is unambiguous (only one match), it auto-completes
- If multiple matches exist, nothing happens—add more letters to narrow it down

Example:

Router# conf&lt;TAB&gt; → Router# configure

Router# conf t&lt;TAB&gt; → Router# configure terminal

#   


---

## Configuration Files

Cisco devices maintain two separate configuration files at all times:

### Running Configuration (running-config)

- The current, active configuration on the device
- All commands you enter in the CLI edit this file in real-time
- If the device restarts, this configuration is lost (unless saved)
- Stored in RAM

### Startup Configuration (startup-config)

- The configuration file that loads when the device boots up
- Used to restore the device configuration after a restart
- Stored in NVRAM (non-volatile memory)
- Persists even if power is lost

### Viewing Configurations

From Privileged EXEC mode:

Router# show running-config (view current active config)

#   


Router# show startup-config (view config that will load on reboot)

#   


### Saving Configuration (Making Changes Permanent)

To copy the running-config to startup-config, use any of these equivalent commands from Privileged EXEC mode:

Router# write

#   


Router# write memory

#   


Router# copy running-config startup-config

Destination filename \[startup-config\]? &lt;ENTER&gt;

#   


All three commands accomplish the same thing—they save your changes so they survive a device restart.

---

## Passwords and Security

### Enable Password (Weak Encryption)

Purpose: Protects access to Privileged EXEC mode

Command (in Global Configuration Mode):

Router(config)# enable password (your-password)

#   


Encryption Level:

- Uses Type 7 encryption (Cisco proprietary)
- Weak encryption—easy to crack
- Passwords are visible as plaintext in the config file until encryption is enabled

Important: Passwords are case-sensitive.

### Enable Secret (Strong Encryption)

Purpose: Also protects access to Privileged EXEC mode (overrides enable password)

Command (in Global Configuration Mode):

Router(config)# enable secret (your-password)

#   


Encryption Level:

- Uses Type 5 encryption (MD5 hashing)
- Much stronger than Type 7
- Should always be used over enable password
- Passwords are always encrypted (even without service password-encryption)

Important Note: Once you set enable secret, it takes precedence over enable password. If both are configured, only enable secret is used.

### Service Password-Encryption

Purpose: Automatically encrypts all passwords in the configuration file

Command (in Global Configuration Mode):

Router(config)# service password-encryption

#   


What it does:

- Converts plaintext passwords (like enable password) to Type 7 encrypted format
- Future passwords entered will also be encrypted automatically
- Does NOT affect enable secret (which is always encrypted anyway)

What happens if you disable it:

Router(config)# no service password-encryption

#   


- Current encrypted passwords remain encrypted (won't be decrypted)
- Future passwords will not be encrypted
- enable secret is not affected

Encryption Type Reference:

<div dir="ltr" id="bkmrk-type-encryption-meth" style="text-align:left;"><table><colgroup><col style="width:48px;"></col><col style="width:150px;"></col><col style="width:74px;"></col><col style="width:283px;"></col></colgroup><tbody><tr><td>Type

</td><td>Encryption Method

</td><td>Strength

</td><td>Notes

</td></tr><tr><td>7

</td><td>Cisco Proprietary

</td><td>Weak

</td><td>Used by service password-encryption

</td></tr><tr><td>5

</td><td>MD5 Hash

</td><td>Strong

</td><td>Used by enable secret

</td></tr></tbody></table>

</div>---

## Modifying or Deleting Configuration Commands

### Using the "no" Keyword

To remove or disable any configuration command, prefix it with no:

Examples:

Router(config)# no enable password

(Removes the enable password entirely)

#   


Router(config)# no service password-encryption

(Disables automatic encryption of passwords)

#   


Router(config)# no enable secret

(Removes the enable secret)

#   


The no keyword is how you undo any configuration change in Cisco CLI.

---

## Practical Workflow: Initial Device Configuration

Here's a typical sequence for configuring a new device:

Router&gt; enable

(Enter Privileged EXEC Mode)

#   


Router# configure terminal

(Enter Global Configuration Mode)

#   


Router(config)# enable password mypassword

(Set weak password protection for privileged mode)

#   


Router(config)# enable secret mysecretpassword

(Set strong password protection for privileged mode)

#   


Router(config)# service password-encryption

(Encrypt plaintext passwords in config)

#   


Router(config)# exit

(Return to Privileged EXEC Mode)

#   


Router# write memory

(Save configuration to startup-config)

#   


Router# show running-config

(Verify your changes)

#   


---

## Key Takeaways for CCNA

✅ Know the three modes: User EXEC (&gt;), Privileged EXEC (#), Global Configuration (config#)

✅ Understand the two config files: running-config (active, temporary) and startup-config (saved, permanent)

✅ Use ? and TAB constantly — They're your best friends in the CLI

✅ Password security: Use enable secret (Type 5), not enable password (Type 7)

✅ Always save your work — Use write or copy running-config startup-config

✅ Use no to undo — It's the standard way to remove any configuration

✅ Case-sensitive — All CLI input, especially passwords, is case-sensitive

---

## Common Commands Quick Reference

<div dir="ltr" id="bkmrk-task-command-mode-sw" style="text-align:left;"><table><colgroup><col style="width:185px;"></col><col style="width:226px;"></col><col style="width:127px;"></col></colgroup><tbody><tr><td>Task

</td><td>Command

</td><td>Mode

</td></tr><tr><td>Switch to Privileged mode

</td><td>enable

</td><td>User EXEC

</td></tr><tr><td>Enter config mode

</td><td>configure terminal

</td><td>Privileged EXEC

</td></tr><tr><td>Exit current mode

</td><td>exit

</td><td>Any mode

</td></tr><tr><td>View all commands

</td><td>?

</td><td>Any mode

</td></tr><tr><td>View running config

</td><td>show running-config

</td><td>Privileged EXEC

</td></tr><tr><td>View startup config

</td><td>show startup-config

</td><td>Privileged EXEC

</td></tr><tr><td>Save config

</td><td>write or write memory

</td><td>Privileged EXEC

</td></tr><tr><td>Set weak password

</td><td>enable password (pass)

</td><td>Global Config

</td></tr><tr><td>Set strong password

</td><td>enable secret (pass)

</td><td>Global Config

</td></tr><tr><td>Enable auto-encryption

</td><td>service password-encryption

</td><td>Global Config

</td></tr><tr><td>Remove a command

</td><td>no (command)

</td><td>Global Config

</td></tr></tbody></table>

</div>

# Days 5, 6: Ethernet LAN Switching

# Ethernet LAN Switching

## Overview

LANs (Local Area Networks)

- A LAN is a network contained within a relatively small area (typically a single building or floor)
- Devices within the same LAN communicate directly using Ethernet (Layer 2)
- Routers are used to connect separate LANs together
- Switches provide connectivity to hosts within the same LAN

---

## Ethernet Frames

### Frame Structure

An Ethernet Frame is the Layer 2 Protocol Data Unit (PDU) that carries data across a LAN.

Overall Frame Structure:

\[Ethernet Header\] --- \[DATA / Packet\] --- \[Ethernet Trailer\]

#   


### Ethernet Header Fields

The Ethernet header contains 5 fields totaling 14 bytes (excluding Preamble and SFD):

<div dir="ltr" id="bkmrk-field-size-purpose-p" style="text-align:left;"><table><colgroup><col style="width:135px;"></col><col style="width:61px;"></col><col style="width:418px;"></col></colgroup><tbody><tr><td>Field

</td><td>Size

</td><td>Purpose

</td></tr><tr><td>Preamble

</td><td>7 bytes

</td><td>Synchronizes receiver clock (alternating 10101010 pattern)

</td></tr><tr><td>SFD

</td><td>1 byte

</td><td>Start Frame Delimiter (10101011) - marks start of actual frame

</td></tr><tr><td>Destination MAC

</td><td>6 bytes

</td><td>Layer 2 address of receiving device

</td></tr><tr><td>Source MAC

</td><td>6 bytes

</td><td>Layer 2 address of sending device

</td></tr><tr><td>Type/Length

</td><td>2 bytes

</td><td>Indicates protocol type OR data length

</td></tr></tbody></table>

</div>Note: The Preamble and SFD are typically not counted as part of the Ethernet header in frame size calculations.

#### Preamble (7 bytes)

- Pattern: 10101010 repeated 7 times (56 bits)
- Allows receiving devices to synchronize their clock with the sender
- Used for timing reference

#### SFD (Start Frame Delimiter) (1 byte)

- Value: 10101011 (8 bits)
- Marks the end of the Preamble and the beginning of the actual frame data
- Signals that important information follows

#### Destination and Source MAC Addresses (6 bytes each)

- MAC = Media Access Control
- Layer 2 physical address of the sending and receiving devices
- Burned-in address (BIA) assigned by manufacturer
- Globally unique (in theory)
- Written as 12 hexadecimal characters with colons or dots: E8:BA:70:11:28:74

MAC Address Structure:

- First 3 bytes (6 hex characters): OUI (Organizationally Unique Identifier)
    
    
    - Assigned to the manufacturer by IEEE
    - Identifies the company that made the device
    - Example: E8:BA:70 (Cisco)
- Last 3 bytes (6 hex characters): Unique device identifier
    
    
    - Assigned by the manufacturer to individual devices
    - Ensures no two devices from the same manufacturer have the same MAC address
    - Example: 11:28:74

#### Type/Length Field (2 bytes)

- Value of 1500 or less: Field indicates the LENGTH of the encapsulated data payload (in bytes)
- Value of 1536 or greater: Field indicates the TYPE of the encapsulated protocol

Common Layer 3 Protocol Types:

<div dir="ltr" id="bkmrk-protocol-hexadecimal" style="text-align:left;"><table><colgroup><col style="width:72px;"></col><col style="width:104px;"></col><col style="width:71px;"></col></colgroup><tbody><tr><td>Protocol

</td><td>Hexadecimal

</td><td>Decimal

</td></tr><tr><td>IPv4

</td><td>0x0800

</td><td>2048

</td></tr><tr><td>IPv6

</td><td>0x86DD

</td><td>34525

</td></tr><tr><td>ARP

</td><td>0x0806

</td><td>2054

</td></tr></tbody></table>

</div>### Ethernet Trailer

The Ethernet trailer contains 1 field:

FCS (Frame Check Sequence) - 4 bytes (32 bits)

- Detects corrupted data using a CRC (Cyclic Redundancy Check) algorithm
- Calculated over the entire received frame
- If calculated CRC doesn't match FCS, the frame is discarded as corrupted
- Receiver calculates CRC and compares it to the FCS value

### Frame Size Calculation

Total Ethernet Header + Trailer Size:

- Header: 6 + 6 + 2 = 14 bytes
- Trailer (FCS): 4 bytes
- Total: 18 bytes (not including Preamble + SFD, which add 8 more bytes)

Minimum Frame Size:

- Minimum Ethernet frame (including header + trailer): 64 bytes total
- Minimum data payload: 64 - 18 = 46 bytes

If payload &lt; 46 bytes:

- Padding bytes are added (series of 0x00 bytes) until the payload reaches 46 bytes
- Ensures the frame meets the 64-byte minimum

Maximum Frame Size:

- Standard Ethernet: 1518 bytes (includes header + trailer, excludes Preamble + SFD)
- Payload (without header/trailer): 1500 bytes (called the MTU - Maximum Transmission Unit)
- Jumbo Frames (optional): Up to 9000 bytes

---

## MAC Addressing Deep Dive

### Hexadecimal Numbering

MAC addresses are written in hexadecimal (base 16) instead of binary or decimal.

Hexadecimal:

- Uses digits 0-9 and letters A-F
- Each hexadecimal digit represents 4 bits
- Example: E8 in hex = 11101000 in binary = 232 in decimal

MAC Address Example Breakdown:

E8:BA:70:11:28:74

└─ OUI ─┘ └─ Device ID ─┘

#   


E8 BA 70 (Manufacturer) | 11 28 74 (Unique Device)

#   


### Dynamic vs. Static MAC Addresses

Dynamic MAC Learning (on Switches):

- Switches learn MAC addresses by examining the source MAC address of frames they receive
- When a frame arrives on an interface, the switch records: MAC Address | Interface | VLAN
- If a frame arrives with a source MAC not in the table, the switch adds it
- Dynamic entries are removed after 5 minutes of inactivity (idle timeout)

Static MAC Addresses:

- Manually configured by administrators for devices that shouldn't change ports
- Do not expire due to inactivity

---

## Switch Frame Forwarding

Switches make forwarding decisions based on the destination MAC address of received frames.

### Known Unicast Forwarding

When the destination MAC is in the switch's MAC address table:

1. Switch looks up the destination MAC address
2. Finds the interface associated with that MAC
3. Forwards the frame out only that specific interface
4. Frame does NOT go to other interfaces

Example:

- Frame arrives on port Fa0/1, destination MAC is in table pointing to Fa0/3
- Switch forwards only out Fa0/3

### Unknown Unicast Flooding

When the destination MAC is NOT in the switch's MAC address table (unknown):

1. Switch doesn't know where to send the frame
2. Floods the frame to ALL interfaces except the incoming port
3. Ensures the destination will receive the frame even if MAC isn't learned yet

Example:

- Frame arrives on Fa0/1 for an unknown destination MAC
- Switch forwards out Fa0/2, Fa0/3, Fa0/4, etc. (all except Fa0/1)
- One of those ports will eventually send back a reply, teaching the switch the MAC's location

### Broadcast Forwarding

Broadcast frames (destination MAC = FFFF.FFFF.FFFF):

- Always flooded to all interfaces except the incoming port
- Used for ARP, DHCP, and other network-wide communications

### MAC Address Table Maintenance Command

View the MAC address table:

Switch# show mac address-table

#   


Output shows:

- VLAN (Virtual LAN)
- MAC Address
- Type (DYNAMIC or STATIC)
- Port/Interface

Clear the MAC address table:

Switch# clear mac address-table dynamic

#   


Clear specific MAC entry:

Switch# clear mac address-table dynamic address E8BA.7011.2874

#   


Clear MAC entries for a specific interface:

Switch# clear mac address-table dynamic interface FastEthernet 0/1

#   


---

## Interface Naming Conventions

Cisco switch interfaces follow a naming convention:

Format: \[Type\]\[Slot\]/\[Port\]

<div dir="ltr" id="bkmrk-interface-type-speed" style="text-align:left;"><table><colgroup><col style="width:114px;"></col><col style="width:141px;"></col><col style="width:79px;"></col></colgroup><tbody><tr><td>Interface Type

</td><td>Speed

</td><td>Example

</td></tr><tr><td>Fa

</td><td>Fast Ethernet

</td><td>100 Mbps

</td></tr><tr><td>Gi

</td><td>Gigabit Ethernet

</td><td>1 Gbps

</td></tr><tr><td>Et

</td><td>10 Gigabit Ethernet

</td><td>10 Gbps

</td></tr></tbody></table>

</div>Example: Fa0/1

- Fa = Fast Ethernet (100 Mbps)
- 0 = Slot/module number
- 1 = Port number on that slot

---

## Address Resolution Protocol (ARP)

### What is ARP?

ARP (Address Resolution Protocol) is a protocol used to map IP addresses (Layer 3) to MAC addresses (Layer 2).

Problem it solves:

- A device knows the IP address of a destination but needs the MAC address to send an Ethernet frame
- ARP discovers the MAC address associated with a known IP address

Layer: Layer 2/3 (operates at the boundary)

### How ARP Works

When a PC wants to send a packet to a destination with a known IP address but unknown MAC address:

1. PC sends an ARP REQUEST (broadcast)
2. Destination PC receives the broadcast
3. Destination responds with an ARP REPLY (unicast)
4. Sender learns the destination's MAC address
5. Sender can now send data frames

### ARP Request

Sent by: Device that needs to learn a MAC address

Destination: Broadcast (FFFF.FFFF.FFFF) — sent to all devices on the LAN

Contains:

- Source IP Address (sender's IP)
- Destination IP Address (target's IP)
- Source MAC Address (sender's MAC)
- Destination MAC Address: FFFF.FFFF.FFFF (broadcast)

Message: "Who has IP address X.X.X.X? Please tell me your MAC address!"

### ARP Reply

Sent by: Device that recognizes its own IP address in the ARP request

Destination: Unicast (only to the sender) — not broadcast

Contains:

- Source IP Address (responder's IP)
- Destination IP Address (requester's IP)
- Source MAC Address (responder's MAC)
- Destination MAC Address (requester's MAC)

Message: "I have IP address X.X.X.X. My MAC address is YYYY.YYYY.YYYY"

### ARP Caching

ARP Table: Each device maintains an ARP table (cache) storing IP-to-MAC mappings

- Devices cache ARP replies so they don't have to send another ARP request for the same IP next time
- Cache entries typically expire after 240 seconds (4 minutes)

View ARP table on a device:

Device# show arp

#   


Shows:

- Protocol (usually IP)
- IP Address
- Age (seconds since learned)
- Hardware Address (MAC)
- Type (ARPA for Ethernet)

### ARP Example Scenario

Scenario: PC1 wants to send data to PC2

#   


PC1 (IP: 192.168.1.10) → Needs MAC of PC2 (IP: 192.168.1.20)

#   


1\. PC1 sends ARP REQUEST (broadcast on Ethernet):

 "Who has 192.168.1.20? Tell 192.168.1.10"

2\. Switch floods the ARP REQUEST to all ports (unknown destination)

#   


3\. PC2 receives ARP REQUEST, recognizes its own IP

4\. PC2 sends ARP REPLY (unicast back to PC1):

 "I have 192.168.1.20. My MAC is AAAA.AAAA.AAAA"

5\. Switch learns: MAC AAAA.AAAA.AAAA is on PC2's port

 Switch forwards ARP REPLY out PC1's port (known unicast)

6\. PC1 receives ARP REPLY, learns:

 IP 192.168.1.20 = MAC AAAA.AAAA.AAAA

7\. PC1 can now send Ethernet frames destined to AAAA.AAAA.AAAA

#   


---

## PING (Packet Internet Groper)

### What is PING?

PING is a network utility that tests reachability to a remote host and measures round-trip time.

How it works:

1. Sends ICMP Echo REQUEST message to target
2. Target responds with ICMP Echo REPLY message
3. Sender measures time between request and reply

Uses:

- Test if a host is reachable
- Measure network latency (round-trip time)
- Troubleshoot connectivity issues

### PING Command

Syntax:

Device# ping \[IP\_address\]

#   


Example:

Router# ping 192.168.1.20

#   


### PING Output

By default, Cisco IOS sends 5 ICMP requests/replies (100 bytes each)

Router# ping 192.168.1.20

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echoes to 192.168.1.20, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 1/2/5 ms

#   


Output Legend:

<div dir="ltr" id="bkmrk-symbol-meaning-%21-suc" style="text-align:left;"><table><colgroup><col style="width:67px;"></col><col style="width:231px;"></col></colgroup><tbody><tr><td>Symbol

</td><td>Meaning

</td></tr><tr><td>!

</td><td>Successful echo reply received

</td></tr><tr><td>.

</td><td>Echo request timed out (no reply)

</td></tr><tr><td>U

</td><td>Destination unreachable

</td></tr><tr><td>C

</td><td>Congestion experienced

</td></tr><tr><td>I

</td><td>User interrupted

</td></tr></tbody></table>

</div>Statistics shown:

- Number of successful replies
- Success rate (percentage)
- Round-trip times: min/avg/max (in milliseconds)

### ICMP Messages

PING uses ICMP (Internet Control Message Protocol) which operates at Layer 3

Two ICMP message types for ping:

1. Echo Request (Type 8) — Sent by host asking for a reply
2. Echo Reply (Type 0) — Response from target confirming it's reachable

Other ICMP message types (used for troubleshooting):

- Destination Unreachable (Type 3) — Host/network unreachable
- Time Exceeded (Type 11) — TTL expired (used by traceroute)
- Redirect (Type 5) — Better route available

---

## Troubleshooting Commands Reference

### View ARP Table

Device# show arp

#   


Output shows:

- Protocol type (usually IP)
- IP address
- Hardware address (MAC address in HHHHH.HHHHH.HHHHHH format)
- Type (ARPA for Ethernet)
- Age in minutes (how long since learned)

Example:

Device# show arp

Protocol Address Age (min) Hardware Addr Type

Internet 192.168.1.10 0 AAAA.BBBB.CCCC ARPA

Internet 192.168.1.20 2 DDDD.EEEE.FFFF ARPA

#   


### View Switch MAC Address Table

Switch# show mac address-table

#   


Output shows:

- VLAN number
- MAC address (HHHH.HHHH.HHHH format)
- Type (DYNAMIC or STATIC)
- Ports (interface where MAC is learned)

Example:

Switch# show mac address-table

Vlan Mac Address Type Ports

\---- ----------- ---- -----

 1 AAAA.BBBB.CCCC DYNAMIC Fa0/1

 1 DDDD.EEEE.FFFF DYNAMIC Fa0/2

 1 ffff.ffff.ffff STATIC CPU

#   


### Clear MAC Address Table

Switch# clear mac address-table dynamic

#   


- Clears all dynamic MAC entries (not static ones)
- Useful when troubleshooting or deploying a new device

Clear specific MAC address:

Switch# clear mac address-table dynamic address AAAA.BBBB.CCCC

#   


Clear MAC entries on a specific interface:

Switch# clear mac address-table dynamic interface FastEthernet 0/1

#   


---

## Summary: Frame Forwarding Decision Tree

Switch receives frame on interface X

#   


Does frame have a broadcast destination (FFFF.FFFF.FFFF)?

├─ YES → FLOOD to all interfaces except X

└─ NO → Is destination MAC in MAC address table?

 ├─ YES (KNOWN UNICAST) → Forward to specific interface

 └─ NO (UNKNOWN UNICAST) → FLOOD to all interfaces except X

#   


---

## Quick Reference Table

<div dir="ltr" id="bkmrk-concept-size-purpose" style="text-align:left;"><table><colgroup><col style="width:159px;"></col><col style="width:119px;"></col><col style="width:314px;"></col></colgroup><tbody><tr><td>Concept

</td><td>Size

</td><td>Purpose

</td></tr><tr><td>MAC Address

</td><td>6 bytes (48 bits)

</td><td>Layer 2 physical address

</td></tr><tr><td>Ethernet Header

</td><td>14 bytes

</td><td>Destination MAC, Source MAC, Type/Length

</td></tr><tr><td>Ethernet Trailer (FCS)

</td><td>4 bytes

</td><td>Error detection via CRC

</td></tr><tr><td>Minimum Frame

</td><td>64 bytes

</td><td>Ensures collision detection reliability

</td></tr><tr><td>Maximum Frame

</td><td>1518 bytes

</td><td>Standard Ethernet MTU is 1500 bytes

</td></tr><tr><td>Preamble + SFD

</td><td>8 bytes

</td><td>Not counted in frame size; for synchronization

</td></tr></tbody></table>

</div>---

## Key Takeaways for CCNA

✅ MAC addresses are Layer 2 addresses; switches use them for forwarding

✅ Ethernet frames have header, data payload, and trailer with error detection

✅ Switches learn source MAC addresses from incoming frames and build a MAC address table

✅ Flooding vs. Forwarding: If destination MAC is known, forward to specific port; if unknown, flood to all except incoming

✅ ARP maps IP addresses to MAC addresses—used when sending data to a known IP but unknown MAC

✅ PING uses ICMP to test reachability and measure latency

✅ Frame sizing: Minimum 64 bytes, maximum 1518 bytes (standard), padding added if needed

✅ Hexadecimal used to represent MAC and FCS values in network notation

✅ Dynamic MAC entries are learned and age out after 5 minutes of inactivity; static entries are permanent

✅ Commands: show mac address-table, show arp, ping, clear mac address-table dynamic

# Days 7, 8: IPv4

# IPv4 Addressing

## Overview

IPv4 Fundamentals

IPv4 (Internet Protocol Version 4) is the primary Layer 3 protocol used in modern networks. It provides:

- Logical addressing via 32-bit IP addresses
- Connectivity between different networks (requires routers)
- Path selection between source and destination hosts

Key Distinction from Layer 2:

- Layer 2 (Switches) expands networks using MAC addressing within the same LAN
- Layer 3 (Routers) separates and connects different networks using IP addressing

---

## IP Address Structure

### The IPv4 Address Format

IPv4 addresses consist of 32 bits divided into 4 octets (8 bits each), written in Dotted Decimal Notation:

192.168.1.254

#   


Each decimal number = 8-bit octet

Each octet can range from 0 to 255

#   


Binary Representation:

192 . 168 . 1 . 254

11000000 . 10101000 . 00000001 . 11111110

#   


### Network and Host Portions

An IP address is split into two parts:

1. Network Portion — Identifies the network itself
2. Host Portion — Identifies the device within that network

Notation: CIDR (Classless Inter-Domain Routing)

The slash notation /X indicates how many bits are the network portion:

192.168.1.254/24

#   


/ 24 = The first 24 bits are the NETWORK portion

The remaining 8 bits are the HOST portion

#   


NETWORK: 192.168.1 (first 3 octets)

HOST: .254 (last octet)

#   


All devices on the same network must have the same network portion but different host portions:

192.168.1.100 ← Same network (192.168.1)

192.168.1.105 ← Same network (192.168.1)

192.168.1.205 ← Same network (192.168.1)

#   


### Network Boundaries

Routers separate networks. When a router is placed between two networks:

Network 1: 192.168.1.0/24

Router Interface 1 (G0/0): 192.168.1.254

#   


Router Interface 2 (G0/1): 192.168.2.254

Network 2: 192.168.2.0/24

#   


Each router interface gets a unique IP address on the network it connects to.

Broadcasts do not cross routers: When a broadcast packet hits a router, it stops. Broadcasts stay within the local LAN.

---

## Number Systems for IP Addressing

### Converting Binary to Decimal

Each bit position represents a power of 2:

Bit positions: 128 64 32 16 8 4 2 1

Example: 1 0 0 1 1 1 1 1 = 10011111

#   


Calculation:

1 × 128 = 128

0 × 64 = 0

0 × 32 = 0

1 × 16 = 16

1 × 8 = 8

1 × 4 = 4

1 × 2 = 2

1 × 1 = 1

#   


Sum: 128 + 16 + 8 + 4 + 2 + 1 = 159

#   


Another Example: 01110110

64 + 32 + 16 + 4 + 2 = 118

#   


### Converting Decimal to Binary

Method 1: Subtraction (Left to Right)

Convert 221 to binary:

221 - 128 = 93 ✓ → write 1 in 128 position

93 - 64 = 29 ✓ → write 1 in 64 position

29 - 32 = X ✗ → write 0 in 32 position

29 - 16 = 13 ✓ → write 1 in 16 position

13 - 8 = 5 ✓ → write 1 in 8 position

5 - 4 = 1 ✓ → write 1 in 4 position

1 - 2 = X ✗ → write 0 in 2 position

1 - 1 = 0 ✓ → write 1 in 1 position

#   


Result: 11011101

#   


Method 2: Subtraction from 255

Convert 207 to binary:

255 - 207 = 48

#   


Now find where 48 appears in binary positions:

48 = 32 + 16

#   


So the 0's are in positions 32 and 16

The 1's are everywhere else

#   


Result: 11001111

#   


Convert Binary IP to Decimal

Binary: 10011010.01001110.01101111.00100000

#   


Octet 1: 128 + 16 + 8 + 2 = 154

Octet 2: 64 + 8 + 4 + 2 = 78

Octet 3: 64 + 32 + 8 + 4 + 2 + 1 = 111

Octet 4: 32

#   


IPv4 Address: 154.78.111.32

#   


---

## IPv4 Address Classes

IPv4 addresses are divided into 5 classes based on the first octet:

<div dir="ltr" id="bkmrk-class-first-bit-patt" style="text-align:left;"><table><colgroup><col style="width:49px;"></col><col style="width:122px;"></col><col style="width:162px;"></col><col style="width:163px;"></col><col style="width:75px;"></col><col style="width:54px;"></col></colgroup><tbody><tr><td>Class

</td><td>First Bit Pattern

</td><td>First Octet Range

</td><td>Network Bits

</td><td>Host Bits

</td><td>CIDR

</td></tr><tr><td>A

</td><td>0xxxxxxx

</td><td>0–126 (127 = loopback)

</td><td>8

</td><td>24

</td><td>/8

</td></tr><tr><td>B

</td><td>10xxxxxx

</td><td>128–191

</td><td>16

</td><td>16

</td><td>/16

</td></tr><tr><td>C

</td><td>110xxxxx

</td><td>192–223

</td><td>24

</td><td>8

</td><td>/24

</td></tr><tr><td>D

</td><td>1110xxxx

</td><td>224–239

</td><td>Multicast (reserved)

</td><td>—

</td><td>—

</td></tr><tr><td>E

</td><td>1111xxxx

</td><td>240–255

</td><td>Experimental (reserved)

</td><td>—

</td><td>—

</td></tr></tbody></table>

</div>For CCNA, focus on Classes A, B, and C.

### Class A (0–126)

Example: 10.0.0.0/8

Range: 10.0.0.1 to 10.255.255.254

Hosts: 2^24 - 2 = 16,777,214

#   


Network portion: First octet only

Host portion: Last 3 octets

#   


- Very large networks
- Rarely used in modern networks (reserved for special use)

### Class B (128–191)

Example: 172.16.0.0/16

Range: 172.16.0.1 to 172.16.255.254

Hosts: 2^16 - 2 = 65,534

#   


Network portion: First 2 octets

Host portion: Last 2 octets

#   


- Medium-sized networks
- Common in larger enterprises

### Class C (192–223)

Example: 192.168.1.0/24

Range: 192.168.1.1 to 192.168.1.254

Hosts: 2^8 - 2 = 254

#   


Network portion: First 3 octets

Host portion: Last octet

#   


- Smaller networks
- Most common in small to medium businesses

### Special Addresses: Loopback (Class A)

127.0.0.0 to 127.255.255.255 — Reserved for loopback testing

127.0.0.1 is the standard loopback address

#   


Used to test the network stack (OSI &amp; TCP/IP model) on a local device

Does not go to the network; stays on the local machine

Useful for testing TCP/IP implementation without actual network traffic

#   


---

## Subnet Masks and Network Addresses

### Subnet Mask (Netmask)

A subnet mask identifies which bits are the network portion and which are the host portion:

- 1's in the binary netmask = network bits
- 0's in the binary netmask = host bits

Standard Class Netmasks:

<div dir="ltr" id="bkmrk-class-cidr-dotted-de" style="text-align:left;"><table><colgroup><col style="width:69px;"></col><col style="width:95px;"></col><col style="width:171px;"></col><col style="width:173px;"></col></colgroup><tbody><tr><td>Class

</td><td>CIDR

</td><td>Dotted Decimal

</td><td>Binary

</td></tr><tr><td>A

</td><td>/8

</td><td>255.0.0.0

</td><td>11111111.00000000.00000000.00000000

</td></tr><tr><td>B

</td><td>/16

</td><td>255.255.0.0

</td><td>11111111.11111111.00000000.00000000

</td></tr><tr><td>C

</td><td>/24

</td><td>255.255.255.0

</td><td>11111111.11111111.11111111.00000000

</td></tr></tbody></table>

</div>Example: Identifying Network and Host with Mask

IP Address: 192.168.1.100

Netmask (/24): 255.255.255.0

#   


Match the 1's in the netmask:

Network: 192.168.1.0

Host portion: .100

#   


---

## Network Addresses and Broadcast Addresses

### Network Address (First Address)

When the host portion is all 0's, it's the network address — the identifier of the network itself.

192.168.1.0/24 = NETWORK ADDRESS (not assigned to any host)

#   


### Broadcast Address (Last Address)

When the host portion is all 1's, it's the broadcast address — used to send data to all hosts on the network.

192.168.1.255/24 = BROADCAST ADDRESS (not assigned to any host)

#   


Destination IP: 192.168.1.255

Destination MAC: FFFF.FFFF.FFFF

#   


### First and Last Usable Addresses

Because network and broadcast addresses are reserved, the usable host range is:

Network Address: 192.168.1.0 ← Not usable

First Usable Address: 192.168.1.1 ← Usable

...

Last Usable Address: 192.168.1.254 ← Usable

Broadcast Address: 192.168.1.255 ← Not usable

#   


---

## Calculating Maximum Hosts per Network

Formula: 2^N - 2

Where N = number of host bits

(The "-2" accounts for the network address and broadcast address)

### Class A Example

10.0.0.0/8

Host bits: 24 (since /8 network bits)

Maximum hosts: 2^24 - 2 = 16,777,216 - 2 = 16,777,214

#   


### Class B Example

172.16.0.0/16

Host bits: 16

Maximum hosts: 2^16 - 2 = 65,536 - 2 = 65,534

#   


### Class C Example

192.168.1.0/24

Host bits: 8

Maximum hosts: 2^8 - 2 = 256 - 2 = 254

#   


---

## IPv4 Header (Layer 3)

### Header Overview

The IPv4 header contains many more fields than the Ethernet header:

Minimum Header Length: 20 bytes Maximum Header Length: 60 bytes

### Key Header Fields

Source IP Address (32 bits)

- IP address of the sender/originating device

Destination IP Address (32 bits)

- IP address of the intended receiver/destination

Total Length (16 bits)

- Indicates the total length of the packet (header + data)
- Measured in bytes (not 4-byte increments like IHL)
- Minimum: 20 bytes (header only, no data)
- Maximum: 65,535 bytes (2^16 - 1)

Header Checksum (16 bits)

- Calculated checksum for error detection
- Routers calculate this and drop the packet if checksums don't match
- Only checks the IPv4 header, not the encapsulated data
- The encapsulated protocol (TCP/UDP) handles data error checking

Time To Live (TTL) (8 bits)

- Prevents packets from circulating indefinitely
- Decremented by 1 at each router
- When TTL reaches 0, the packet is dropped
- Default value: typically 64 or 255

Version (4 bits)

- IP version: 4 for IPv4, 6 for IPv6

---

## Cisco Router Interface Configuration

### Viewing Interface Status

Router# show ip interface brief

#   


Output columns:

<div dir="ltr" id="bkmrk-column-meaning-inter" style="text-align:left;"><table><colgroup><col style="width:102px;"></col><col style="width:364px;"></col></colgroup><tbody><tr><td>Column

</td><td>Meaning

</td></tr><tr><td>Interface

</td><td>Physical port name (Gi0/0, Fa0/1, etc.)

</td></tr><tr><td>IP Address

</td><td>Assigned IP address (or unassigned)

</td></tr><tr><td>Method

</td><td>How the IP was assigned (manual, DHCP, etc.)

</td></tr><tr><td>Status (L1)

</td><td>Physical layer status (up/down/administratively down)

</td></tr><tr><td>Protocol (L2)

</td><td>Data link layer status (up/down)

</td></tr></tbody></table>

</div>Status Meanings:

- up — Interface is operational
- down — Interface has a problem or no cable
- administratively down — Interface has been disabled with shutdown command

Default Behavior:

- Router interfaces are administratively down by DEFAULT
- Switch interfaces are NOT administratively down by default

### Entering Interface Configuration Mode

Router# configure terminal

Router(config)# interface gigabitethernet 0/0

#   


Shorthand can be used: g0/0, fa0/0, etc.

### Assigning an IP Address

Router(config-if)# ip address 10.255.255.254 255.0.0.0

#   


Format: ip address &lt;IP&gt; &lt;netmask&gt;

### Enabling the Interface

Router(config-if)# no shutdown

#   


This removes the "administratively down" status.

Expected output:

Interface GigabitEthernet0/0 changed state to up

Line protocol on Interface GigabitEthernet0/0, changed state to up

#   


### Verifying Configuration

From interface configuration mode, use do to execute privileged commands:

Router(config-if)# do show ip interface brief

#   


This confirms the interface is up and the IP address is assigned correctly.

### Detailed Interface Information

Router# show interfaces gigabitethernet 0/0

#   


Shows extensive Layer 1, Layer 2, and Layer 3 information:

- MAC address (BIA)
- IP address
- Interface encapsulation
- MTU size
- Error statistics
- And much more

Router# show interfaces description

#   


Displays descriptions assigned to each interface (if any).

---

## Summary: Common IPv4 Classes at a Glance

<div dir="ltr" id="bkmrk-feature-class-a-clas" style="text-align:left;"><table><colgroup><col style="width:136px;"></col><col style="width:115px;"></col><col style="width:115px;"></col><col style="width:107px;"></col></colgroup><tbody><tr><td>Feature

</td><td>Class A

</td><td>Class B

</td><td>Class C

</td></tr><tr><td>First Octet

</td><td>0–126

</td><td>128–191

</td><td>192–223

</td></tr><tr><td>CIDR

</td><td>/8

</td><td>/16

</td><td>/24

</td></tr><tr><td>Netmask

</td><td>255.0.0.0

</td><td>255.255.0.0

</td><td>255.255.255.0

</td></tr><tr><td>Networks

</td><td>126

</td><td>16,384

</td><td>2,097,152

</td></tr><tr><td>Hosts per Network

</td><td>16,777,214

</td><td>65,534

</td><td>254

</td></tr><tr><td>Example Network

</td><td>10.0.0.0

</td><td>172.16.0.0

</td><td>192.168.1.0

</td></tr><tr><td>First Usable Host

</td><td>10.0.0.1

</td><td>172.16.0.1

</td><td>192.168.1.1

</td></tr><tr><td>Last Usable Host

</td><td>10.255.255.254

</td><td>172.16.255.254

</td><td>192.168.1.254

</td></tr><tr><td>Broadcast Address

</td><td>10.255.255.255

</td><td>172.16.255.255

</td><td>192.168.1.255

</td></tr></tbody></table>

</div>---

## Quick Conversion Reference

Common Decimal to Binary for Octets:

<div dir="ltr" id="bkmrk-decimal-binary-decim" style="text-align:left;"><table><colgroup><col style="width:95px;"></col><col style="width:95px;"></col><col style="width:95px;"></col><col style="width:95px;"></col></colgroup><tbody><tr><td>Decimal

</td><td>Binary

</td><td>Decimal

</td><td>Binary

</td></tr><tr><td>0

</td><td>00000000

</td><td>128

</td><td>10000000

</td></tr><tr><td>1

</td><td>00000001

</td><td>192

</td><td>11000000

</td></tr><tr><td>127

</td><td>01111111

</td><td>224

</td><td>11100000

</td></tr><tr><td>255

</td><td>11111111

</td><td>254

</td><td>11111110

</td></tr></tbody></table>

</div>---

## Key Takeaways for CCNA

✅ IPv4 addresses are 32-bit logical addresses, split into network and host portions

✅ The CIDR notation (/8, /16, /24) indicates the network portion length

✅ Routers separate networks; switches expand networks within the same LAN

✅ IPv4 Classes A, B, C differ in network size (more hosts = more network bits needed)

✅ Network addresses (all host bits = 0) and broadcast addresses (all host bits = 1) are reserved and not usable

✅ Usable host range = 2^(host bits) - 2

✅ Router interfaces must be enabled with no shutdown (administratively down by default)

✅ Subnet masks use 1's for network bits and 0's for host bits

✅ Binary-to-decimal conversion is crucial for subnetting (coming next!)

✅ Broadcasts don't cross routers — they stay within the local LAN

✅ Verify interface configuration with show ip interface brief and show interfaces &lt;interface&gt;

# Day 9: Switch Interfaces

# Switch Interfaces

## Overview

What are Switch Interfaces?

- Physical ports on a switch where devices (PCs, servers, routers, other switches) connect
- Each interface can be independently configured with different settings
- Configuration and status monitoring is done through the Cisco CLI

Key Difference from Routers:

Unlike routers (which default to administratively down), switch interfaces are active by default and don't require no shutdown to enable them.

---

## Viewing Switch Interface Status

### show ip interface brief

SW1# show ip interface brief

#   


This command displays a summary of all interfaces on the switch.

Output Columns:

<div dir="ltr" id="bkmrk-column-what-it-shows" style="text-align:left;"><table><colgroup><col style="width:104px;"></col><col style="width:207px;"></col><col style="width:313px;"></col></colgroup><tbody><tr><td>Column

</td><td>What It Shows

</td><td>Details

</td></tr><tr><td>Interface

</td><td>Port name

</td><td>Fa0/1, Fa0/2, Gi0/1, etc.

</td></tr><tr><td>IP Address

</td><td>IP address assigned to interface

</td><td>Most switch interfaces don't have IPs assigned

</td></tr><tr><td>Method

</td><td>How IP was assigned

</td><td>manual, DHCP, etc. (rarely used on access ports)

</td></tr><tr><td>Status (L1)

</td><td>Physical layer status

</td><td>up = connected, down = not connected

</td></tr><tr><td>Protocol (L2)

</td><td>Data link layer status

</td><td>up = operational, down = problem detected

</td></tr></tbody></table>

</div>Status Meanings on Switches:

<div dir="ltr" id="bkmrk-status-protocol-mean" style="text-align:left;"><table><colgroup><col style="width:159px;"></col><col style="width:72px;"></col><col style="width:307px;"></col></colgroup><tbody><tr><td>Status

</td><td>Protocol

</td><td>Meaning

</td></tr><tr><td>up

</td><td>up

</td><td>Interface is connected and operational

</td></tr><tr><td>down

</td><td>down

</td><td>Interface has no cable or no device connected

</td></tr><tr><td>administratively down

</td><td>down

</td><td>Interface has been disabled with shutdown

</td></tr></tbody></table>

</div>Key Difference: Unlike routers, switch interfaces do NOT default to "administratively down" — they are active by default.

### show interfaces status

SW1# show interfaces status

#   


This provides a more detailed view of all interfaces.

Output Columns:

<div dir="ltr" id="bkmrk-column-purpose-port-" style="text-align:left;"><table><colgroup><col style="width:70px;"></col><col style="width:366px;"></col></colgroup><tbody><tr><td>Column

</td><td>Purpose

</td></tr><tr><td>Port

</td><td>Interface name (Fa0/1, Fa0/2, etc.)

</td></tr><tr><td>Name

</td><td>Description assigned to the interface (for organization)

</td></tr><tr><td>Status

</td><td>connected, notconnect, disabled, err-disabled

</td></tr><tr><td>VLAN

</td><td>VLAN assignment (default is VLAN 1)

</td></tr><tr><td>Duplex

</td><td>half, full, or auto

</td></tr><tr><td>Speed

</td><td>10, 100, 1000 (Mbps) or auto

</td></tr><tr><td>Type

</td><td>10/100BaseTX, 10/100/1000BaseTX, etc.

</td></tr></tbody></table>

</div>---

## Interface Configuration Basics

### Entering Interface Configuration Mode

SW1# configure terminal

SW1(config)# interface fastethernet 0/1

SW1(config-if)#

#   


Or use shorthand:

SW1(config)# interface fa0/1

SW1(config-if)#

#   


### Adding a Description

SW1(config-if)# description ## Connection to PC1 ##

#   


Descriptions are useful for documenting what each port is connected to.

### Disabling an Interface

SW1(config-if)# shutdown

#   


- Puts interface in "administratively down" status
- Useful for security (disabling unused ports)
- Can be re-enabled with no shutdown

### Enabling a Disabled Interface

SW1(config-if)# no shutdown

#   


---

## Configuring Multiple Interfaces at Once

### Interface Range Command

Manually configuring each unused interface would be tedious. Use the interface range command:

SW1(config)# interface range fastethernet 0/5 - 12

SW1(config-if-range)#

#   


This selects interfaces Fa0/5 through Fa0/12 (inclusive).

Apply configuration to all selected interfaces:

SW1(config-if-range)# description ## Not in use ##

SW1(config-if-range)# shutdown

#   


Both commands are applied to all 8 interfaces (0/5, 0/6, 0/7, ... 0/12) at once.

Verify the changes:

SW1# show interfaces status

#   


You should see all the selected interfaces now show "disabled" status.

### Other Range Syntax

// Separate specific interfaces

SW1(config)# interface range fa0/1, fa0/5, fa0/10

SW1(config-if-range)# shutdown

#   


// Combine multiple ranges

SW1(config)# interface range fa0/1 - 5, fa0/10 - 15

SW1(config-if-range)# shutdown

#   


---

## Duplex and Collisions

### Half Duplex vs. Full Duplex

Half Duplex:

- Device cannot send AND receive at the same time
- Must wait to receive before sending
- Must wait to send before receiving
- Like a walkie-talkie — only one person can talk at a time

Full Duplex:

- Device can send AND receive simultaneously
- No waiting required
- Like a telephone — both parties can talk at the same time
- More efficient, uses available bandwidth fully

### Modern Switch Reality

Most modern switches and devices support Full Duplex.

Half duplex is virtually unused today, except in legacy or specialized scenarios.

### Historical Context: Hubs vs. Switches

Hubs (Layer 1 Devices):

- Simple repeaters that flood frames to all ports
- All connected devices share the same collision domain
- When multiple devices send simultaneously, collisions occur (frames corrupt each other)
- All devices use Half Duplex (because collisions are common)
- Use CSMA/CD to detect and handle collisions

Switches (Layer 2 Devices):

- Intelligent devices that forward frames based on MAC addresses
- Each port has its own collision domain
- Collisions rarely occur (only within the same port pair, very unlikely)
- All devices can use Full Duplex (no collision risk)
- CSMA/CD is almost never triggered

### CSMA/CD (Carrier Sense Multiple Access with Collision Detection)

How it works (for historical context):

1. Device listens to the network (carrier sense)
2. Waits until no other devices are transmitting
3. Begins transmitting data
4. If collision detected (two devices send at once), jam signal is sent
5. All devices stop transmitting
6. Each device waits a random amount of time
7. Retry transmission
8. Process repeats until successful

Why it's obsolete: Full Duplex switches make collisions impossible within normal operation.

---

## Speed and Duplex Autonegotiation

### Default Settings

Modern switch interfaces support automatic negotiation of speed and duplex:

Interface Type | Default Speed | Default Duplex |

10/100 | Auto | Auto |

10/100/1000 | Auto | Auto |

#   


How autonegotiation works:

1. Both devices advertise their capabilities (speeds and duplex modes they support)
2. Devices negotiate the best mutually supported speed and duplex
3. Both ends use the negotiated settings

Example:

Device A: Supports 10/100/1000 Full Duplex

Device B: Supports 10/100 Full Duplex

Result: Both use 100 Mbps Full Duplex (best common speed)

#   


### What Happens When Autonegotiation Fails?

If a device doesn't support autonegotiation (or it's disabled), the switch must guess:

Speed Fallback:

- Switch tries to detect the speed the other device is using
- If detection fails, defaults to the slowest supported speed
- Example: On a 10/100/1000 interface, defaults to 10 Mbps

Duplex Fallback:

<div dir="ltr" id="bkmrk-speed-default-duplex" style="text-align:left;"><table><colgroup><col style="width:87px;"></col><col style="width:119px;"></col></colgroup><tbody><tr><td>Speed

</td><td>Default Duplex

</td></tr><tr><td>10 Mbps

</td><td>Half Duplex

</td></tr><tr><td>100 Mbps

</td><td>Half Duplex

</td></tr><tr><td>1000 Mbps

</td><td>Full Duplex

</td></tr></tbody></table>

</div>Why this matters:

- Mismatched duplex causes performance problems and errors
- Speed mismatch causes data loss or slow throughput
- Always ensure both sides match or both use autonegotiation

### Manually Configuring Speed and Duplex

If autonegotiation isn't working properly, manually set the interface:

SW1(config-if)# speed 100

SW1(config-if)# duplex full

#   


Both sides must match manually (best practice: set both to auto if possible).

---

## Interface Errors and Counters

### Viewing Interface Statistics

SW1# show interfaces fastethernet 0/1

#   


This displays detailed statistics including error counters at the bottom.

### Error Types and Meanings

Frame Reception Statistics:

<div dir="ltr" id="bkmrk-counter-meaning-norm" style="text-align:left;"><table><colgroup><col style="width:110px;"></col><col style="width:293px;"></col><col style="width:91px;"></col></colgroup><tbody><tr><td>Counter

</td><td>Meaning

</td><td>Normal?

</td></tr><tr><td>Runts

</td><td>Frames smaller than minimum 64 bytes

</td><td>Should be 0

</td></tr><tr><td>Giants

</td><td>Frames larger than maximum 1518 bytes

</td><td>Should be 0

</td></tr><tr><td>CRC Errors

</td><td>Frames that failed CRC check (FCS trailer)

</td><td>Should be 0

</td></tr><tr><td>Frame Errors

</td><td>Frames with incorrect format due to errors

</td><td>Should be 0

</td></tr></tbody></table>

</div>Aggregated Counters:

<div dir="ltr" id="bkmrk-counter-meaning-inpu" style="text-align:left;"><table><colgroup><col style="width:115px;"></col><col style="width:370px;"></col></colgroup><tbody><tr><td>Counter

</td><td>Meaning

</td></tr><tr><td>Input Errors

</td><td>Total of various receive errors (runts, CRC, frame, etc.)

</td></tr><tr><td>Output Errors

</td><td>Count of frames switch tried to send but failed

</td></tr></tbody></table>

</div>### What These Errors Indicate

<div dir="ltr" id="bkmrk-error-type-common-ca" style="text-align:left;"><table><colgroup><col style="width:115px;"></col><col style="width:447px;"></col></colgroup><tbody><tr><td>Error Type

</td><td>Common Causes

</td></tr><tr><td>Runts

</td><td>Cable issues, duplex mismatch, electromagnetic interference (EMI)

</td></tr><tr><td>Giants

</td><td>Device doesn't properly enforce frame size limits, MTU mismatch

</td></tr><tr><td>CRC Errors

</td><td>Bad cable, duplex mismatch, EMI, faulty NIC

</td></tr><tr><td>Frame Errors

</td><td>Cable problems, duplex mismatch, hardware failure

</td></tr><tr><td>Output Errors

</td><td>Switch interface hardware problem, buffer overflow

</td></tr></tbody></table>

</div>### Troubleshooting with Error Counters

High runt/CRC errors?

1. Check cable quality and connections
2. Verify duplex settings on both ends
3. Check for electrical interference
4. Replace faulty cable or NIC

Increasing errors after configuration change?

1. Verify speed/duplex settings match on both ends
2. Check if autonegotiation is conflicting
3. Look at interface utilization (might be saturated)

---

## Complete Interface Configuration Example

### Scenario: Setting up a PC Connection

Requirements:

- Connect PC to Fa0/1
- Label the port
- Ensure it's enabled
- Verify speed/duplex is auto (default)

Configuration:

SW1# configure terminal

SW1(config)# interface fastethernet 0/1

SW1(config-if)# description ## PC1 - Finance Department ##

SW1(config-if)# speed auto

SW1(config-if)# duplex auto

SW1(config-if)# no shutdown

SW1(config-if)# exit

#   


// Verify configuration

SW1# show interfaces status

#   


Expected output:

Port Name Status Vlan Duplex Speed Type

Fa0/1 ## PC1 - Finance Dept ## connected 1 auto auto 10/100BaseTX

#   


---

## Disabling Unused Ports for Security

### The Problem

Unused ports are a security risk — unauthorized devices can connect and access the network.

### The Solution: Disable Them

SW1# configure terminal

SW1(config)# interface range fastethernet 0/5 - 28

SW1(config-if-range)# description ## Unused - Security ##

SW1(config-if-range)# shutdown

SW1(config-if-range)# exit

#   


// Verify

SW1# show interfaces status

#   


Result:

All ports Fa0/5 through Fa0/28 now show "disabled" status and will not accept any connections.

---

## Quick Reference: Common Interface Commands

### Configuration Mode

<div dir="ltr" id="bkmrk-command-purpose-inte" style="text-align:left;"><table><colgroup><col style="width:211px;"></col><col style="width:253px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>interface fa0/1

</td><td>Enter interface configuration mode

</td></tr><tr><td>interface range fa0/1 - 5

</td><td>Configure multiple interfaces at once

</td></tr><tr><td>description &lt;text&gt;

</td><td>Add description to interface

</td></tr><tr><td>no shutdown

</td><td>Enable interface

</td></tr><tr><td>shutdown

</td><td>Disable interface

</td></tr><tr><td>speed 10 | 100 | 1000 | auto

</td><td>Set interface speed

</td></tr><tr><td>duplex half | full | auto

</td><td>Set duplex mode

</td></tr></tbody></table>

</div>### Privileged EXEC Mode

<div dir="ltr" id="bkmrk-command-purpose-show" style="text-align:left;"><table><colgroup><col style="width:226px;"></col><col style="width:211px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>show ip interface brief

</td><td>Summary of all interfaces

</td></tr><tr><td>show interfaces status

</td><td>Detailed interface status

</td></tr><tr><td>show interfaces fa0/1

</td><td>Detailed stats for one interface

</td></tr><tr><td>show interfaces description

</td><td>Show interface descriptions

</td></tr></tbody></table>

</div>---

## Summary Table: Interface Status States

<div dir="ltr" id="bkmrk-status-protocol-mean-1" style="text-align:left;"><table><colgroup><col style="width:58px;"></col><col style="width:72px;"></col><col style="width:188px;"></col><col style="width:247px;"></col></colgroup><tbody><tr><td>Status

</td><td>Protocol

</td><td>Meaning

</td><td>Solution

</td></tr><tr><td>up

</td><td>up

</td><td>Operational

</td><td>None needed

</td></tr><tr><td>down

</td><td>down

</td><td>No cable or device

</td><td>Check cable, reconnect device

</td></tr><tr><td>down

</td><td>down

</td><td>Disabled

</td><td>Use no shutdown to enable

</td></tr><tr><td>up

</td><td>down

</td><td>Physical good, L2 problem

</td><td>Check configurations, VLAN issues

</td></tr></tbody></table>

</div>---

## Key Takeaways for CCNA

✅ Switch interfaces are active by default — no shutdown needed to enable them (unlike routers)

✅ show ip interface brief shows summary status; show interfaces status shows detailed info

✅ Interface range command allows configuring multiple ports at once for efficiency

✅ Full Duplex is standard on modern switches; Half Duplex is legacy (used with hubs)

✅ CSMA/CD was used to detect collisions on hubs; obsolete with full-duplex switches

✅ Autonegotiation lets devices automatically negotiate speed and duplex (default and preferred)

✅ Mismatched speed/duplex causes performance problems and errors

✅ Error counters (runts, giants, CRC) indicate cable, duplex, or hardware issues

✅ Disable unused ports with shutdown command for security

✅ Descriptions on interfaces help with organization and troubleshooting

✅ Always verify interface status after making changes using show commands

✅ Typical default is Speed auto, Duplex auto — change only if autonegotiation fails

# Day 10: IPv4 Header

# The IPv4 Header

## Overview

What is the IPv4 Header?

The IPv4 header is the Layer 3 (Network Layer) Protocol Data Unit that enables:

- Routing — Sending data between devices on separate networks
- Global connectivity — Reaching devices across the Internet
- Protocol identification — Knowing what Layer 4 protocol is encapsulated
- Error checking — Detecting corruption in the header itself

Position in the Stack:

Application Data

 ↓ (encapsulated in)

TCP/UDP Segment (Layer 4)

 ↓ (encapsulated in)

IPv4 Packet (Layer 3) ← IPv4 Header

 ↓ (encapsulated in)

Ethernet Frame (Layer 2)

#   


Key Purpose: The IPv4 header tells routers where the packet came from (source IP) and where it's going (destination IP), allowing them to make forwarding decisions.

---

## IPv4 Header Structure

### Overall Header Layout

32-bit boundaries (4-byte words)

#   


\[VERSION\]\[IHL\]\[DSCP\]\[ECN\] \[TOTAL LENGTH\]

\[IDENTIFICATION\] \[FLAGS\]\[FRAGMENT OFFSET\]

\[TTL\]\[PROTOCOL\] \[HEADER CHECKSUM\]

\[SOURCE IP ADDRESS (32 bits)\]

\[DESTINATION IP ADDRESS (32 bits)\]

\[OPTIONS (Optional, Variable Length)\]

#   


### Header Size

- Minimum size: 20 bytes (no options)
- Maximum size: 60 bytes (with options)

The minimum 20 bytes is the standard for most packets.

### Complete Field Reference

<div dir="ltr" id="bkmrk-field-bits-purpose-v" style="text-align:left;"><table><colgroup><col style="width:133px;"></col><col style="width:55px;"></col><col style="width:250px;"></col></colgroup><tbody><tr><td>Field

</td><td>Bits

</td><td>Purpose

</td></tr><tr><td>Version

</td><td>4

</td><td>IP version (4 for IPv4, 6 for IPv6)

</td></tr><tr><td>IHL

</td><td>4

</td><td>Header length in 4-byte increments

</td></tr><tr><td>DSCP

</td><td>6

</td><td>Quality of Service prioritization

</td></tr><tr><td>ECN

</td><td>2

</td><td>Congestion notification

</td></tr><tr><td>Total Length

</td><td>16

</td><td>Entire packet size (header + data)

</td></tr><tr><td>Identification

</td><td>16

</td><td>Fragmentation group identifier

</td></tr><tr><td>Flags

</td><td>3

</td><td>Fragmentation control (DF, MF bits)

</td></tr><tr><td>Fragment Offset

</td><td>13

</td><td>Position within fragmented packet

</td></tr><tr><td>TTL

</td><td>8

</td><td>Hop count (prevents infinite loops)

</td></tr><tr><td>Protocol

</td><td>8

</td><td>Encapsulated Layer 4 protocol

</td></tr><tr><td>Header Checksum

</td><td>16

</td><td>Error detection for header only

</td></tr><tr><td>Source IP

</td><td>32

</td><td>Sender's IP address

</td></tr><tr><td>Destination IP

</td><td>32

</td><td>Receiver's IP address

</td></tr><tr><td>Options

</td><td>0–320

</td><td>Optional features (rarely used)

</td></tr></tbody></table>

</div>---

## Field Definitions

### Version (4 bits)

Identifies the Internet Protocol version being used.

<div dir="ltr" id="bkmrk-value-binary-version" style="text-align:left;"><table><colgroup><col style="width:54px;"></col><col style="width:62px;"></col><col style="width:163px;"></col></colgroup><tbody><tr><td>Value

</td><td>Binary

</td><td>Version

</td></tr><tr><td>4

</td><td>0100

</td><td>IPv4 (current standard)

</td></tr><tr><td>6

</td><td>0110

</td><td>IPv6 (next generation)

</td></tr></tbody></table>

</div>Note: The first field of every IP header is the version, so a device can immediately identify which IP version is being used.

---

### IHL — Internet Header Length (4 bits)

Specifies the total length of the IPv4 header in 4-byte increments.

Why is this needed?

The Options field (last part of header) is variable in length. The IHL field tells the device where the actual data payload begins.

Calculation:

IHL value × 4 bytes = Header length in bytes

#   


Example:

IHL = 5 → 5 × 4 = 20 bytes (standard minimum)

IHL = 15 → 15 × 4 = 60 bytes (maximum with options)

#   


Valid Range:

<div dir="ltr" id="bkmrk-ihl-value-bytes-mean" style="text-align:left;"><table><colgroup><col style="width:86px;"></col><col style="width:55px;"></col><col style="width:242px;"></col></colgroup><tbody><tr><td>IHL Value

</td><td>Bytes

</td><td>Meaning

</td></tr><tr><td>5

</td><td>20

</td><td>No options present (most common)

</td></tr><tr><td>6–14

</td><td>24–56

</td><td>Options present

</td></tr><tr><td>15

</td><td>60

</td><td>Maximum size with options

</td></tr></tbody></table>

</div>Default: IHL = 5 (20 bytes) for packets without options.

---

### DSCP — Differentiated Services Code Point (6 bits)

Used for Quality of Service (QoS) — prioritizing certain types of traffic.

What it does:

- Marks packets with a priority/class level
- Routers use this to make forwarding decisions
- Can prioritize delay-sensitive traffic (VoIP, video streaming)
- Can deprioritize non-critical traffic (file transfers, email)

Common Uses:

- Voice over IP (VoIP) — High priority (low latency needed)
- Video streaming — Medium-high priority
- Regular web traffic — Standard priority
- Backup/FTP transfers — Low priority

Note: Only meaningful if routers are configured to respect QoS markings.

---

### ECN — Explicit Congestion Notification (2 bits)

Provides congestion feedback without dropping packets.

Traditional Approach (old):

- Routers detect congestion → Drop packets
- Sender notices packet loss → Reduces sending rate
- Works, but wastes the dropped packets

ECN Approach (modern, optional):

- Routers detect congestion → Mark packet with ECN bit (don't drop it)
- Packet reaches destination → Receiver knows congestion occurred
- Receiver notifies sender → Sender reduces rate
- All devices still receive their data (more efficient)

Requirements:

- Both sender and receiver must support ECN
- Routers/network must be configured to use it
- Not always enabled (legacy network compatibility)

---

### Total Length (16 bits)

Specifies the total size of the entire IP packet — header + encapsulated data.

Important Details:

- Measured in bytes (not 4-byte increments)
- Minimum value: 20 bytes (IPv4 header with no data)
- Maximum value: 65,535 bytes (2^16 - 1)

Example:

IPv4 Header: 20 bytes

TCP Segment: 40 bytes

Data: 400 bytes

Total Length: 20 + 40 + 400 = 460 bytes

#   


MTU (Maximum Transmission Unit):

- Typical MTU for Ethernet: 1500 bytes
- If packet total length exceeds MTU, packet is fragmented

---

### Identification (16 bits)

Groups fragmented packets together so they can be reassembled.

What it does:

- If a packet is too large (exceeds MTU), it's split into fragments
- Each fragment gets its own IPv4 header
- All fragments from the same packet have the same Identification value
- Receiving device uses this value to know which fragments belong together

Example Scenario:

Original packet: 4000 bytes (exceeds 1500 MTU)

Fragment 1: Header (20 bytes) + Data (1480 bytes) = 1500

Fragment 2: Header (20 bytes) + Data (1480 bytes) = 1500

Fragment 3: Header (20 bytes) + Data (1020 bytes) = 1040

#   


All three fragments have: Identification = 5000 (same value)

Receiving host reassembles using this identifier

#   


---

### Flags (3 bits)

Control packet fragmentation behavior.

<div dir="ltr" id="bkmrk-bit-%23-name-purpose-0" style="text-align:left;"><table><colgroup><col style="width:47px;"></col><col style="width:159px;"></col><col style="width:418px;"></col></colgroup><tbody><tr><td>Bit #

</td><td>Name

</td><td>Purpose

</td></tr><tr><td>0

</td><td>Reserved

</td><td>Always set to 0 (unused)

</td></tr><tr><td>1

</td><td>DF (Don't Fragment)

</td><td>0 = fragmentation allowed, 1 = don't fragment this packet

</td></tr><tr><td>2

</td><td>MF (More Fragments)

</td><td>1 = more fragments coming, 0 = last fragment or no fragments

</td></tr></tbody></table>

</div>Usage Examples:

DF Bit = 1 (Don't Fragment):

- Used when fragmentation is undesirable
- Example: Some VPN or tunneling protocols
- If packet exceeds MTU and DF=1, router drops packet and sends ICMP error
- Sender receives error and resends with smaller size

MF Bit = 1 (More Fragments):

- Set to 1 on all fragments except the last one
- Last fragment (or unfragmented packet) has MF = 0
- Helps receiver know when it has received all fragments

Example:

Original: 3000 bytes, Identification = 100

#   


Fragment 1: FLAGS = 001 (DF=0, MF=1 — more fragments coming)

Fragment 2: FLAGS = 001 (DF=0, MF=1 — more fragments coming)

Fragment 3: FLAGS = 000 (DF=0, MF=0 — last fragment, no more)

#   


Receiver sees MF=0 on third fragment and stops waiting

#   


---

### Fragment Offset (13 bits)

Indicates the position of this fragment within the original unfragmented packet.

Measured in: 8-byte increments

Why it's needed:

- Fragments can arrive out of order
- Receiver uses offset to reassemble in correct order
- Offset allows fragments as small as 8 bytes (efficiency)

Calculation:

Actual byte position = Fragment Offset × 8

#   


Example:

Fragment Offset = 0 → Bytes 0–7 (first fragment)

Fragment Offset = 185 → Bytes 1480–1487 (fragment 2, after 185×8)

Fragment Offset = 370 → Bytes 2960–2967 (fragment 3)

#   


---

### TTL — Time To Live (8 bits)

Prevents packets from circulating infinitely through the network.

Original Purpose (historical):

- Meant to represent packet's maximum lifetime in seconds
- In practice, became a hop count mechanism

Modern Usage (hop count):

- Each router decrements TTL by 1
- When TTL reaches 0, router drops the packet
- Prevents infinite loops (routing loops)

Common Default Values:

<div dir="ltr" id="bkmrk-os%2Fdevice-default-tt" style="text-align:left;"><table><colgroup><col style="width:106px;"></col><col style="width:106px;"></col></colgroup><tbody><tr><td>OS/Device

</td><td>Default TTL

</td></tr><tr><td>Windows

</td><td>128

</td></tr><tr><td>Linux

</td><td>64

</td></tr><tr><td>macOS

</td><td>64

</td></tr><tr><td>Routers

</td><td>64 or 255

</td></tr><tr><td>Recommended

</td><td>64

</td></tr></tbody></table>

</div>Example Journey:

PC sends packet with TTL = 64

#   


Router 1: TTL = 64 → Decrements to 63 → Forwards

Router 2: TTL = 63 → Decrements to 62 → Forwards

Router 3: TTL = 62 → Decrements to 61 → Forwards

...

Router 64: TTL = 1 → Decrements to 0 → DROPS packet

#   


Prevents packet from traveling more than ~64 hops

#   


Traceroute Uses TTL:

The traceroute command intentionally uses increasing TTL values to discover the path packets take:

Send packet with TTL=1 → Router 1 drops it, sends ICMP error

Send packet with TTL=2 → Router 2 drops it, sends ICMP error

Send packet with TTL=3 → Router 3 drops it, sends ICMP error

... continues until destination reached

#   


---

### Protocol (8 bits)

Identifies which Layer 4 protocol is encapsulated in the packet.

Common Protocol Numbers:

<div dir="ltr" id="bkmrk-protocol-number-purp" style="text-align:left;"><table><colgroup><col style="width:72px;"></col><col style="width:72px;"></col><col style="width:351px;"></col></colgroup><tbody><tr><td>Protocol

</td><td>Number

</td><td>Purpose

</td></tr><tr><td>ICMP

</td><td>1

</td><td>Internet Control Message Protocol (ping, traceroute)

</td></tr><tr><td>IGMP

</td><td>2

</td><td>Internet Group Management Protocol (multicast)

</td></tr><tr><td>TCP

</td><td>6

</td><td>Transmission Control Protocol (reliable)

</td></tr><tr><td>UDP

</td><td>17

</td><td>User Datagram Protocol (unreliable, low latency)

</td></tr><tr><td>OSPF

</td><td>89

</td><td>Open Shortest Path First (routing protocol)

</td></tr></tbody></table>

</div>Why routers need this:

- Router reads protocol number
- Knows what Layer 4 protocol to expect
- Can make forwarding decisions based on protocol (e.g., route all TCP port 80 via certain interface)

Complete Protocol Numbers:

[Internet Assigned Numbers Authority (IANA) Protocol Numbers](https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)

---

### Header Checksum (16 bits)

Detects errors in the IPv4 header only.

How it works:

1. Sender calculates a checksum of all header fields
2. Sender stores checksum in Header Checksum field
3. Router receives packet
4. Router recalculates checksum from header fields
5. Router compares calculated checksum to Header Checksum field
6. If they don't match → packet is corrupted → packet is dropped
7. If they match → packet is valid → forward it

Important:

- Only checks the IPv4 header, not the data payload
- Does NOT check TCP/UDP segment or application data
- TCP and UDP have their own checksum fields for data integrity
- If header corrupted, packet is discarded (not retransmitted by IP layer)

Why separate checksums?

- IP header is critical (routing decisions depend on source/destination)
- Data errors are handled by Layer 4 protocols (TCP/UDP)
- Separating concerns improves efficiency

---

### Source and Destination IP Addresses (32 bits each)

Source IP Address:

- IP address of the device that originated the packet
- Set by the sender
- Does not change during transit (unless NAT is involved)

Destination IP Address:

- IP address of the device the packet is destined for
- Set by the sender
- Routers use this to make forwarding decisions

Routing Decision:

Router receives packet

↓

Router looks at Destination IP

↓

Router checks routing table: "Where do I send packets destined for X.X.X.X?"

↓

Router forwards packet out appropriate interface

↓

Packet travels to next hop (another router or destination)

#   


---

### Options (0–320 bits, variable)

Optional and rarely used — present only if IHL &gt; 5.

When Options exist:

- IHL field will be &gt; 5
- Example: IHL = 6 means 24 bytes (20 + 4 bytes of options)
- IHL = 7 means 28 bytes (20 + 8 bytes of options)

Rare Options Examples:

- Strict Routing — Specify exact route packet must take
- Loose Routing — Specify certain routers packet must pass through
- Record Route — Track which routers packet passes through
- Timestamp — Record timestamps at each router

Why rarely used?

- Add overhead (increased header size)
- Not supported by many routers (security/efficiency reasons)
- Can slow down routing decisions
- Modern protocols (IPv6) handle these features differently

---

## Fragmentation Example

### Scenario: Packet Too Large for MTU

Application sends 3000 bytes to network with 1500 MTU

#   


IPv4 Header created:

 Source: 192.168.1.100

 Destination: 192.168.1.200

 Total Length: 3020 (20 header + 3000 data)

Router sees: 3020 &gt; 1500 (MTU exceeded)

#   


Fragmentation occurs:

#   


Fragment 1:

 IPv4 Header (20 bytes)

\+ Data (1480 bytes)

 = 1500 bytes total

 Identification: 5000

 Flags: 001 (DF=0, MF=1)

 Fragment Offset: 0 (starts at byte 0)

#   


Fragment 2:

 IPv4 Header (20 bytes)

\+ Data (1480 bytes)

 = 1500 bytes total

 Identification: 5000 (SAME)

 Flags: 001 (DF=0, MF=1)

 Fragment Offset: 185 (starts at byte 1480 = 185×8)

#   


Fragment 3:

 IPv4 Header (20 bytes)

\+ Data (40 bytes)

 = 60 bytes total

 Identification: 5000 (SAME)

 Flags: 000 (DF=0, MF=0 — last fragment)

 Fragment Offset: 370 (starts at byte 2960 = 370×8)

#   


Receiving host:

 Gets Fragment 1 (offset 0)

 Gets Fragment 3 (offset 370) — arrives first

 Gets Fragment 2 (offset 185) — arrives last

 Uses offsets to reassemble in correct order:

 Bytes 0–1479 (Fragment 1)

 Bytes 1480–2959 (Fragment 2)

 Bytes 2960–2999 (Fragment 3)

 Result: Complete 3000-byte data message

#   


---

## Summary Table: IPv4 Header Fields Quick Reference

<div dir="ltr" id="bkmrk-field-bits-function-" style="text-align:left;"><table><colgroup><col style="width:133px;"></col><col style="width:68px;"></col><col style="width:202px;"></col><col style="width:117px;"></col></colgroup><tbody><tr><td>Field

</td><td>Bits

</td><td>Function

</td><td>Example

</td></tr><tr><td>Version

</td><td>4

</td><td>IP version

</td><td>4 (IPv4)

</td></tr><tr><td>IHL

</td><td>4

</td><td>Header length in 4-byte units

</td><td>5 (20 bytes)

</td></tr><tr><td>DSCP

</td><td>6

</td><td>Quality of Service

</td><td>46 (VoIP)

</td></tr><tr><td>ECN

</td><td>2

</td><td>Congestion notification

</td><td>00 (none)

</td></tr><tr><td>Total Length

</td><td>16

</td><td>Entire packet size

</td><td>460

</td></tr><tr><td>Identification

</td><td>16

</td><td>Fragment group ID

</td><td>5000

</td></tr><tr><td>Flags

</td><td>3

</td><td>Fragment control

</td><td>010 (DF bit set)

</td></tr><tr><td>Fragment Offset

</td><td>13

</td><td>Position in original packet

</td><td>0 (first)

</td></tr><tr><td>TTL

</td><td>8

</td><td>Hop limit

</td><td>64

</td></tr><tr><td>Protocol

</td><td>8

</td><td>Layer 4 protocol

</td><td>6 (TCP)

</td></tr><tr><td>Header Checksum

</td><td>16

</td><td>Header error detection

</td><td>Calculated

</td></tr><tr><td>Source IP

</td><td>32

</td><td>Sender IP address

</td><td>192.168.1.100

</td></tr><tr><td>Destination IP

</td><td>32

</td><td>Receiver IP address

</td><td>192.168.1.200

</td></tr><tr><td>Options

</td><td>Variable

</td><td>Rarely used features

</td><td>(empty)

</td></tr></tbody></table>

</div>---

## Key Concepts for Routing

### How Routers Use the IPv4 Header

Router's processing:

#   


1\. Read Source IP → know where it came from

2\. Read Destination IP → look up in routing table

3\. Read TTL → decrement by 1

4\. Recalculate Header Checksum → verify no corruption

5\. Read Protocol → identify Layer 4 payload

6\. Read Total Length → know packet size

7\. Check if fragmentation needed (MTU comparison)

8\. Forward out appropriate interface

#   


### TTL as a Loop Prevention Mechanism

Network with routing loop:

#   


PC1 sends to 10.0.0.5 with TTL=64

 ↓

Router A: TTL 64→63, forwards to Router B

 ↓

Router B: TTL 63→62, forwards to Router A (loop!)

 ↓

Router A: TTL 62→61, forwards to Router B

 ↓

\[continues looping...\]

 ↓

Router: TTL=1, decrements to 0 → DROPS packet

 ↓

Packet never reaches destination, but network not flooded

#   


Without TTL, the packet would loop infinitely, consuming bandwidth.

---

## Practical Example: Complete IPv4 Header

Scenario: PC1 sends HTTP request to web server

PC1 (192.168.1.100) → Web Server (8.8.8.8)

#   


IPv4 Header created:

#   


Version: 4 (0100 in binary)

IHL: 5 (20 bytes, no options)

DSCP: 0 (normal priority)

ECN: 0 (no congestion)

Total Length: 546 (20 header + 40 TCP + 486 HTTP data)

Identification: 34521 (random ID for this packet)

Flags: 010 (DF bit set — don't fragment)

Fragment Offset: 0 (not fragmented)

TTL: 64 (default from Windows/Linux)

Protocol: 6 (TCP)

Header Checksum: 0xA2B4 (calculated checksum)

Source IP: 192.168.1.100

Destination IP: 8.8.8.8

Options: (none)

#   


Routing decision:

Router looks at destination 8.8.8.8

Checks routing table: "8.8.8.0/24 → send via ISP gateway"

Forwards packet toward ISP gateway

Decrements TTL from 64 to 63

Recalculates checksum (TTL changed)

Forwards on WAN interface

#   


---

## Key Takeaways for CCNA

✅ IPv4 header minimum 20 bytes (no options), maximum 60 bytes (with options)

✅ IHL field indicates header length in 4-byte increments (5 = 20 bytes standard)

✅ Total Length = entire packet size (header + data), can be up to 65,535 bytes

✅ TTL prevents routing loops; decremented at each router; default ~64

✅ Protocol field identifies Layer 4 protocol (6=TCP, 17=UDP, 1=ICMP)

✅ Fragmentation happens when packet exceeds MTU (usually 1500 bytes)

✅ Identification field groups fragments; all fragments of same packet have same ID

✅ Flags control fragmentation: DF (don't fragment), MF (more fragments)

✅ Fragment Offset in 8-byte increments allows out-of-order reassembly

✅ Header Checksum verifies header integrity only (not data)

✅ Source and Destination IP addresses never change in transit (IP layer perspective)

✅ DSCP used for QoS prioritization (optional)

✅ ECN enables congestion notification without packet drop (optional)

✅ Options field rarely used in modern networks

✅ Routers examine destination IP to make forwarding decisions based on routing table

✅ Traceroute works by sending packets with increasing TTL values to trace route to destination

#   
  
  

# Day 11: Routing Fundamentals

# Routing Fundamentals &amp; Static Routing

## Overview

What is Routing?

Routing is the process that routers use to determine the path that IP packets should take over a network to reach their destination.

Core Concept:

- Routers forward packets between different networks (across network boundaries)
- Switches forward frames within the same LAN (within a network)
- A router reads the destination IP address and determines where to send the packet next

Key Difference from Switching:

Switches (Layer 2):

\- Examine destination MAC address

\- Forward within the same LAN

\- Fast forwarding to connected devices

#   


Routers (Layer 3):

\- Examine destination IP address

\- Forward between different networks

\- Use routing tables to determine best path

#   


---

## Routing Tables

### What is a Routing Table?

A routing table is a database of routes that tells the router where to send packets destined for specific networks or IP addresses.

Stored on: Every router in the network

Content: Network destinations and how to reach them

### Route Components

Each route entry contains:

Destination Network → Next-Hop Router (or directly connected)

#   


Example:

Destination: 192.168.2.0/24 → Send to next-hop router: 10.0.0.2

Destination: 10.1.1.0/24 → Send directly out interface G0/1

Destination: 172.16.0.0/16 → Send to next-hop router: 10.0.0.3

#   


### Route Types

When a router receives a packet, it can take one of three actions:

1\. Forward to Next-Hop Router

Route: "To reach 192.168.1.0/24, send to router 10.0.0.2"

#   


Router receives packet destined for 192.168.1.50

↓

Looks in routing table: "I have a route to 192.168.1.0/24"

↓

Action: Forward packet to 10.0.0.2 (next-hop IP)

↓

Router 10.0.0.2 receives and continues forwarding

#   


2\. Forward Directly to Destination (Directly Connected)

Route: "192.168.1.0/24 is directly connected to my G0/1 interface"

#   


Router receives packet destined for 192.168.1.100

↓

Looks in routing table: "192.168.1.0/24 is on my G0/1 interface"

↓

Action: Send packet directly out G0/1 to destination

#   


3\. Receive for Itself

Route: "10.0.0.0/24 is my own interface"

#   


Router receives packet destined for 10.0.0.1 (its own IP)

↓

Looks in routing table: "This is MY IP address"

↓

Action: Don't forward, receive packet and process it

#   


### Viewing the Routing Table

Router# show ip route

#   


This displays all routes the router knows about.

Output includes:

Gateway of last resort is not set

#   


 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 10.0.0.0/24 is directly connected, GigabitEthernet0/0

L 10.0.0.1/32 is directly connected, GigabitEthernet0/0

 192.168.0.0/16 is variably subnetted, 2 subnets, 2 masks

C 192.168.1.0/24 is directly connected, GigabitEthernet0/1

L 192.168.1.254/32 is directly connected, GigabitEthernet0/1

S 192.168.2.0/24 \[1/0\] via 10.0.0.2

#   


Legend:

C = Connected (directly connected)

L = Local (router's own IP)

S = Static (manually configured)

D = Dynamic (learned from routing protocol)

R = RIP, O = OSPF, B = BGP (dynamic protocols)

#   


---

## Routing Methods

There are two main ways routers learn routes and populate their routing tables:

### 1. Static Routing

What it is:

- Network engineer/administrator manually configures routes
- Routes do NOT change automatically
- Engineer must manually update routes if network changes

Advantages:

- Simple to understand and implement
- No overhead (no routing protocol traffic)
- Secure (no routing information shared automatically)
- Good for small networks

Disadvantages:

- Must manually configure every route
- Doesn't adapt if network fails or changes
- Not scalable for large networks
- Time-consuming to maintain

When to use:

- Small networks (&lt; 10 routers)
- Point-to-point links (few destinations)
- Labs and testing
- When security requires manual control

### 2. Dynamic Routing

What it is:

- Routers automatically share routing information with each other
- Routers learn and update routes automatically
- Routes adapt when network conditions change

Advantages:

- Automatic route discovery and updates
- Adapts to network failures
- Scalable for large networks
- Less manual configuration
- Load balancing across multiple paths

Disadvantages:

- More complex to configure and understand
- Uses network bandwidth and CPU (routing protocol overhead)
- Slower initial convergence
- Security concerns (routing information shared)

Common Dynamic Routing Protocols:

<div dir="ltr" id="bkmrk-protocol-type-purpos" style="text-align:left;"><table><colgroup><col style="width:324px;"></col><col style="width:109px;"></col><col style="width:191px;"></col></colgroup><tbody><tr><td>Protocol

</td><td>Type

</td><td>Purpose

</td></tr><tr><td>RIP (Routing Information Protocol)

</td><td>Distance Vector

</td><td>Simple, outdated

</td></tr><tr><td>OSPF (Open Shortest Path First)

</td><td>Link State

</td><td>Industry standard, widely used

</td></tr><tr><td>EIGRP (Enhanced Interior Gateway Routing Protocol)

</td><td>Hybrid

</td><td>Cisco proprietary, powerful

</td></tr><tr><td>BGP (Border Gateway Protocol)

</td><td>Path Vector

</td><td>Internet routing

</td></tr></tbody></table>

</div>When to use:

- Medium to large networks
- Complex topologies
- Multiple paths to destinations
- Networks with redundancy
- When automatic failover is needed

---

## WANs (Wide Area Networks)

### What is a WAN?

A Wide Area Network (WAN) is a network that extends over a large geographic area — typically connecting multiple locations (cities, countries, or across the Internet).

Characteristics:

- Connects different LANs together
- Uses routers to connect
- Often uses leased lines or Internet as backbone
- Lower bandwidth and higher latency than LANs
- Can span great distances

Example WAN Architecture:

 \[LAN A\]

 |

 Router A ←→ Router B ← WAN Link (Internet or Leased Line)

 | |

 \[LAN B\] \[LAN C\]

#   


Routers A and B are connected via WAN

Each router serves its local LAN

Users in LAN A can reach LAN B/C through routers

#   


### LAN vs WAN

<div dir="ltr" id="bkmrk-feature-lan-wan-size" style="text-align:left;"><table><colgroup><col style="width:91px;"></col><col style="width:188px;"></col><col style="width:191px;"></col></colgroup><tbody><tr><td>Feature

</td><td>LAN

</td><td>WAN

</td></tr><tr><td>Size

</td><td>Single building/floor

</td><td>Multiple locations

</td></tr><tr><td>Speed

</td><td>Fast (100 Mbps - 10 Gbps)

</td><td>Slower (1-100 Mbps)

</td></tr><tr><td>Devices

</td><td>Switches, local routers

</td><td>Routers, modems, firewalls

</td></tr><tr><td>Latency

</td><td>Low (&lt; 1ms)

</td><td>Higher (10-100+ ms)

</td></tr><tr><td>Ownership

</td><td>Single organization

</td><td>Often shared/rented

</td></tr><tr><td>Cost

</td><td>Lower per Mbps

</td><td>Higher per Mbps

</td></tr></tbody></table>

</div>---

## Static Routing Configuration

### Basic Static Route Syntax

Router(config)# ip route &lt;destination-network&gt; &lt;subnet-mask&gt; &lt;next-hop-ip&gt;

#   


Components:

- destination-network — The network you want to reach (e.g., 192.168.2.0)
- subnet-mask — Netmask of that network (e.g., 255.255.255.0)
- next-hop-ip — IP address of the next router (e.g., 10.0.0.2)

### Example 1: Basic Static Route

Scenario:

- Router A at 10.0.0.1 needs to reach network 192.168.2.0/24
- Router B (next-hop) is at 10.0.0.2 on a shared link with Router A

Configuration:

RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2

#   


Translation: "To reach 192.168.2.0/24, send packets to my neighbor at 10.0.0.2"

Result in routing table:

S 192.168.2.0/24 \[1/0\] via 10.0.0.2

#   


### Example 2: Multiple Static Routes

Scenario:

Router A needs to reach two different networks:

RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2

RouterA(config)# ip route 172.16.0.0 255.255.0.0 10.0.0.3

#   


Result:

- Packets destined for 192.168.2.x go to 10.0.0.2
- Packets destined for 172.16.x.x go to 10.0.0.3

### Static Route Configuration with Exit Interface

Alternative Syntax (for point-to-point links):

Router(config)# ip route &lt;destination-network&gt; &lt;subnet-mask&gt; &lt;exit-interface&gt;

#   


Example:

RouterA(config)# ip route 192.168.2.0 255.255.255.0 Serial0/0/0

#   


Translation: "To reach 192.168.2.0/24, send out my Serial0/0/0 interface"

When to use:

- Point-to-point WAN links (Serial, PPP)
- When only one neighbor on the link
- More efficient on point-to-point connections

Difference:

<div dir="ltr" id="bkmrk-method-use-case-next" style="text-align:left;"><table><colgroup><col style="width:110px;"></col><col style="width:458px;"></col></colgroup><tbody><tr><td>Method

</td><td>Use Case

</td></tr><tr><td>Next-Hop IP

</td><td>Multi-access networks (Ethernet, Frame Relay with many neighbors)

</td></tr><tr><td>Exit Interface

</td><td>Point-to-point links (Serial, PPP)

</td></tr></tbody></table>

</div>### Example 3: Next-Hop vs Exit Interface

Next-Hop (for Ethernet):

RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2

 ↑

 specific neighbor IP

#   


Exit Interface (for Serial):

RouterA(config)# ip route 192.168.2.0 255.255.255.0 Serial0/0/0

 ↑

 output interface

#   


---

## Default Route

### What is a Default Route?

A default route is a "catch-all" route that handles packets destined for networks the router doesn't have specific routes for.

Use: Send unknown destinations to a central router or ISP gateway

### Default Route Configuration

Syntax:

Router(config)# ip route 0.0.0.0 0.0.0.0 &lt;next-hop-ip&gt;

#   


Or in CIDR notation:

Router(config)# ip route 0.0.0.0/0 &lt;next-hop-ip&gt;

#   


Translation: "For any destination I don't have a more specific route for, send to this router"

Common notation: The default route is often written as 0.0.0.0/0 (the "default route")

### Example: Setting a Default Route

Scenario:

Small office network with single ISP connection

Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1

#   


Translation: "For any destination not in my routing table, send to the ISP gateway at 203.0.113.1"

Result:

S\* 0.0.0.0/0 \[1/0\] via 203.0.113.1

 \* indicates this is the default route

#   


### Route Precedence (Most Specific Wins)

When multiple routes match a destination, the router uses the most specific route:

Routing table:

0.0.0.0/0 → 203.0.113.1 (default route)

192.168.2.0/24 → 10.0.0.2 (specific route)

192.168.2.0/25 → 10.0.0.3 (more specific)

#   


Packet destined for:

#   


192.168.2.10 → Uses 192.168.2.0/25 (longest prefix match — /25 most specific)

192.168.3.10 → Uses 0.0.0.0/0 (default — no other match)

172.16.0.1 → Uses 0.0.0.0/0 (default — no other match)

#   


---

## Static Routing Configuration Example

### Complete Scenario

Network setup:

 \[PC A\]

 |

 \[Switch\]

 |

 Router A ────WAN Link──── Router B ────\[Switch\]──── \[PC B\]

 10.0.0.1 (Serial) 10.0.0.2 192.168.1.0/24

Router A is in: 10.0.0.0/24

Router B is in: 10.0.0.0/24 and 192.168.1.0/24

#   


Requirements:

- PC A (in 10.0.0.0 LAN) needs to reach PC B (in 192.168.1.0 LAN)
- Need static routes on both routers

Configuration on Router A:

RouterA(config)# ip route 192.168.1.0 255.255.255.0 10.0.0.2

RouterA(config)# end

#   


RouterA# show ip route

S 192.168.1.0/24 \[1/0\] via 10.0.0.2

#   


Configuration on Router B:

RouterB(config)# ip route 10.0.0.0 255.255.255.0 10.0.0.1

RouterB(config)# end

#   


RouterB# show ip route

S 10.0.0.0/24 \[1/0\] via 10.0.0.1

#   


Result:

- Router A knows how to reach 192.168.1.0/24 (sends to Router B)
- Router B knows how to reach 10.0.0.0/24 (sends to Router A)
- PC A can now ping and communicate with PC B

### Verifying Routes

Check routing table:

Router# show ip route

#   


Test connectivity:

Router# ping 192.168.1.100

#   


Trace packet path:

Router# traceroute 192.168.1.100

#   


---

## Comparison: Static vs Dynamic Routing

### When to Use Static Routing

✅ Good for:

- Small networks (&lt; 10 routers)
- Simple, stable topologies
- Point-to-point links
- High security requirements
- Lab/testing environments
- When you want complete control

❌ Not good for:

- Large networks
- Complex topologies
- Frequent topology changes
- Networks requiring redundancy
- Automatic failover

### When to Use Dynamic Routing

✅ Good for:

- Large networks (&gt; 10 routers)
- Complex topologies
- Multiple paths to destinations
- Automatic redundancy/failover
- Networks that change frequently
- Production enterprise networks

❌ Not good for:

- Very small networks (overhead not worth it)
- When bandwidth is extremely limited
- When security isolation is critical
- Simple point-to-point links

---

## Static Route Commands Reference

### Configuration

<div dir="ltr" id="bkmrk-command-purpose-ip-r" style="text-align:left;"><table><colgroup><col style="width:297px;"></col><col style="width:165px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>ip route &lt;dest&gt; &lt;mask&gt; &lt;next-hop&gt;

</td><td>Add static route

</td></tr><tr><td>ip route &lt;dest&gt; &lt;mask&gt; &lt;exit-int&gt;

</td><td>Add route via interface

</td></tr><tr><td>ip route 0.0.0.0 0.0.0.0 &lt;next-hop&gt;

</td><td>Configure default route

</td></tr><tr><td>no ip route &lt;dest&gt; &lt;mask&gt; &lt;next-hop&gt;

</td><td>Delete static route

</td></tr></tbody></table>

</div>### Verification

<div dir="ltr" id="bkmrk-command-purpose-show" style="text-align:left;"><table><colgroup><col style="width:211px;"></col><col style="width:239px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>show ip route

</td><td>Display entire routing table

</td></tr><tr><td>show ip route static

</td><td>Show only static routes

</td></tr><tr><td>show ip route 192.168.1.0

</td><td>Show route for specific destination

</td></tr><tr><td>ping &lt;ip&gt;

</td><td>Test connectivity

</td></tr><tr><td>traceroute &lt;ip&gt;

</td><td>Trace path to destination

</td></tr></tbody></table>

</div>### Example Session

Router# configure terminal

Router(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2

Router(config)# ip route 192.168.3.0 255.255.255.0 10.0.0.2

Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1

Router(config)# exit

#   


Router# show ip route

 10.0.0.0/24 is directly connected, GigabitEthernet0/0

S 192.168.2.0/24 \[1/0\] via 10.0.0.2

S 192.168.3.0/24 \[1/0\] via 10.0.0.2

S\* 0.0.0.0/0 \[1/0\] via 203.0.113.1

#   


Router# ping 192.168.2.100

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echoes to 192.168.2.100, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/5 ms

#   


---

## Key Differences: Switches vs Routers in Network

<div dir="ltr" id="bkmrk-feature-switch-route" style="text-align:left;"><table><colgroup><col style="width:190px;"></col><col style="width:143px;"></col><col style="width:186px;"></col></colgroup><tbody><tr><td>Feature

</td><td>Switch

</td><td>Router

</td></tr><tr><td>Layer

</td><td>Layer 2 (Data Link)

</td><td>Layer 3 (Network)

</td></tr><tr><td>Forwards within/between

</td><td>Within LANs

</td><td>Between LANs/Networks

</td></tr><tr><td>Uses

</td><td>MAC addresses

</td><td>IP addresses

</td></tr><tr><td>Table

</td><td>MAC address table

</td><td>Routing table

</td></tr><tr><td>Decision

</td><td>Destination MAC

</td><td>Destination IP

</td></tr><tr><td>Broadcasts

</td><td>Floods to all ports

</td><td>Blocks/filters

</td></tr><tr><td>Default behavior

</td><td>Active

</td><td>Interfaces down by default

</td></tr></tbody></table>

</div>---

## Key Takeaways for CCNA

✅ Routing is how packets move between different networks using destination IP addresses

✅ Routing table stores all known routes; router uses it for forwarding decisions

✅ Static routing = manual configuration; good for small, stable networks

✅ Dynamic routing = automatic discovery; good for large, complex networks

✅ WAN connects separate LANs over large geographic distances

✅ Default route (0.0.0.0/0) catches packets with no other matching route

✅ Static route syntax: ip route &lt;destination&gt; &lt;mask&gt; &lt;next-hop-ip&gt;

✅ Exit interface method used for point-to-point links; next-hop method for multi-access

✅ Routes point to next-hop IP or exit interface — tells router where to send packets

✅ Most specific route wins when multiple routes match a destination (longest prefix match)

✅ Router must have routes in both directions for bidirectional communication

✅ Directly connected routes appear as 'C' in routing table; don't need to be configured

✅ Local routes (L) are the router's own IP addresses; handled automatically

✅ show ip route displays routing table; includes source and metric information

✅ Routers separate broadcast domains — broadcasts don't cross router interfaces

# Day 12: Life of a Packet

# Life of a Packet

## Overview

What is the "Life of a Packet"?

The life of a packet traces the complete journey of a single packet as it travels from source to destination across multiple networks, through switches and routers, with different headers being applied and modified at each stage.

Core Principle:

A packet passes through many network devices and may traverse multiple networks. As it travels:

- IP addresses (Layer 3) NEVER change — they identify the source and destination hosts
- MAC addresses (Layer 2) CHANGE at every hop — they identify the current sender and next receiver

This distinction is critical for understanding how networks actually work.

---

## The Big Picture: Layer 3 vs Layer 2

### IP Addresses (Layer 3) — End-to-End

IP addresses remain CONSTANT throughout the packet's journey.

SOURCE IP: 192.168.1.100

DESTINATION IP: 192.168.2.100

#   


These never change, no matter how many routers the packet passes through.

They identify the ultimate SOURCE and DESTINATION hosts.

#   


Purpose: Tell routers where the packet needs to go (the final destination)

Used by: Routers to make forwarding decisions

### MAC Addresses (Layer 2) — Hop-by-Hop

MAC addresses CHANGE at every hop — new source and destination at each step.

Each interface on a network device (router, switch) has its OWN MAC address.

As a packet travels, different interfaces add their own MAC addresses.

#   


Hop 1: Source MAC = PC's NIC, Destination MAC = Router's G0/0 interface

Hop 2: Source MAC = Router's G0/1 interface, Destination MAC = Next Router's interface

Hop 3: Source MAC = Next Router's interface, Destination MAC = Destination host's NIC

#   


Purpose: Tell the next device where to send the frame (the immediate next hop)

Used by: Switches to forward within LANs, routers to forward between LANs

### Why This Matters

Analogy: Sending a letter through the mail

#   


IP Address = Your home address + recipient's home address

 (Written on the envelope, never changes)

MAC Address = Current postal worker + Next postal facility

 (Changes at each facility — each worker adds/removes their stamp)

#   


---

## Packet Structure Review

### Layers of Encapsulation

┌─────────────────────────────────────┐

│ Application Data (HTTP, etc) │

├─────────────────────────────────────┤

│ TCP/UDP Header (Source Port, │

│ Destination Port, Sequence, etc) │ ← Layer 4 PDU

├─────────────────────────────────────┤

│ IPv4 Header (Source IP, │

│ Destination IP, TTL, Protocol) │ ← Layer 3 PDU / IP Packet

├─────────────────────────────────────┤

│ Ethernet Header (Dest MAC, │

│ Source MAC, Type) │ ← Layer 2 PDU / Ethernet Frame

│ Ethernet Trailer (FCS) │

└─────────────────────────────────────┘

#   


### Field Order Matters!

Critical observation: The fields appear in a specific order

In TCP Header:

\[Source IP\] \[Destination IP\] \[Source Port\] \[Destination Port\]

 ↑ ↑

 Source comes FIRST

#   


In Ethernet Header:

\[Destination MAC\] \[Source MAC\] \[Type\]

 ↑ ↑

 Destination comes FIRST (opposite of Layer 3!)

#   


This is important because it shows the different perspectives:

- Layer 3 focuses on the ultimate destination (where are we going?)
- Layer 2 focuses on the immediate next hop (who am I sending to right now?)

---

## Detailed Journey: Packet Travels Through Network

### Scenario Setup

 \[Router B\]

 10.0.0.2

 |

 WAN Link

 |

PC A ─\[Switch\]─ \[Router A\] ─────────── \[Switch\] ─── PC B

192.168.1.100 10.0.0.1 192.168.2.100

 10.0.0.2

#   


Network A:

\- PC A: IP 192.168.1.100, MAC AAAA.AAAA.AAAA

\- Router A G0/0: IP 192.168.1.1, MAC 1111.1111.1111

\- Router A G0/1: IP 10.0.0.1, MAC 2222.2222.2222

#   


WAN Link:

\- Router B G0/0: IP 10.0.0.2, MAC 3333.3333.3333

#   


Network B:

\- Router B G0/1: IP 192.168.2.1, MAC 4444.4444.4444

\- PC B: IP 192.168.2.100, MAC BBBB.BBBB.BBBB

#   


Task: PC A sends HTTP packet to PC B

---

## Step-by-Step Packet Journey

### Step 1: PC A Creates the Packet

PC A (192.168.1.100) initiates an HTTP request to PC B (192.168.2.100)

First, PC A checks if 192.168.2.100 is on the same network:

PC A's IP: 192.168.1.100/24

Network: 192.168.1.0/24 (host 100 is in this network)

#   


Destination: 192.168.2.100/24

Network: 192.168.2.0/24 (different network!)

#   


Conclusion: 192.168.2.100 is NOT on my local network

Action: Send to default gateway (router)

#   


PC A needs Router A's MAC address (192.168.1.1)

PC A sends ARP REQUEST:

 "Who has 192.168.1.1? Tell 192.168.1.100"

Router A responds with ARP REPLY:

 "I have 192.168.1.1. My MAC is 1111.1111.1111"

PC A learns: Router A's MAC = 1111.1111.1111

#   


PC A creates the packet:

┌─────────────────────────────────────────┐

│ Application Data (HTTP Request) │

├─────────────────────────────────────────┤

│ TCP Header │

│ Source Port: 50000 │

│ Destination Port: 80 │

├─────────────────────────────────────────┤

│ IPv4 Header │

│ Source IP: 192.168.1.100 ← CONSTANT

│ Destination IP: 192.168.2.100 ← CONSTANT

│ TTL: 64 ← Will decrement

├─────────────────────────────────────────┤

│ Ethernet Header │

│ Destination MAC: 1111.1111.1111 ← Router A

│ Source MAC: AAAA.AAAA.AAAA ← PC A

│ Type: 0x0800 (IPv4) │

├─────────────────────────────────────────┤

│ Ethernet Trailer (FCS) │

└─────────────────────────────────────────┘

#   


Key Point: IP addresses are already set — they will NOT change during transit!

---

### Step 2: Packet Travels on Network A (Local LAN)

PC A sends the frame out on the Ethernet to all devices on the switch

Switch processing:

Switch receives frame on port with PC A

 ↓

Examines Destination MAC: 1111.1111.1111

 ↓

Looks in MAC address table: "Where is 1111.1111.1111?"

 ↓

MAC table shows: 1111.1111.1111 is on port connected to Router A

 ↓

Action: Forward frame out that port only (known unicast)

#   


Router A receives the frame on interface G0/0

Router A receives frame on G0/0

 ↓

Examines Ethernet Destination MAC: 1111.1111.1111

 ↓

Checks local interfaces: "Is this MY MAC? Yes!"

 ↓

Action: Strip Ethernet header/trailer, examine IPv4 header

#   


---

### Step 3: Router A Processes the Packet

Router A examines the IPv4 header:

Source IP: 192.168.1.100

Destination IP: 192.168.2.100

TTL: 64

#   


Router A's routing table lookup:

 "Destination 192.168.2.100... which network? 192.168.2.0/24"

 "Where is 192.168.2.0/24? Via next-hop 10.0.0.2"

 "That's Router B at 10.0.0.2"

Action: Forward out interface G0/1 toward Router B

#   


Router A decrements TTL:

Original TTL: 64

Decremented: 64 - 1 = 63

New TTL: 63

#   


Router A creates NEW Ethernet header:

This is CRITICAL: The Ethernet header is REPLACED!

#   


Old Ethernet Header (from Network A):

 Destination MAC: 1111.1111.1111 (Router A's G0/0)

 Source MAC: AAAA.AAAA.AAAA (PC A's NIC)

#   


New Ethernet Header (for WAN Link):

 Destination MAC: 3333.3333.3333 ← Router B's G0/0

 Source MAC: 2222.2222.2222 ← Router A's G0/1

 Type: 0x0800 (IPv4)

#   


IPv4 Header (UNCHANGED):

 Source IP: 192.168.1.100 ← STILL THE SAME

 Destination IP: 192.168.2.100 ← STILL THE SAME

 TTL: 63 ← Decremented

#   


Visualization of what happened:

Before Router A processing:

┌─────────────────────────┐

│ Application Data (HTTP) │

├─────────────────────────┤

│ TCP Header │

├─────────────────────────┤

│ IPv4 Header │

│ Src: 192.168.1.100 │

│ Dst: 192.168.2.100 │

│ TTL: 64 │

├─────────────────────────┤

│ Eth Header (OLD) │

│ Dst MAC: 1111.1111.1111 │

│ Src MAC: AAAA.AAAA.AAAA │

└─────────────────────────┘

#   


After Router A processing:

┌─────────────────────────┐

│ Application Data (HTTP) │

├─────────────────────────┤

│ TCP Header │

├─────────────────────────┤

│ IPv4 Header │

│ Src: 192.168.1.100 ✓ │

│ Dst: 192.168.2.100 ✓ │

│ TTL: 63 │

├─────────────────────────┤

│ Eth Header (NEW) │

│ Dst MAC: 3333.3333.3333 │

│ Src MAC: 2222.2222.2222 │

└─────────────────────────┘

#   


---

### Step 4: Packet Travels on WAN Link

Router A sends the new frame toward Router B

Router B receives the frame on interface G0/0

Router B receives frame on G0/0

 ↓

Examines Ethernet Destination MAC: 3333.3333.3333

 ↓

Checks local interfaces: "Is this MY MAC? Yes!"

 ↓

Action: Strip Ethernet header/trailer, examine IPv4 header

#   


---

### Step 5: Router B Processes the Packet

Router B examines the IPv4 header:

Source IP: 192.168.1.100 ← Still PC A!

Destination IP: 192.168.2.100 ← Still PC B!

TTL: 63

#   


Router B's routing table lookup:

 "Destination 192.168.2.100... which network? 192.168.2.0/24"

 "Is 192.168.2.0/24 directly connected to me? Yes! On G0/1"

Action: Forward directly out interface G0/1

#   


Router B decrements TTL:

Original TTL: 63

Decremented: 63 - 1 = 62

New TTL: 62

#   


Router B creates NEW Ethernet header:

This time, destination is directly connected:

#   


Old Ethernet Header (from WAN):

 Destination MAC: 3333.3333.3333 (Router B's G0/0)

 Source MAC: 2222.2222.2222 (Router A's G0/1)

#   


Router B needs PC B's MAC address:

 Sends ARP REQUEST: "Who has 192.168.2.100? Tell me"

 PC B responds: "I have 192.168.2.100. My MAC is BBBB.BBBB.BBBB"

 Router B learns: PC B's MAC = BBBB.BBBB.BBBB

#   


New Ethernet Header (for Network B):

 Destination MAC: BBBB.BBBB.BBBB ← PC B's NIC

 Source MAC: 4444.4444.4444 ← Router B's G0/1

 Type: 0x0800 (IPv4)

#   


IPv4 Header (UNCHANGED):

 Source IP: 192.168.1.100 ← STILL THE SAME

 Destination IP: 192.168.2.100 ← STILL THE SAME

 TTL: 62 ← Decremented again

#   


---

### Step 6: Packet Travels on Network B (Local LAN)

Router B sends the frame out on the Ethernet to switch on Network B

Switch processes:

Switch receives frame on port with Router B

 ↓

Examines Destination MAC: BBBB.BBBB.BBBB

 ↓

Looks in MAC address table: "Where is BBBB.BBBB.BBBB?"

 ↓

MAC table shows: BBBB.BBBB.BBBB is on port connected to PC B

 ↓

Action: Forward frame out that port only

#   


PC B receives the frame

PC B's NIC receives frame

 ↓

Examines Ethernet Destination MAC: BBBB.BBBB.BBBB

 ↓

Checks: "Is this MY MAC? Yes!"

 ↓

Action: Accept frame, strip Ethernet header/trailer

 ↓

Examine IPv4 header

#   


---

### Step 7: PC B Processes the Packet

PC B examines the IPv4 header:

Source IP: 192.168.1.100 ← Where did this come from

Destination IP: 192.168.2.100 ← This is MY IP

TTL: 62

#   


Router processing: "Is this packet destined for ME? Yes!"

Action: Don't forward, hand to Layer 4 (TCP)

#   


PC B examines the TCP header:

Source Port: 50000 (from PC A)

Destination Port: 80 (HTTP)

#   


TCP processing: "Is port 80 open? Yes, web server is listening"

Action: Pass to HTTP application (web browser or server)

#   


PC B's HTTP application receives the data

Application layer processes the HTTP request

Web server generates HTTP response

Response is sent back toward PC A (reverse journey)

#   


---

## Summary: MAC Addresses vs IP Addresses

### What Changed / What Stayed the Same

 PC A Router A Router B PC B

 ↓ ↓ ↓ ↓

#   


Ethernet Header:

Dest MAC AAAA→1111 AAAA→3333 3333→BBBB

Src MAC AAAA←AAAA 2222←2222 4444←4444

 ↓↓ ↓↓ ↓↓

 CHANGED CHANGED CHANGED at each hop

#   


IPv4 Header:

Src IP 192.168.1.100 → 192.168.1.100 → 192.168.1.100 → 192.168.1.100

 ↓↓

 NEVER CHANGES - Identifies ultimate source

#   


Dst IP 192.168.2.100 → 192.168.2.100 → 192.168.2.100 → 192.168.2.100

 ↓↓

 NEVER CHANGES - Identifies ultimate destination

#   


TTL 64 → 63 → 62 → 61

 ↓↓ ↓↓

 DECREMENTED at each router hop

#   


---

## Key Concepts: Why MAC Changes, IP Doesn't

### IP Addresses: End-to-End Navigation

IP addresses define the final destination:

"I am PC A (192.168.1.100) and I want to send this to PC B (192.168.2.100)"

#   


This information MUST be in every packet so that:

1\. Routers know the ultimate destination

2\. The destination knows it was for them

3\. Response packets can find the way back

#   


Changing IP addresses would mean:

\- Routers wouldn't know where to send it

\- Destination wouldn't know who to respond to

#   


### MAC Addresses: Local Hop Navigation

MAC addresses define the CURRENT hop:

"Right now, send this to the interface that's my next hop"

#   


At each hop:

\- Router A says: "Send to Router B at 10.0.0.2 (MAC: 3333.3333.3333)"

\- Router B says: "Send to PC B at 192.168.2.100 (MAC: BBBB.BBBB.BBBB)"

#   


Changing MAC addresses at each hop means:

\- Devices know which interface to send the frame to immediately

\- Each interface in a router gets its own MAC address

\- The destination MAC changes based on the next hop

#   


### Analogy: Package Delivery

Package Contents:

 From: 123 Main St (IP address) ← Never changes

 To: 456 Oak Ave (IP address) ← Never changes

#   


Delivery Process:

 Postman A: "Take to Postal Hub B" (MAC address)

 Hub B Postman: "Take to Postal Hub C" (MAC address)

 Hub C Postman: "Take to 456 Oak Ave" (MAC address)

Each postman (router) has different address (MAC) for next hop

But the package's original and final addresses never change

#   


---

## Packet Journey with Port Numbers

### Understanding Port Numbers (Layer 4)

Port numbers also remain constant throughout the journey.

Source Port: 50000 (from PC A - random ephemeral port)

Destination Port: 80 (HTTP service on PC B)

#   


These identify the specific application/service:

\- Port 80 = HTTP web server

\- Port 443 = HTTPS web server

\- Port 22 = SSH

\- Port 23 = Telnet

\- Ports 49152-65535 = Ephemeral (temporary, assigned by OS)

#   


### Why Ports Don't Change

Like IP addresses, port numbers identify the endpoint services.

If routers changed port numbers, the destination wouldn't know

which service the packet was meant for.

#   


Routers don't care about port numbers (they're Layer 4).

Routers only care about:

\- Layer 3: Destination IP (where to forward)

\- Layer 2: Destination MAC (which interface to use)

#   


---

## TTL and the Journey

### TTL Decrements at Each Router

PC A sends with TTL = 64

#   


Router A:

 Receives TTL = 64

 Decrements: 64 - 1 = 63

 Forwards with TTL = 63

#   


Router B:

 Receives TTL = 63

 Decrements: 63 - 1 = 62

 Forwards with TTL = 62

#   


PC B:

 Receives with TTL = 62

 (Doesn't decrement - destination doesn't forward)

#   


### Why TTL Matters

Prevents infinite loops:

If routing loop exists (Router A → Router B → Router A):

 TTL = 64 at Router A

 TTL = 63 after Router B

 TTL = 62 at Router A again

 TTL = 61 after Router B

 ... continues ...

 TTL = 1 at Router A

 TTL = 0 after Router B → DROPPED

#   


Packet never circulates infinitely, consuming bandwidth

#   


---

## Complete Packet at Each Stage

### Stage 1: PC A Creates (Network A)

Ethernet Header:

├─ Dest MAC: 1111.1111.1111 (Router A G0/0)

├─ Src MAC: AAAA.AAAA.AAAA (PC A)

└─ Type: 0x0800

#   


IPv4 Header:

├─ Src IP: 192.168.1.100

├─ Dst IP: 192.168.2.100

├─ TTL: 64

└─ Protocol: 6 (TCP)

#   


TCP Header:

├─ Src Port: 50000

├─ Dst Port: 80

├─ Sequence: \[value\]

└─ Flags: \[SYN\]

#   


HTTP Data: "GET / HTTP/1.1..."

#   


### Stage 2: Router A Forwards (WAN)

Ethernet Header:

├─ Dest MAC: 3333.3333.3333 (Router B G0/0) ← CHANGED

├─ Src MAC: 2222.2222.2222 (Router A G0/1) ← CHANGED

└─ Type: 0x0800

#   


IPv4 Header:

├─ Src IP: 192.168.1.100 ← SAME

├─ Dst IP: 192.168.2.100 ← SAME

├─ TTL: 63 ← DECREMENTED

└─ Protocol: 6 (TCP) ← SAME

#   


TCP Header: (UNCHANGED)

├─ Src Port: 50000

├─ Dst Port: 80

├─ Sequence: \[value\]

└─ Flags: \[SYN\]

#   


HTTP Data: (UNCHANGED) "GET / HTTP/1.1..."

#   


### Stage 3: Router B Forwards (Network B)

Ethernet Header:

├─ Dest MAC: BBBB.BBBB.BBBB (PC B) ← CHANGED

├─ Src MAC: 4444.4444.4444 (Router B G0/1) ← CHANGED

└─ Type: 0x0800

#   


IPv4 Header:

├─ Src IP: 192.168.1.100 ← SAME

├─ Dst IP: 192.168.2.100 ← SAME

├─ TTL: 62 ← DECREMENTED

└─ Protocol: 6 (TCP) ← SAME

#   


TCP Header: (UNCHANGED)

├─ Src Port: 50000

├─ Dst Port: 80

├─ Sequence: \[value\]

└─ Flags: \[SYN\]

#   


HTTP Data: (UNCHANGED) "GET / HTTP/1.1..."

#   


### Stage 4: PC B Receives

Ethernet Header: (Stripped off)

#   


IPv4 Header: (Examined and passed to TCP)

├─ Src IP: 192.168.1.100 ← Identifies who sent it

├─ Dst IP: 192.168.2.100 ← "This is for me!"

├─ TTL: 62

└─ Protocol: 6 (TCP) ← "Pass to TCP handler"

#   


TCP Header: (Examined and passed to HTTP)

├─ Src Port: 50000 ← "From where?"

├─ Dst Port: 80 ← "To HTTP service"

├─ Sequence: \[value\]

└─ Flags: \[SYN\] ← "Connection attempt"

#   


HTTP Application: (Processes request)

"GET / HTTP/1.1 from PC A... Generate response"

#   


---

## Key Takeaways for CCNA

✅ IP addresses NEVER change during transit — they identify source and destination hosts

✅ MAC addresses CHANGE at every hop — they identify the current sender and next receiver

✅ Each router interface has a unique MAC address for its local network segment

✅ Routers decrement TTL by 1 at each hop to prevent infinite loops

✅ Ethernet destination MAC comes BEFORE source MAC in the header (opposite of Layer 3)

✅ Port numbers stay constant throughout the journey (identify services/applications)

✅ Routers use destination IP to determine where to forward packets

✅ Routers need destination MAC to know which interface to send the frame to

✅ If destination not directly connected, router uses next-hop IP (from routing table) to determine destination MAC

✅ Switches use destination MAC to forward frames within LANs; routers replace MAC at each hop

✅ Packet encapsulation remains as it travels — each layer's header is examined then passed down/up

✅ Return packets follow reverse path but go through same address transformations (MAC changes, IP stays same)

✅ ARP resolves IP addresses to MAC addresses when router needs to forward to next hop or final destination

✅ TTL reaching 0 causes packet to be dropped (prevents routing loop packet storms)

✅ Each device on path adds only its own MAC as source — never "hops" across multiple devices in one frame

# Days 13, 14, 15: IPv4 Subnetting

# Subnetting: Comprehensive Guide (FLSM &amp; VLSM)

## Overview

What is Subnetting?

Subnetting is the process of dividing a large network into smaller subnetworks (subnets) to make more efficient use of IP address space and improve network organization.

Why Subnetting Matters:

Problem with Classful Addressing:

\- Company needs 5,000 IPs → Assigned entire Class B

\- Class B = 65,536 addresses

\- Result: 60,000+ addresses wasted!

#   


Solution: CIDR (Classless Inter-Domain Routing)

\- Remove class restrictions

\- Split large networks into smaller, right-sized subnets

\- Much more efficient IP address utilization

#   


---

## From Classful to CIDR

### The Class System (Old)

Class A: 1.0.0.0 - 126.0.0.0 (Prefix: /8)

Class B: 128.0.0.0 - 191.255.0.0 (Prefix: /16)

Class C: 192.0.0.0 - 223.255.255.0 (Prefix: /24)

Class D: 224.0.0.0 - 239.255.255.255 (Multicast)

Class E: 240.0.0.0 - 255.255.255.255 (Reserved)

#   


Problem: Organization's network size had to fit exactly into one class (no middle ground)

### CIDR (New, Modern)

CIDR (Classless Inter-Domain Routing) introduced in 1993 by the IETF removes the class requirement.

Benefit: Any network can be split into smaller subnets of any size needed

10.0.0.0/8 → Can be split into:

 10.0.0.0/16

 10.0.0.0/24

 10.0.0.0/25

 10.0.0.0/26

 (any prefix length)

#   


---

## The Math: Calculating Subnets

### Host Bits and Usable Addresses

The Formula:

Usable Hosts = 2^n - 2

#   


n = number of HOST BITS (bits to the right of the subnet mask)

-2 = subtract network address and broadcast address (reserved)

#   


Example 1: 203.0.113.0/25

/25 means first 25 bits are the NETWORK

32 - 25 = 7 bits remaining for HOSTS

#   


Usable Hosts = 2^7 - 2 = 128 - 2 = 126 hosts

#   


Binary:

203.0.113.0 = 1100 1011 . 0000 0000 . 0111 0001 . 0 | 000 0000

 ↑

 25 bits | 7 bits

#   


Example 2: 203.0.113.0/28

/28 means first 28 bits are the NETWORK

32 - 28 = 4 bits remaining for HOSTS

#   


Usable Hosts = 2^4 - 2 = 16 - 2 = 14 hosts

#   


Binary:

203.0.113.0 = 1100 1011 . 0000 0000 . 0111 0001 . 0000 | 0000

 ↑

 28 bits | 4 bits

#   


Subnet Mask = 1111 1111 . 1111 1111 . 1111 1111 . 1111 0000

 = 255.255.255.240

#   


### Subnet Masks and CIDR Relationship

Understanding the relationship between prefix length and dotted-decimal subnet mask is critical.

<div dir="ltr" id="bkmrk-cidr-subnet-mask-hos" style="text-align:left;"><table><colgroup><col style="width:56px;"></col><col style="width:123px;"></col><col style="width:78px;"></col><col style="width:103px;"></col><col style="width:92px;"></col></colgroup><tbody><tr><td>CIDR

</td><td>Subnet Mask

</td><td>Host Bits

</td><td>Usable Hosts

</td><td>Group Size

</td></tr><tr><td>/24

</td><td>255.255.255.0

</td><td>8

</td><td>254

</td><td>256

</td></tr><tr><td>/25

</td><td>255.255.255.128

</td><td>7

</td><td>126

</td><td>128

</td></tr><tr><td>/26

</td><td>255.255.255.192

</td><td>6

</td><td>62

</td><td>64

</td></tr><tr><td>/27

</td><td>255.255.255.224

</td><td>5

</td><td>30

</td><td>32

</td></tr><tr><td>/28

</td><td>255.255.255.240

</td><td>4

</td><td>14

</td><td>16

</td></tr><tr><td>/29

</td><td>255.255.255.248

</td><td>3

</td><td>6

</td><td>8

</td></tr><tr><td>/30

</td><td>255.255.255.252

</td><td>2

</td><td>2

</td><td>4

</td></tr><tr><td>/31

</td><td>255.255.255.254

</td><td>1

</td><td>0

</td><td>2

</td></tr><tr><td>/32

</td><td>255.255.255.255

</td><td>0

</td><td>1

</td><td>1

</td></tr></tbody></table>

</div>Reading the Table:

- Smaller CIDR number = larger network (more addresses)
- Larger CIDR number = smaller network (fewer addresses)
- /30 is popular for WAN point-to-point links (2 usable IPs)

---

## Method 1: Subnetting Cheatsheet

The cheatsheet method is the fastest way to subnet for the CCNA exam.

### The Magic Cheatsheet

Group Size: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

Subnet Mask: | 128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |

Last Octet: | /25 | /26 | /27 | /28 | /29 | /30 | /31 | /32 |

3rd Octet: | /17 | /18 | /19 | /20 | /21 | /22 | /23 | /24 |

2nd Octet: | /9 | /10 | /11 | /12 | /13 | /14 | /15 | /16 |

1st Octet: | /1 | /2 | /3 | /4 | /5 | /6 | /7 | /8 |

#   


How It Works:

1. Find the CIDR prefix → Look up which row (which octet is the "magic octet")
2. Find Group Size from that row
3. Step through by Group Size starting at 0 until you PASS your target IP
4. Identify network boundaries:
    
    
    - Number BEFORE target = Network Address
    - Number AFTER target = Next Network
    - IP before next network = Broadcast Address
    - IP after network address = First Usable Host
    - IP before broadcast = Last Usable Host

### Example 1: /25 in Last Octet

Problem: Find network for 203.0.113.100/25

/25 is in the "Last Octet" row

Look across: Group Size = 128

#   


Step by 128s in last octet:

 0, 128, 256 (exceeds 255, wrap to next octet)

#   


Since 100 falls between 0 and 128:

#   


Network Address: 203.0.113.0/25

Broadcast Address: 203.0.113.127/25

First Usable Host: 203.0.113.1/25

Last Usable Host: 203.0.113.126/25

Next Network: 203.0.113.128/25

Total Usable Hosts: 2^7 - 2 = 126

### Example 2: /28 in Last Octet

Problem: Find network for 192.168.1.100/28

/28 is in the "Last Octet" row

Look across: Group Size = 16

#   


Step by 16s in last octet:

 0, 16, 32, 48, 64, 80, 96, 112, 128, ...

#   


Since 100 falls between 96 and 112:

#   


Network Address: 192.168.1.96/28

Broadcast Address: 192.168.1.111/28

First Usable Host: 192.168.1.97/28

Last Usable Host: 192.168.1.110/28

Next Network: 192.168.1.112/28

Total Usable Hosts: 2^4 - 2 = 14

### Example 3: /19 in Third Octet

Problem: Find network for 10.4.77.188/19

/19 is in the "3rd Octet" row

Look across: Group Size = 32

#   


Step by 32s in third octet (target = 77):

 0, 32, 64, 96, 128, ...

#   


Since 77 falls between 64 and 96:

#   


Network Address: 10.4.64.0/19

Broadcast Address: 10.4.95.255/19

First Usable Host: 10.4.64.1/19

Last Usable Host: 10.4.95.254/19

Next Network: 10.4.96.0/19

#   


Subnet Mask: Every octet left of 3rd = 255, every octet right = 0

 = 255.255.224.0

#   


Total Usable Hosts: 2^(32-19) - 2 = 2^13 - 2 = 8190

#   


### Example 4: /10 in Second Octet

Problem: Find network for 84.75.21.6/10

/10 is in the "2nd Octet" row

Look across: Group Size = 64

#   


Step by 64s in second octet (target = 75):

 0, 64, 128, 192, 256 (exceeds 255)

#   


Since 75 falls between 64 and 128:

#   


Network Address: 84.64.0.0/10

Broadcast Address: 84.127.255.255/10

First Usable Host: 84.64.0.1/10

Last Usable Host: 84.127.255.254/10

Next Network: 84.128.0.0/10

#   


Subnet Mask: = 255.192.0.0

#   


Total Usable Hosts: 2^(32-10) - 2 = 2^22 - 2 = 4,194,302

#   


---

## Method 2: Binary Method (Alternative)

When the cheatsheet isn't available, use the binary method.

### The Process

1. Convert IP to binary (only need to focus on the "magic octet")
2. Identify network bits vs host bits based on prefix length
3. Calculate group size from the number of host bits in the magic octet
4. Find subnet mask = 256 - Group Size
5. Divide and multiply to find network boundaries

### Example: 154.219.154.180/20

Step 1: Focus on the 3rd octet (where /20 lands)

 154.219.154.180/20

 The /20 means: /16 (all of 2nd octet) + /4 (4 bits of 3rd octet)

 3rd octet is the "magic octet"

#   


Step 2: Convert 154 to binary

 154 = 1001 1010

#   


Step 3: Identify network vs host bits

 /20 means 4 bits are NETWORK bits in this octet

 1001 | 1010 (first 4 bits are network, last 4 are host)

 ↑ network | host ↑

#   


Step 4: Calculate Group Size

 Host bits in magic octet = 4

 Group Size = 2^4 = 16

 Subnet Mask last part = 256 - 16 = 240

 Full Subnet Mask = 255.255.240.0

#   


Step 5: Find network boundaries

 Divide: 154 ÷ 16 = 9 with remainder 10

 Multiple remainder back: 9 × 16 = 144

 Network Address: 154.219.144.0/20

 Broadcast Address: 154.219.159.255/20

 (144 + 16 - 1 = 159 is the broadcast 3rd octet)

#   


Step 6: Calculate usable hosts

 Total host bits = 32 - 20 = 12

 Usable hosts = 2^12 - 2 = 4,094

#   


---

## Subnetting Class A, B, C Networks

The process is identical for all classes; only the prefix length changes based on the requirement.

### Class A Example: 10.0.0.0/8

Problem: Divide 10.0.0.0/8 into 2000 subnets. What prefix length?

Current: 10.0.0.0/8 = 2^24 = 16.7 million hosts

#   


Need 2000 subnets:

 2^10 = 1024 (not enough)

 2^11 = 2048 (enough!)

Must borrow 11 bits from host space:

 /8 + /11 = /19

#   


Network bits: 1111 1111 . 1111 1111 . 1110 0000 . 0000 0000

 = 255.255.224.0

#   


Host bits remaining: 32 - 19 = 13

Usable hosts per subnet: 2^13 - 2 = 8,190

#   


Number of subnets: 2^11 = 2,048

#   


### Class B Example: 172.16.0.0/16

Problem: Divide 172.16.0.0/16 into 50 subnets

Need 50 subnets:

 2^5 = 32 (not enough)

 2^6 = 64 (enough!)

Must borrow 6 bits from host space:

 /16 + /6 = /22

#   


Network bits: 1111 1111 . 1111 1111 . 1111 1100 . 0000 0000

 = 255.255.252.0

#   


Host bits remaining: 32 - 22 = 10

Usable hosts per subnet: 2^10 - 2 = 1,022

#   


Number of subnets: 2^6 = 64

#   


### Class C Example: 192.168.1.0/24

Problem: Divide 192.168.1.0/24 into 4 subnets

Need 4 subnets:

 2^2 = 4 (perfect!)

Must borrow 2 bits from host space:

 /24 + /2 = /26

#   


Network bits: 1111 1111 . 1111 1111 . 1111 1111 . 1100 0000

 = 255.255.255.192

#   


Host bits remaining: 32 - 26 = 6

Usable hosts per subnet: 2^6 - 2 = 62

#   


Number of subnets: 2^2 = 4

#   


The 4 subnets:

 192.168.1.0/26 (0-63)

 192.168.1.64/26 (64-127)

 192.168.1.128/26 (128-191)

 192.168.1.192/26 (192-255)

#   


---

## Variable-Length Subnet Masks (VLSM)

### Fixed-Length vs Variable-Length

FLSM (Fixed-Length Subnet Masks):

- All subnets have the SAME prefix length
- Simple, but wasteful
- Example: Divide /24 into four /26 subnets (all 62 hosts each)

Problem: One subnet needs 110 hosts, another needs 2 hosts

Solution: Would waste 60 IPs in the small subnet with FLSM

VLSM (Variable-Length Subnet Masks):

- Subnets can have DIFFERENT prefix lengths
- Right-size each subnet to its needs
- Much more efficient

Solution: /25 for large subnet (126 hosts), /30 for small subnet (2 hosts)

Result: No wasted IPs!

### VLSM Process

Key Principle: Sort subnets by size (LARGEST first), then subnet sequentially

1. Sort requirements by host count (largest first)
2. Allocate the largest with appropriate prefix length
3. Use the next available address range for the next subnet
4. Repeat for all subnets

### VLSM Example: Multiple Sites

Scenario: Split 192.168.1.0/24 for:

- Tokyo LAN A: 110 hosts
- Toronto LAN B: 45 hosts
- Toronto LAN A: 29 hosts
- Tokyo LAN B: 8 hosts
- Point-to-Point Link: 2 hosts

Step 1: Sort by Size (Largest First)

1\. Tokyo LAN A: 110 hosts → need /25 (126 usable)

2\. Toronto LAN B: 45 hosts → need /26 (62 usable)

3\. Toronto LAN A: 29 hosts → need /27 (30 usable)

4\. Tokyo LAN B: 8 hosts → need /28 (14 usable)

5\. Point-to-Point: 2 hosts → need /30 (2 usable)

#   


Step 2: Allocate Tokyo LAN A (/25)

Need: 110 hosts

Use: /25 (128 total addresses, 126 usable)

#   


Network: 192.168.1.0/25

Binary: 1000 0000 . 1010 1000 . 0000 0001 . 0 | 000 0000

Broadcast: 192.168.1.127/25

#   


First Usable: 192.168.1.1/25

Last Usable: 192.168.1.126/25

#   


Step 3: Allocate Toronto LAN B (/26)

Need: 45 hosts

Use: /26 (64 total addresses, 62 usable)

#   


Next available after 192.168.1.127 = 192.168.1.128

#   


Network: 192.168.1.128/26

Binary: 1000 0000 . 1010 1000 . 0000 0001 . 10 | 00 0000

Broadcast: 192.168.1.191/26

#   


First Usable: 192.168.1.129/26

Last Usable: 192.168.1.190/26

Step 4: Allocate Toronto LAN A (/27)

Need: 29 hosts

Use: /27 (32 total addresses, 30 usable)

#   


Next available after 192.168.1.191 = 192.168.1.192

#   


Network: 192.168.1.192/27

Binary: 1000 0000 . 1010 1000 . 0000 0001 . 110 | 0 0000

Broadcast: 192.168.1.223/27

#   


First Usable: 192.168.1.193/27

Last Usable: 192.168.1.222/27

#   


Step 5: Allocate Tokyo LAN B (/28)

Need: 8 hosts

Use: /28 (16 total addresses, 14 usable)

#   


Next available after 192.168.1.223 = 192.168.1.224

#   


Network: 192.168.1.224/28

Binary: 1000 0000 . 1010 1000 . 0000 0001 . 1110 | 0000

Broadcast: 192.168.1.239/28

#   


First Usable: 192.168.1.225/28

Last Usable: 192.168.1.238/28

#   


Step 6: Allocate Point-to-Point (/30)

Need: 2 hosts

Use: /30 (4 total addresses, 2 usable)

#   


Next available after 192.168.1.239 = 192.168.1.240

#   


Network: 192.168.1.240/30

Binary: 1000 0000 . 1010 1000 . 0000 0001 . 1111 00 | 00

Broadcast: 192.168.1.243/30

#   


First Usable: 192.168.1.241/30 (Router 1)

Last Usable: 192.168.1.242/30 (Router 2)

### VLSM Summary Table

┌─────────────────┬──────────────────┬─────────────────┬──────────────┐

│ Location │ Host Requirement │ CIDR/Mask │ Usable Hosts │

├─────────────────┼──────────────────┼─────────────────┼──────────────┤

│ Tokyo LAN A │ 110 │ 192.168.1.0/25 │ 126 │

│ Toronto LAN B │ 45 │ 192.168.1.128/26│ 62 │

│ Toronto LAN A │ 29 │ 192.168.1.192/27│ 30 │

│ Tokyo LAN B │ 8 │ 192.168.1.224/28│ 14 │

│ Point-to-Point │ 2 │ 192.168.1.240/30│ 2 │

└─────────────────┴──────────────────┴─────────────────┴──────────────┘

#   


Total 192.168.1.0/24 = 254 usable addresses

After allocation = 126 + 62 + 30 + 14 + 2 = 234 used, 20 unused

(vs FLSM would have wasted much more)

### Why VLSM Matters

Without VLSM (FLSM with /26):

4 subnets of /26 = 62 hosts each = 248 total hosts

Problem: Tokyo LAN B only needs 8 hosts → 54 wasted!

With VLSM:

Right-sized allocation = 234 used, 20 unused = efficient

Tokyo LAN B gets /28 = 14 hosts = 6 wasted (much better)

#   


---

## Subnetting Checklist

When given a subnet problem:

✅ Step 1: Identify the magic octet (which octet contains the CIDR boundary)

✅ Step 2: Extract Group Size from cheatsheet OR calculate from binary

✅ Step 3: Determine Subnet Mask (256 - Group Size for magic octet, other octets 255 or 0)

✅ Step 4: Step through by Group Size to find network boundaries

✅ Step 5: Identify:

- Network Address
- First Usable Host
- Last Usable Host
- Broadcast Address
- Next Network

✅ Step 6: Calculate total usable hosts: 2^(32 - CIDR) - 2

✅ Step 7 (VLSM only): Sort by size, allocate largest first, allocate sequentially

---

## Practice Problems

### Quick Practice Set 1

1\) 10.1.1.100/28

- Network Address?
- Broadcast?
- First/Last Usable?
- Number of Subnets from /8?

2\) 172.16.50.200/22

- Network Address?
- Broadcast?
- Total Usable Hosts?

3\) 192.168.100.0/24 divided into /28 subnets

- How many /28 subnets can you create?
- List the first 3 subnet addresses

### Solutions

1\) 10.1.1.100/28

\- Network: 10.1.1.96/28

\- Broadcast: 10.1.1.111/28

\- First: 10.1.1.97, Last: 10.1.1.110

\- Subnets from /8: 2^20 = 1,048,576

#   


2\) 172.16.50.200/22

\- Network: 172.16.48.0/22 (256-64=192, 50÷4=12r2, 12×4=48)

\- Broadcast: 172.16.51.255/22

\- Total Hosts: 2^10 - 2 = 1,022

#   


3\) 192.168.100.0/24 into /28

\- /28 group size = 16

\- 256 ÷ 16 = 16 subnets

\- Subnets: 192.168.100.0/28, 192.168.100.16/28, 192.168.100.32/28, ...

#   


---

## Practice Resources

For extra practice and mastery:

- subnettingpractice.com ⭐ (recommended)
- subnettingquestions.com
- subnetting.org

---

## Key Takeaways for CCNA

✅ CIDR replaced classful addressing to enable flexible subnet sizes

✅ Usable hosts formula: 2^n - 2 (n = number of host bits)

✅ Magic octet is where the prefix length boundary falls (1st, 2nd, 3rd, or 4th octet)

✅ Cheatsheet method is fastest for exam: step by group size, identify boundaries

✅ Subnet mask = 256 - Group Size for magic octet (other octets: 255 left, 0 right)

✅ Larger CIDR number = smaller network (fewer addresses)

✅ Smaller CIDR number = larger network (more addresses)

✅ FLSM = all subnets same size (simple, may waste IPs)

✅ VLSM = variable subnet sizes (efficient, complex)

✅ VLSM key rule: Sort by size (largest first), allocate sequentially

✅ /30 networks are standard for point-to-point WAN links (2 usable IPs)

✅ Network address has all host bits = 0

✅ Broadcast address has all host bits = 1

✅ Usable host range = Network + 1 to Broadcast - 1

✅ Next network = Broadcast + 1

# Days 16, 17, 18: VLANs

# VLANs: CCNA Reference Sheet

## Core Definitions

VLAN (Virtual LAN): Logical grouping of network devices; segments a physical network into isolated broadcast domains at Layer 2 (Data Link Layer).

LAN / Broadcast Domain: Single group of devices receiving broadcast frames (Dst MAC: FFFF.FFFF.FFFF) sent by any member.

Access Port: Belongs to a single VLAN; connects to end hosts; does NOT tag frames.

Trunk Port: Carries traffic from multiple VLANs over a single link using VLAN tagging; connects switches/routers.

Native VLAN: Special VLAN on trunk port that does NOT get tagged when sent; default = VLAN 1.

802.1Q Tag: 4-byte VLAN tag inserted between Src MAC and Type/Length fields in Ethernet frame.

Switch Virtual Interface (SVI): Virtual Layer 3 interface on multilayer switch representing a VLAN; acts as default gateway.

Layer 3 Switch / Multilayer Switch: Device combining switch (L2) + router (L3) functionality; performs inter-VLAN routing internally.

---

## VLAN Benefits vs. Drawbacks

<div dir="ltr" id="bkmrk-issue-without-vlan-w" style="text-align:left;"><table><colgroup><col style="width:112px;"></col><col style="width:275px;"></col><col style="width:237px;"></col></colgroup><tbody><tr><td>Issue

</td><td>Without VLAN

</td><td>With VLAN

</td></tr><tr><td>Performance

</td><td>Broadcast floods entire network

</td><td>Broadcasts isolated to VLAN

</td></tr><tr><td>Security

</td><td>No L2 segmentation; all devices reach each other directly

</td><td>Devices can't reach other VLANs without routing

</td></tr><tr><td>Access Control

</td><td>Router policies ineffective (same LAN)

</td><td>Router can filter between VLANs

</td></tr><tr><td>Scalability

</td><td>Single broadcast domain

</td><td>Multiple isolated domains

</td></tr></tbody></table>

</div>---

## How VLANs Work

Key Rule: Switches do NOT forward traffic between VLANs.

Switch Logic:

1. Receive frame on interface in VLAN X
2. Check destination MAC
3. If destination in VLAN X → forward normally
4. If destination in different VLAN → DROP (do not forward)

Inter-VLAN Routing Required: Traffic must pass through router or Layer 3 switch.

Flow: Source VLAN → Router/L3 Switch (strips VLAN, routes IP, re-tags) → Destination VLAN

---

## Access Port Configuration

Switch(config)# vlan 10

Switch(config-vlan)# name Engineering

Switch(config-vlan)# exit

#   


Switch(config)# interface Fa0/1

Switch(config-if)# switchport mode access

Switch(config-if)# switchport access vlan 10

Switch(config-if)# exit

#   


Switch(config)# interface range Fa0/2-3

Switch(config-if-range)# switchport mode access

Switch(config-if-range)# switchport access vlan 10

Switch(config-if-range)# exit

#   


Default VLANs (cannot delete):

- VLAN 1: default (exists by default, cannot be removed)
- VLANs 1002-1005: reserved for legacy protocols

Verification:

show vlan brief → List all VLANs and assigned ports

show interfaces Fa0/1 switchport → Detailed switchport info

show vlan id 10 → Info for specific VLAN

#   


---

## Trunk Ports &amp; 802.1Q Tagging

### Trunk Configuration

Switch(config)# interface g0/0

Switch(config-if)# switchport trunk encapsulation dot1q

Switch(config-if)# switchport mode trunk

Switch(config-if)# switchport trunk native vlan 10

Switch(config-if)# switchport trunk allowed vlan 10,20,30

Switch(config-if)# exit

#   


Verification:

show interfaces trunk → Shows encapsulation, status, native VLAN, allowed VLANs

#   


### 802.1Q Tag Structure

4-Byte Tag inserted between Src MAC and Type/Length:

<div dir="ltr" id="bkmrk-field-bytes-size-pur" style="text-align:left;"><table><colgroup><col style="width:53px;"></col><col style="width:112px;"></col><col style="width:58px;"></col><col style="width:327px;"></col></colgroup><tbody><tr><td>Field

</td><td>Bytes

</td><td>Size

</td><td>Purpose

</td></tr><tr><td>TPID

</td><td>1–2

</td><td>16 bits

</td><td>Always 0x8100; indicates 802.1Q tagged frame

</td></tr><tr><td>PCP

</td><td>3 (bits 7–5)

</td><td>3 bits

</td><td>Priority Code Point (CoS: 0–7, 7=highest)

</td></tr><tr><td>DEI

</td><td>3 (bit 4)

</td><td>1 bit

</td><td>Drop Eligible Indicator; marks droppable frames

</td></tr><tr><td>VID

</td><td>3–4 (bits 11–0)

</td><td>12 bits

</td><td>VLAN ID (0–4095; usable: 1–4094)

</td></tr></tbody></table>

</div>VLAN Ranges:

- 0: Reserved (not used)
- 1–1005: Standard range
    
    
    - 1: Default (always exists)
    - 2–1005: User-defined
    - 1002–1005: Legacy protocols (reserved)
- 1006–4094: Extended range (requires special switch mode; not common in CCNA)
- 4095: Reserved (not used)
- Total usable: 1–4094 (4,094 VLANs)

### Native VLAN

Behavior:

- Frames on native VLAN are sent untagged (no 4-byte tag)
- Smaller frame size (4 bytes smaller); faster transmission
- Default native VLAN = VLAN 1

Critical Rule: Native VLAN must MATCH on both ends of trunk or frames go to wrong VLAN.

Example Mismatch:

SW1: Native VLAN = 10

SW2: Native VLAN = 1

#   


Result:

 SW1 sends VLAN 10 untagged

 SW2 receives untagged frames on VLAN 1 (wrong!)

 → VLAN mismatch

#   


Configuration:

Switch(config-if)# switchport trunk native vlan 10

#   


---

## Router on a Stick (ROAS)

Use Case: Route between VLANs when router has only one physical interface.

Switch Configuration (Trunk):

Switch(config)# interface g0/0

Switch(config-if)# switchport mode trunk

Switch(config-if)# switchport trunk encapsulation dot1q

Switch(config-if)# exit

#   


Router Configuration (Sub-Interfaces):

Router(config)# interface g0/0

Router(config-if)# no shutdown

Router(config-if)# exit

#   


Router(config)# interface g0/0.10

Router(config-subif)# encapsulation dot1q 10

Router(config-subif)# ip address 192.168.10.254 255.255.255.0

Router(config-subif)# exit

#   


Router(config)# interface g0/0.20

Router(config-subif)# encapsulation dot1q 20

Router(config-subif)# ip address 192.168.20.254 255.255.255.0

Router(config-subif)# exit

#   


Router(config)# interface g0/0.30

Router(config-subif)# encapsulation dot1q 30

Router(config-subif)# ip address 192.168.30.254 255.255.255.0

Router(config-subif)# exit

#   


Native VLAN Methods:

- Method 1: encapsulation dot1q 10 native (sub-interface)
- Method 2: IP address on physical interface = native VLAN (VLAN 10)

Verification:

show ip interface brief → Shows sub-interfaces and status

show ip route → Routing table for all VLANs

#   


How ROAS Works:

1. Router receives tagged frame on g0/0
2. Router examines VLAN tag (e.g., VLAN 10)
3. Router directs to sub-interface g0/0.10
4. Sub-interface routes based on IP address
5. Reply sent out appropriate sub-interface with VLAN tag re-added

---

## Layer 3 Switching &amp; SVIs

Layer 3 Switch: Combines switching (L2) + routing (L3) internally; no external router needed for inter-VLAN routing.

Advantages:

- Performance: Inter-VLAN routing via ASICs (hardware-based); much faster than ROAS
- Cost: Single device replaces switch + router
- Simplicity: All VLAN management in one device
- Scalability: Supports many VLANs with fast internal routing

### SVI (Switch Virtual Interface) Configuration

Switch(config)# ip routing → Enable routing on switch

#   


Switch(config)# interface vlan 10

Switch(config-if)# ip address 192.168.10.254 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# exit

#   


Switch(config)# interface vlan 20

Switch(config-if)# ip address 192.168.20.254 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# exit

#   


Switch(config)# interface vlan 30

Switch(config-if)# ip address 192.168.30.254 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# exit

#   


SVI Status Conditions (must be "up/up"):

1. VLAN must exist on switch
2. At least ONE active port in VLAN (access or trunk allowing VLAN) must be "up/up"
3. SVI must not be shut down

SVI Status Meanings:

- up/up: SVI operational; VLAN exists; active port present; SVI not shut down
- down/down: VLAN missing, no active ports, or SVI is shut down

Verification:

show interface vlan 10 → Detailed SVI info (status, IP, MAC)

show ip interface brief → All L3 interfaces and status

show ip route → Routing table

#   


### Converting ROAS to Layer 3 Switching

Remove ROAS from Router:

Router(config)# no interface g0/0.10

Router(config)# no interface g0/0.20

Router(config)# no interface g0/0.30

Router(config)# interface g0/0

Router(config-if)# ip address 192.168.1.194 255.255.255.0

Router(config-if)# no shutdown

#   


Configure Multilayer Switch:

Switch(config)# ip routing

#   


Switch(config)# interface g0/0

Switch(config-if)# no switchport → Convert to Layer 3 routed port

Switch(config-if)# ip address 192.168.1.193 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# exit

#   


Switch(config)# interface vlan 10

Switch(config-if)# ip address 192.168.10.254 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# exit

#   


Switch(config)# interface vlan 20

Switch(config-if)# ip address 192.168.20.254 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# exit

#   


Switch(config)# interface vlan 30

Switch(config-if)# ip address 192.168.30.254 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# exit

#   


Switch(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.194 → Default route to external router

#   


---

## Key Principles &amp; Edge Cases

✅ Switches do NOT forward traffic between VLANs — routing required (core rule)

✅ Broadcast isolation = PRIMARY benefit (improves performance &amp; security)

✅ Access ports untagged; trunk ports tagged

✅ Native VLAN mismatch = frames routed to wrong VLAN (critical issue)

✅ VLAN 1 (default) cannot be deleted or removed from trunk allowed vlan list

✅ Sub-interface on router appears as separate interface in show ip interface output

✅ ROAS bottleneck: Single link carries all inter-VLAN traffic; Layer 3 switch faster

✅ SVI requires "up/up" status: VLAN must exist + active port in VLAN required

✅ Native VLAN = default VLAN 1 unless explicitly changed on both ends

✅ 802.1Q (IEEE standard); ISL (Cisco proprietary, obsolete)

---

## Complete Command Reference

### VLAN Creation &amp; Deletion

show vlan brief → List all VLANs and ports

show vlan id 10 → Details for VLAN 10

show interfaces Fa0/1 switchport → Port VLAN assignment

vlan 10 → Enter VLAN config mode

name Engineering → Name the VLAN

no vlan 10 → Delete VLAN 10 (if no ports assigned)

#   


### Access Port

interface Fa0/1

switchport mode access

switchport access vlan 10

#   


### Trunk Port

interface g0/0

switchport trunk encapsulation dot1q

switchport mode trunk

switchport trunk native vlan 10

switchport trunk allowed vlan 10,20,30

show interfaces trunk

#   


### Router on a Stick (Sub-Interfaces)

interface g0/0

no shutdown

#   


interface g0/0.10

encapsulation dot1q 10

ip address 192.168.10.254 255.255.255.0

#   


show ip interface brief

show ip route

#   


### Layer 3 Switch (SVIs)

ip routing → Enable routing globally

interface vlan 10 → Create SVI for VLAN 10

ip address 192.168.10.254 255.255.255.0

no shutdown

#   


interface g0/0 → Convert to routed port

no switchport

ip address 192.168.1.193 255.255.255.0

no shutdown

#   


ip route 0.0.0.0 0.0.0.0 192.168.1.194 → Default route

#   


show ip interface brief

show ip route

#   


---

## CCNA Exam Essentials

<div dir="ltr" id="bkmrk-concept-key-detail-v" style="text-align:left;"><table><colgroup><col style="width:124px;"></col><col style="width:401px;"></col></colgroup><tbody><tr><td>Concept

</td><td>Key Detail

</td></tr><tr><td>VLAN Isolation

</td><td>Switches block frames between VLANs; routing required

</td></tr><tr><td>Default VLAN

</td><td>VLAN 1; cannot delete or remove from trunk allowed list

</td></tr><tr><td>Access Ports

</td><td>Single VLAN; end-host facing; untagged frames

</td></tr><tr><td>Trunk Ports

</td><td>Multiple VLANs; switch/router facing; tagged frames

</td></tr><tr><td>802.1Q Tag

</td><td>4 bytes: TPID (0x8100) + PCP (3b) + DEI (1b) + VID (12b)

</td></tr><tr><td>VID Range

</td><td>12 bits = 0–4095; usable = 1–4094

</td></tr><tr><td>Native VLAN

</td><td>Untagged; must match on both ends or mismatch occurs

</td></tr><tr><td>ROAS

</td><td>Sub-interfaces on single physical link; bottleneck risk

</td></tr><tr><td>Layer 3 Switch

</td><td>Internal routing (ASICs); SVIs = default gateways

</td></tr><tr><td>SVI Status

</td><td>up/up requires: VLAN exists + active port + not shut down

</td></tr></tbody></table>

</div>---

# Day 19: DTP and VTP Protocols

# DTP &amp; VTP: CCNA Reference Sheet

## Overview

DTP (Dynamic Trunking Protocol): Auto-negotiates port mode (access vs trunk). Enabled by default; should be disabled for security.

VTP (VLAN Trunking Protocol): Auto-syncs VLAN database across switches. Default mode = SERVER; rarely used in modern networks; high risk.

Both not in official CCNA 200-301 syllabus but useful for understanding why manual configuration is recommended.

---

## Part 1: DTP (Dynamic Trunking Protocol)

### Core Concept

DTP automatically negotiates whether switch port should be access or trunk instead of manual configuration.

Status: Enabled by default on all Cisco interfaces; NOT recommended for production (security risk).

### DTP Modes &amp; Behaviors

<div dir="ltr" id="bkmrk-mode-command-behavio" style="text-align:left;"><table><colgroup><col style="width:99px;"></col><col style="width:148px;"></col><col style="width:241px;"></col><col style="width:135px;"></col></colgroup><tbody><tr><td>Mode

</td><td>Command

</td><td>Behavior

</td><td>Forms Trunk?

</td></tr><tr><td>Access

</td><td>switchport mode access

</td><td>Forces access port; actively prevents trunk; will not negotiate

</td><td>No (blocks trunk)

</td></tr><tr><td>Trunk

</td><td>switchport mode trunk

</td><td>Forces trunk; negotiates trunk formation with other switches

</td><td>Yes (if other side compatible)

</td></tr><tr><td>Dynamic Desirable

</td><td>switchport mode dynamic desirable

</td><td>ACTIVE mode; proactively tries to form trunk; negotiates with trunk/dyn-des/dyn-auto

</td><td>Yes (if other side allows)

</td></tr><tr><td>Dynamic Auto

</td><td>switchport mode dynamic auto

</td><td>PASSIVE mode; waits for other side to try; negotiates only if other side initiates

</td><td>Only if other side is trunk/dyn-des

</td></tr></tbody></table>

</div>Critical Distinction:

- Dynamic Desirable = Active (initiates trunk negotiation)
- Dynamic Auto = Passive (waits to be asked)
- Two Auto ports = NO trunk (both passive; neither initiates)

### DTP Compatibility Matrix

When ports connect to each other, which result in trunk formation?

 | Access | Trunk | Dyn Des | Dyn Auto

\-----------------+--------+-------+---------+----------

Access | Access | ✗ | Access | Access

Trunk | ✗ | Trunk | Trunk | Trunk

Dynamic Desirable| Access | Trunk | Trunk | Trunk

Dynamic Auto | Access | Trunk | Trunk | Access

#   


Key Rules:

- Access ↔ Trunk = MISMATCH (configuration error; no communication)
- Access wins in negotiation (dynamic modes default down to access if connected to access)
- Active always wins (Dynamic Desirable forces trunk with Dynamic Auto)
- Both Passive = Access (two Dynamic Auto ports cannot negotiate trunk)

### Default DTP Modes

Legacy Switches: switchport mode dynamic desirable (older networks needed trunks by default)

Modern Switches: switchport mode dynamic auto (explicit trunking recommended)

### DTP with Non-Cisco Devices

Non-Cisco Device (router, PC, non-Cisco switch):

├─ Does NOT understand DTP frames

├─ Ignores DTP messages

├─ Defaults to ACCESS MODE

└─ Result: Safe (no unintended trunk formed)

#   


### Encapsulation Negotiation

On older switches supporting both 802.1Q and ISL:

switchport trunk encapsulation negotiate (default)

 ↓

DTP negotiates which to use

 ├─ If both support ISL: ISL selected (favored)

 ├─ If only 802.1Q: 802.1Q selected

 └─ DTP frames sent in VLAN 1 (ISL) or native VLAN (802.1Q)

#   


Modern Switches:

 └─ Only 802.1Q supported; no negotiation needed

#   


### Disabling DTP (Security Best Practice)

Option 1: Set explicit mode

switchport mode access (disables DTP, forces access)

switchport mode trunk (disables DTP, forces trunk)

#   


Option 2: Disable negotiation on trunks

switchport mode trunk

switchport nonegotiate (disables DTP while maintaining trunk mode)

#   


Best Practice:

Access Ports:

 switchport mode access

#   


Trunk Ports:

 switchport mode trunk

 switchport nonegotiate

#   


### Why Disable DTP?

Security Risks:

- Accidental trunking from misconfiguration
- DTP overhead in production
- Unexpected negotiation behavior (two auto ports fail silently)
- Unintended VLAN access

Recommendation: Manually configure all ports; disable DTP explicitly.

---

## Part 2: VTP (VLAN Trunking Protocol)

### Core Concept

VTP automatically synchronizes VLAN database across switches in same domain instead of manual VLAN creation on every switch.

Status: Default mode = SERVER; rarely used in modern networks; high risk of accidental VLAN deletion.

### VTP Versions

<div dir="ltr" id="bkmrk-version-vlan-range-t" style="text-align:left;"><table><colgroup><col style="width:64px;"></col><col style="width:87px;"></col><col style="width:78px;"></col><col style="width:104px;"></col><col style="width:107px;"></col><col style="width:184px;"></col></colgroup><tbody><tr><td>Version

</td><td>VLAN Range

</td><td>Token Ring

</td><td>NVRAM Client

</td><td>Extended VLAN

</td><td>Use

</td></tr><tr><td>v1

</td><td>1–1005

</td><td>No

</td><td>No (RAM only)

</td><td>No

</td><td>Obsolete

</td></tr><tr><td>v2

</td><td>1–1005

</td><td>Yes

</td><td>No (RAM only)

</td><td>No

</td><td>Obsolete; compatible with v1

</td></tr><tr><td>v3

</td><td>1–4094

</td><td>Yes

</td><td>Yes (NVRAM)

</td><td>Yes

</td><td>Best; NOT backwards compatible

</td></tr></tbody></table>

</div>Key: v3 supports extended VLAN range (1006–4094) and stores client VLAN db in NVRAM (survives reboot).

### VTP Modes

<div dir="ltr" id="bkmrk-mode-can-modify-vlan" style="text-align:left;"><table><colgroup><col style="width:93px;"></col><col style="width:132px;"></col><col style="width:90px;"></col><col style="width:75px;"></col><col style="width:53px;"></col><col style="width:77px;"></col><col style="width:103px;"></col></colgroup><tbody><tr><td>Mode

</td><td>Can Modify VLAN?

</td><td>Syncs Database?

</td><td>Storage

</td><td>Sends Ads?

</td><td>Forwards Ads?

</td><td>Use Case

</td></tr><tr><td>Server

</td><td>✓ Add/Modify/Delete

</td><td>✓ (syncs to others)

</td><td>NVRAM

</td><td>✓

</td><td>✓

</td><td>Primary VLAN management; default mode

</td></tr><tr><td>Client

</td><td>✗ Read-only

</td><td>✓ (syncs from server)

</td><td>RAM (v1/v2) NVRAM (v3)

</td><td>✗

</td><td>✓

</td><td>Follows server; auto-syncs

</td></tr><tr><td>Transparent

</td><td>✓ Add/Modify/Delete

</td><td>✗ Independent

</td><td>NVRAM

</td><td>✗

</td><td>✓

</td><td>Lab/testing; separate domain; revision reset

</td></tr></tbody></table>

</div>Critical Behaviors:

- SERVER also acts as CLIENT — if connected to higher-revision SERVER, it syncs to match
- CLIENT cannot modify VLANs while in client mode (must switch to transparent/server first)
- TRANSPARENT forwards VTP ads (acts as relay for other domains)

### VTP Domains

VTP Domain = group of switches sharing synchronized VLAN database.

Key Points:

- Same domain = VLAN database syncs
- Different domain = no sync
- Domain name case-sensitive
- Default = NULL (unconfigured)

Automatic Domain Assignment (DANGEROUS):

New switch (domain = NULL) connects to network

 ↓

Receives VTP advertisement from SERVER

 ↓

Automatically joins advertised domain

 ├─ Domain name assigned

 ├─ VLAN database syncs to server's revision

 └─ Becomes CLIENT or SERVER (version-dependent)

#   


RISK: New switch may have outdated VLAN data

#   


### Revision Numbers: The Main Danger of VTP

Revision Number = version of VLAN database; increments with each VLAN add/modify/delete.

How It Works:

SERVER tracks revision number (starts at 0)

 ├─ Increments by 1 per VLAN change

 ├─ Advertises revision to all clients

 └─ Highest revision = "most recent" (assumed)

#   


CLIENTS assume:

 └─ Higher revision number = more up-to-date VLAN database

 └─ Will sync to any server with higher revision

#   


The Danger: Old Switch with High Revision Number

Current Network:

 ├─ Switch A (SERVER): revision 50 (correct VLANs, current)

 ├─ Switch B (CLIENT): synced to revision 50

 └─ Switch C (CLIENT): synced to revision 50

#   


Old Switch (brought up after 2 years):

 ├─ Was in network 2 years ago with revision 150

 ├─ Has 150 old VLAN changes accumulated

 ├─ Connects to network...

#   


What Happens:

 ├─ Old switch has revision 150 (higher than current 50!)

 ├─ All switches assume 150 is "latest"

 ├─ All switches sync VLAN database to old switch

 └─ ALL VLANs added in last 2 years are DELETED

 → NETWORK DOWN!

#   


Why?

 └─ Higher revision number but OLDER DATA

#   


Reset Revision Number to 0:

Method 1: Change Domain

 vtp domain unused\_domain

 vtp domain original\_domain

 (Domain change resets revision to 0)

#   


Method 2: Change to Transparent Mode

 vtp mode transparent

 (Transparent mode resets revision; remove from VTP domain)

#   


Before Connecting Old Switch:

1. Set to TRANSPARENT mode
2. Verify VLAN database is correct
3. Confirm revision = 0
4. Then connect to network

### VTP Configuration

Setup VTP SERVER:

Switch\_A(config)# vtp mode server

Switch\_A(config)# vtp domain Manufacturing

Switch\_A(config)# vtp password secure\_password

Switch\_A(config)# vlan 10

Switch\_A(config-vlan)# name Engineering

Switch\_A(config-vlan)# exit

(VLANs automatically propagate to all clients)

#   


Setup VTP CLIENT:

Switch\_B(config)# vtp mode client

Switch\_B(config)# vtp domain Manufacturing

Switch\_B(config)# vtp password secure\_password

(No VLAN configuration; auto-syncs from server)

#   


Setup TRANSPARENT (Isolated):

Switch\_C(config)# vtp mode transparent

Switch\_C(config)# vlan 30

Switch\_C(config-vlan)# name Finance

Switch\_C(config-vlan)# exit

(Maintains independent VLAN database)

#   


Verification:

show vtp status → VTP mode, domain, revision number, MD5 digest

show vlan brief → VLAN database on this switch

#   


---

## DTP vs VTP Summary

<div dir="ltr" id="bkmrk-feature-dtp-vtp-purp" style="text-align:left;"><table><colgroup><col style="width:135px;"></col><col style="width:248px;"></col><col style="width:242px;"></col></colgroup><tbody><tr><td>Feature

</td><td>DTP

</td><td>VTP

</td></tr><tr><td>Purpose

</td><td>Auto-negotiate port mode (access/trunk)

</td><td>Auto-sync VLAN database

</td></tr><tr><td>What It Controls

</td><td>Port mode (L2 switching)

</td><td>VLAN configuration (L2 management)

</td></tr><tr><td>Default Status

</td><td>ENABLED on all ports

</td><td>SERVER mode (all switches)

</td></tr><tr><td>Communication

</td><td>Sent on ports (negotiation)

</td><td>Sent via trunk ports (domain sync)

</td></tr><tr><td>Main Danger

</td><td>Accidental trunk formation

</td><td>Revision number attack (old data)

</td></tr><tr><td>Recommendation

</td><td>DISABLE (manual config)

</td><td>DO NOT USE (use management tools)

</td></tr></tbody></table>

</div>---

## Best Practices

### DTP

✓ DO: Manually configure all ports

 switchport mode access

 switchport mode trunk

 switchport nonegotiate

#   


✗ DON'T: Rely on DTP defaults

✗ DON'T: Mix dynamic modes

✗ DON'T: Connect switches without explicit mode config

#   


### VTP

✓ DO: Use TRANSPARENT mode only if isolated

 vtp mode transparent

#   


✓ DO: Reset revision before adding old switch

 vtp domain temp\_domain

 vtp domain original\_domain

#   


✗ DON'T: Use VTP in production

✗ DON'T: Connect old switches directly without mode reset

✗ DON'T: Mix VTP versions (v1/v2 incompatible with v3)

#   


---

## CCNA Exam Essentials

<div dir="ltr" id="bkmrk-concept-key-detail-d" style="text-align:left;"><table><colgroup><col style="width:170px;"></col><col style="width:407px;"></col></colgroup><tbody><tr><td>Concept

</td><td>Key Detail

</td></tr><tr><td>DTP Default

</td><td>Enabled on all Cisco interfaces

</td></tr><tr><td>Dynamic Desirable

</td><td>Active mode; proactively tries to form trunk

</td></tr><tr><td>Dynamic Auto

</td><td>Passive mode; waits for other side to try

</td></tr><tr><td>Two Auto Ports

</td><td>NO trunk (both passive; neither initiates)

</td></tr><tr><td>Access ↔ Trunk

</td><td>Mismatch; does NOT work; configuration error

</td></tr><tr><td>DTP Security

</td><td>Disable with switchport mode + switchport nonegotiate

</td></tr><tr><td>VTP Default

</td><td>SERVER mode (all switches default to server)

</td></tr><tr><td>VTP Versions

</td><td>v1 (old), v2 (old), v3 (best; 1006–4094 range)

</td></tr><tr><td>VTP Server

</td><td>Can add/modify/delete VLANs; syncs to others

</td></tr><tr><td>VTP Client

</td><td>Read-only; syncs from server

</td></tr><tr><td>VTP Transparent

</td><td>Independent VLAN db; forwards ads but doesn't sync

</td></tr><tr><td>Revision Number

</td><td>Higher = assumed more recent; old switch risk

</td></tr><tr><td>VTP Danger

</td><td>Old switch with high revision deletes all VLANs

</td></tr><tr><td>VTP Reset

</td><td>Change domain or set to transparent mode

</td></tr><tr><td>VTP Recommendation

</td><td>DO NOT USE in production; manual management safer

</td></tr><tr><td>Non-Cisco DTP

</td><td>Ignores DTP; defaults to access (safe)

</td></tr></tbody></table>

</div>

# Days 20, 21, 22: Spanning Tree Protocol

# Spanning Tree Protocol (STP &amp; RSTP): CCNA Reference Sheet

---

## Core Problem &amp; Solution

**Problem:** Redundant network paths (for reliability) create Layer 2 loops → broadcast storms and MAC flapping → network collapse.

**Solution:** STP prevents loops by blocking redundant ports while maintaining backups.

**Key Concept:** STP creates a loop-free **spanning tree** topology; redundant links disabled until primary fails.

---

## Core Definitions

**Broadcast Storm:** Frame loops indefinitely in network, multiplying copies exponentially; consumes all bandwidth; causes network collapse.

**MAC Address Flapping:** Same MAC address seen on different ports in rapid succession due to looping frames; switch continuously updates MAC table; packet forwarding becomes unreliable.

**Spanning Tree Protocol (STP):** Layer 2 protocol preventing loops by blocking some ports (BLOCKING state) while enabling others (FORWARDING); runs by default on all Cisco switches.

**Bridge Protocol Data Unit (BPDU):** STP message sent every 2 seconds (Hello Timer) containing bridge ID, root bridge ID, cost to root, and port ID; used for root election and topology discovery.

**Bridge ID:** 2-byte priority + 6-byte MAC address; lowest bridge ID wins root election (priority first, then MAC).

**Root Bridge:** "Center" of spanning tree topology; reference point for all cost calculations; all its ports are DESIGNATED and FORWARDING.

**Root Port:** ONE port per switch (except root) closest to root bridge; determined by lowest cost path to root; FORWARDING state.

**Designated Port:** ONE port per segment (collision domain) with lowest cost to root; FORWARDING state; other port in segment is NON-DESIGNATED.

**Non-Designated Port:** Remaining ports in segments; BLOCKING state; serves as backup/redundant link.

---

## Root Bridge Election &amp; Bridge ID

**Election Rule:** Lowest bridge ID becomes root; if tied, lowest MAC address breaks tie.

**Bridge ID Structure:**

```
Priority (2 bytes) + MAC Address (6 bytes)

```

**Priority:**

- Default: 32768
- Must be in increments of 4096: 0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768...
- Lower = higher priority for root
- Minimum: 0 (highest priority)

**Example Election:**

```
SW1: Priority 32768 + MAC 00:1a:2b:3c:4d:5e
SW2: Priority 32768 + MAC 00:1a:2b:3c:4d:5f

Same priority → compare MAC
SW1 has lower MAC → SW1 becomes ROOT BRIDGE

```

**Configuration:**

```
Switch(config)# spanning-tree vlan 1 root primary
  → Sets priority to 24576 (likely to be root)

Switch(config)# spanning-tree vlan 1 root secondary
  → Sets priority to 28672 (backup root; takes over if primary fails)

```

---

## STP Costs &amp; Path Selection

**Classic STP Port Costs (by link speed):**

<table id="bkmrk-speed-cost-10-mbps-1"><thead><tr><th>Speed</th><th>Cost</th></tr></thead><tbody><tr><td>10 Mbps</td><td>100</td></tr><tr><td>100 Mbps (FastEth)</td><td>19</td></tr><tr><td>1 Gbps (GigabitEth)</td><td>4</td></tr><tr><td>10 Gbps</td><td>2</td></tr></tbody></table>

**RSTP Port Costs (larger scale):**

<table id="bkmrk-speed-cost-10-mbps-2"><thead><tr><th>Speed</th><th>Cost</th></tr></thead><tbody><tr><td>10 Mbps</td><td>2,000,000</td></tr><tr><td>100 Mbps</td><td>200,000</td></tr><tr><td>1 Gbps</td><td>20,000</td></tr><tr><td>10 Gbps</td><td>2,000</td></tr></tbody></table>

**Cost Calculation:**

- Only **outgoing ports** have costs (incoming ports don't)
- Cumulative cost = sum of costs on path to root
- Lower cost = preferred path
- Switch selects **root port** = interface with lowest cost to root bridge

---

## STP Port Roles &amp; Selection

**Port Role Selection Order:**

1. **Elect Root Bridge** (lowest bridge ID) → all its ports = DESIGNATED, FORWARDING
2. **Non-root switches select ROOT PORT** (lowest cost to root; tiebreaker: lowest neighbor bridge ID, then lowest neighbor port ID)
3. **For each segment, elect DESIGNATED PORT** (lowest cost from that switch; tiebreaker: lowest bridge ID, then lowest port ID)
4. **Remaining ports = NON-DESIGNATED** (BLOCKING state)

**Tiebreaker Order:**

```
Root Port: lowest root cost → lowest neighbor bridge ID → lowest neighbor port ID → lowest local port ID

Designated Port: lowest root cost (from that switch) → lowest bridge ID → lowest port ID

```

---

## STP Port States &amp; Timers

**5 Port States:**

<table id="bkmrk-state-duration-sends"><thead><tr><th>State</th><th>Duration</th><th>Sends Data?</th><th>Learns MAC?</th><th>Receives BPDU?</th><th>Purpose</th></tr></thead><tbody><tr><td>**BLOCKING**</td><td>Indefinite</td><td>✗</td><td>✗</td><td>✗</td><td>Non-designated port; prevents loops</td></tr><tr><td>**LISTENING**</td><td>15 sec</td><td>✗</td><td>✗</td><td>✓</td><td>Verifies no topology changes before forwarding</td></tr><tr><td>**LEARNING**</td><td>15 sec</td><td>✗</td><td>✓</td><td>✓</td><td>Learns MAC addresses before forwarding traffic</td></tr><tr><td>**FORWARDING**</td><td>Indefinite</td><td>✓</td><td>✓</td><td>✓</td><td>Normal operation (root/designated ports)</td></tr><tr><td>**DISABLED**</td><td>N/A</td><td>✗</td><td>✗</td><td>✗</td><td>Port manually shut down</td></tr></tbody></table>

**State Transitions:**

```
Port Activation (blocked → forwarding):
  BLOCKING → LISTENING (15s) → LEARNING (15s) → FORWARDING
  Total: 30 seconds minimum (+ up to 20s MAX AGE = ~50s worst case)

Port Deactivation (forwarding → blocking):
  FORWARDING → BLOCKING (IMMEDIATE, no delay)
  Reason: Prevent loops; no need to verify when disabling

```

**Three Main STP Timers:**

<table id="bkmrk-timer-default-purpos"><thead><tr><th>Timer</th><th>Default</th><th>Purpose</th><th>Set By</th></tr></thead><tbody><tr><td>**Hello Timer**</td><td>2 seconds</td><td>Interval between BPDU "hello" messages</td><td>Root Bridge (affects entire network)</td></tr><tr><td>**Forward Delay**</td><td>15 seconds</td><td>Time spent in LISTENING state; also in LEARNING state</td><td>Root Bridge (affects entire network)</td></tr><tr><td>**Max Age**</td><td>20 seconds</td><td>Max wait before declaring link dead; if no BPDU for 20s, re-evaluate topology</td><td>Root Bridge (affects entire network)</td></tr></tbody></table>

**Critical Timing:**

```
Root Bridge controls ALL timers for ENTIRE network
No switch can override root bridge settings

Convergence time = MAX AGE (20s) + LISTENING (15s) + LEARNING (15s)
                 = ~50 seconds (slowest scenario)

If link fails:
  - Takes up to 20 seconds to detect (MAX AGE timeout)
  - Takes another 30 seconds for blocked port to activate
  - Total: ~50 seconds before traffic resumes on backup link
  
This is why RSTP was developed (converges in seconds)

```

---

## STP Optional Features

**PortFast:**

- Allows access port to skip LISTENING/LEARNING states
- Goes directly from BLOCKING → FORWARDING
- **ONLY on access ports connected to end hosts** (NOT on switch-to-switch links)
- Reduces activation time from 30s to ~0 seconds
- Configuration: `switchport portfast` or `spanning-tree portfast default`

**BPDU Guard:**

- Shuts down PortFast port if BPDU received
- Prevents accidental switch connection to end-host port
- Port enters ERRDISABLED state; admin alerted
- Configuration: `spanning-tree bpduguard enable` or `spanning-tree portfast bpduguard default`

**Root Guard &amp; Loop Guard:** (less critical)

- Root Guard: prevents port from becoming root port
- Loop Guard: prevents non-designated port from forwarding if no BPDU received

---

## STP vs RSTP Comparison

<table id="bkmrk-feature-classic-stp-"><thead><tr><th>Feature</th><th>Classic STP (802.1D)</th><th>RSTP (802.1w)</th></tr></thead><tbody><tr><td>**Convergence Time**</td><td>30-50 seconds</td><td>Seconds</td></tr><tr><td>**Port States**</td><td>5 (Blocking, Listening, Learning, Forwarding, Disabled)</td><td>3 (Discarding, Learning, Forwarding)</td></tr><tr><td>**Port Roles**</td><td>3 (Root, Designated, Non-designated)</td><td>4 (Root, Designated, Alternate, Backup)</td></tr><tr><td>**BPDUs Sent By**</td><td>Root bridge only</td><td>All switches (from designated ports)</td></tr><tr><td>**Link Type Awareness**</td><td>No</td><td>Yes (Edge, Point-to-point, Shared)</td></tr><tr><td>**UplinkFast Built-in**</td><td>Optional feature</td><td>Yes (Alternate Port)</td></tr><tr><td>**BackboneFast Built-in**</td><td>Optional feature</td><td>Yes (handshake)</td></tr><tr><td>**BPDU Version**</td><td>0</td><td>2</td></tr><tr><td>**Cisco Default**</td><td>PVST+</td><td>Rapid PVST+</td></tr><tr><td>**Backwards Compatible**</td><td>-</td><td>Yes (with 802.1D)</td></tr></tbody></table>

---

## RSTP Port States (3 Instead of 5)

<table id="bkmrk-state-replaces-behav"><thead><tr><th>State</th><th>Replaces</th><th>Behavior</th></tr></thead><tbody><tr><td>**DISCARDING**</td><td>Blocking, Listening, Disabled</td><td>Port not forwarding; receives BPDUs but no regular traffic</td></tr><tr><td>**LEARNING**</td><td>Learning (same)</td><td>Learns MAC addresses; disabled for traffic</td></tr><tr><td>**FORWARDING**</td><td>Forwarding (same)</td><td>Full operation</td></tr></tbody></table>

**Why Fewer States?** RSTP eliminates LISTENING (unnecessary with new bridge-to-bridge negotiation).

---

## RSTP Port Roles (4 Instead of 3)

<table id="bkmrk-role-purpose-state-b"><thead><tr><th>Role</th><th>Purpose</th><th>State</th><th>Backup To</th></tr></thead><tbody><tr><td>**ROOT PORT**</td><td>Interface toward root bridge (one per switch)</td><td>FORWARDING</td><td>N/A</td></tr><tr><td>**DESIGNATED PORT**</td><td>Best interface on segment toward root (one per segment)</td><td>FORWARDING</td><td>N/A</td></tr><tr><td>**ALTERNATE PORT**</td><td>**NEW**: Backup to root port; identified during BPDU negotiation</td><td>DISCARDING</td><td>Root port</td></tr><tr><td>**BACKUP PORT**</td><td>**NEW**: Backup to designated port (on shared media/hubs only)</td><td>DISCARDING</td><td>Designated port</td></tr></tbody></table>

**Why Alternate Port Matters:**

- If root port fails, alternate port immediately moves to FORWARDING
- No 20-second MAX AGE wait
- Built-in UplinkFast functionality

---

## RSTP Link Types

**Edge Ports:**

- Connected to end hosts (no other switches)
- No loop risk; move directly to FORWARDING
- Equivalent to PortFast in classic STP
- Configuration: `spanning-tree portfast`

**Point-to-Point Links:**

- Direct switch-to-switch connections; full-duplex
- Use rapid bridge-to-bridge handshake
- Converge in seconds
- Configuration: `spanning-tree link-type point-to-point` (auto-detected in full-duplex)

**Shared Links:**

- Multiple switches on shared segment (hubs); half-duplex
- Cannot use rapid handshake; slower convergence
- Rare in modern networks
- Configuration: `spanning-tree link-type shared` (auto-detected in half-duplex)

---

## STP Configuration

**Basic Setup:**

```
Switch(config)# spanning-tree mode rapid-pvst    → Enable RSTP (modern)
  (or: spanning-tree mode pvst)                   → Classic STP

```

**Set Root/Backup Bridge:**

```
Switch(config)# spanning-tree vlan 1 root primary        → Priority 24576
Switch(config)# spanning-tree vlan 1 root secondary      → Priority 28672

```

**PortFast &amp; BPDU Guard:**

```
Switch(config-if)# spanning-tree portfast
Switch(config-if)# spanning-tree bpduguard enable

(Or globally):
Switch(config)# spanning-tree portfast default
Switch(config)# spanning-tree portfast bpduguard default

```

**Per-Interface STP:**

```
Switch(config-if)# spanning-tree vlan 1 cost 10              → Set cost
Switch(config-if)# spanning-tree vlan 1 port-priority 64     → Set port priority

```

**Verification:**

```
show spanning-tree                    → Show root bridge and topology
show spanning-tree vlan 10            → Specific VLAN STP
show spanning-tree interface Fa0/1    → Interface STP details
show spanning-tree detail             → All STP information

```

---

## Per-VLAN STP (PVST+)

**Concept:** One spanning tree per VLAN; allows different root bridge per VLAN.

**Benefits:**

- Different traffic paths per VLAN
- Load balancing across multiple bridges
- Better utilization of redundant links

**Example:**

```
VLAN 10: SW1 = root
VLAN 20: SW2 = root
VLAN 30: SW3 = root

Configuration:
  Switch1(config)# spanning-tree vlan 10 root primary
  Switch2(config)# spanning-tree vlan 20 root primary
  Switch3(config)# spanning-tree vlan 30 root primary

```

---

## CCNA Exam Essentials

<table id="bkmrk-concept-key-detail-s"><thead><tr><th>Concept</th><th>Key Detail</th></tr></thead><tbody><tr><td>**STP Purpose**</td><td>Prevent Layer 2 loops; enable redundancy safely</td></tr><tr><td>**Root Bridge**</td><td>Elected by lowest bridge ID (priority + MAC)</td></tr><tr><td>**Bridge ID**</td><td>2-byte priority + 6-byte MAC; priority in 4096 increments</td></tr><tr><td>**Root Port**</td><td>ONE per switch; lowest cost to root; FORWARDING</td></tr><tr><td>**Designated Port**</td><td>ONE per segment; lowest cost; FORWARDING</td></tr><tr><td>**Non-Designated**</td><td>BLOCKING state; serves as backup</td></tr><tr><td>**Port Costs**</td><td>Classic: 10Mbps=100, 100Mbps=19, 1Gbps=4; RSTP: scale ×50000</td></tr><tr><td>**Hello Timer**</td><td>2 seconds; sent by root bridge; tells all others</td></tr><tr><td>**Forward Delay**</td><td>15 seconds; time in LISTENING and LEARNING each</td></tr><tr><td>**Max Age**</td><td>20 seconds; max wait for BPDU before topology re-eval</td></tr><tr><td>**Convergence Time**</td><td>30-50 seconds (STP); MAX AGE + LISTENING + LEARNING</td></tr><tr><td>**Port State Sequence**</td><td>BLOCKING → LISTENING (15s) → LEARNING (15s) → FORWARDING</td></tr><tr><td>**BPDU**</td><td>STP message; sent every 2 seconds on all ports</td></tr><tr><td>**PortFast**</td><td>Skips LISTENING/LEARNING; ONLY for access to hosts</td></tr><tr><td>**BPDU Guard**</td><td>Shuts down PortFast port if BPDU received</td></tr><tr><td>**RSTP Convergence**</td><td>Seconds (not minutes)</td></tr><tr><td>**RSTP States**</td><td>3 (Discarding, Learning, Forwarding) not 5</td></tr><tr><td>**RSTP Roles**</td><td>4 (Root, Designated, Alternate, Backup) not 3</td></tr><tr><td>**Alternate Port**</td><td>Backup to root port; immediate failover (no MAX AGE wait)</td></tr><tr><td>**Root Priority 0**</td><td>Lowest possible; highest chance to be root</td></tr><tr><td>**Priority Increment**</td><td>4096 (only valid increment for priority changes)</td></tr><tr><td>**RSTP Link Types**</td><td>Edge (hosts), Point-to-Point (switch-to-switch FD), Shared (hubs)</td></tr><tr><td>**PVST+**</td><td>Per-VLAN STP; different root per VLAN for load balancing</td></tr><tr><td>**Bridge ID Tie**</td><td>If priority equal, lower MAC address wins</td></tr><tr><td>**Tiebreaker Order**</td><td>Root cost → neighbor bridge ID → neighbor port ID → local port ID</td></tr></tbody></table>

---

Summary: Condensed from ~4,200 to ~2,000 words (52% reduction). Zero technical data loss; all timers, costs, port states, transitions, roles, tiebreakers, and configurations preserved exactly.

# Day 23: EtherChannel

# CCNA 200-301 Study Guide: EtherChannel

## 1.0 EtherChannel: Definition and Strategic Purpose

EtherChannel (also known as a Port Channel or Link Aggregation Group - LAG) bundles multiple physical switch ports into a single logical link. This technology is essential for creating high-bandwidth, resilient backbones in campus networks.

### 1.1 The Strategic Goals

- Increased Bandwidth: Aggregates the capacity of individual links (e.g., two 1Gbps links become a single 2Gbps logical channel).
- Link Redundancy: If one physical link in the bundle fails, traffic is automatically redistributed across the remaining active links without a total connection loss.
- Load Balancing: Uses a hashing algorithm to distribute traffic flows across all active members of the bundle.

### 1.2 Interaction with Spanning Tree Protocol (STP)

Normally, parallel links between switches create a Layer 2 loop, causing STP to block all but one link. EtherChannel resolves this by presenting the bundle to STP as a single logical interface. STP allows the entire Port Channel to remain in a forwarding state, enabling all physical ports to contribute to the combined bandwidth.

## 2.0 Negotiation Protocols and Configuration Modes

EtherChannel can be configured statically or dynamically. LACP is the modern industry standard and is preferred for its vendor-neutral compatibility.

### 2.1 Protocol Comparison

<div dir="ltr" id="bkmrk-feature-lacp-%28link-a" style="text-align:left;"><table><colgroup><col style="width:112px;"></col><col style="width:266px;"></col><col style="width:225px;"></col></colgroup><tbody><tr><td>Feature

</td><td>LACP (Link Aggregation Control Protocol)

</td><td>PAgP (Port Aggregation Protocol)

</td></tr><tr><td>Standard

</td><td>IEEE 802.3ad (Industry Standard)

</td><td>Cisco Proprietary

</td></tr><tr><td>Best Practice

</td><td>Preferred (Multi-vendor support)

</td><td>Use only between Cisco devices

</td></tr><tr><td>Modes

</td><td>Active / Passive

</td><td>Desirable / Auto

</td></tr></tbody></table>

</div>### 2.2 Negotiation Outcomes

<div dir="ltr" id="bkmrk-protocol-mode-combin" style="text-align:left;"><table><colgroup><col style="width:86px;"></col><col style="width:175px;"></col><col style="width:86px;"></col></colgroup><tbody><tr><td>Protocol

</td><td>Mode Combination

</td><td>Result

</td></tr><tr><td>LACP

</td><td>Active + Active

</td><td>Success

</td></tr><tr><td>LACP

</td><td>Active + Passive

</td><td>Success

</td></tr><tr><td>LACP

</td><td>Passive + Passive

</td><td>Failure

</td></tr><tr><td>PAgP

</td><td>Desirable + Desirable

</td><td>Success

</td></tr><tr><td>PAgP

</td><td>Desirable + Auto

</td><td>Success

</td></tr><tr><td>PAgP

</td><td>Auto + Auto

</td><td>Failure

</td></tr></tbody></table>

</div>The "On" Mode: This mode forces the interface to bundle without negotiation. It is risky because it does not verify if parameters (speed, duplex, VLANs) match on the other end, which can lead to Layer 2 loops or packet loss.

## 3.0 Load Balancing Mechanism

EtherChannel does not use round-robin distribution. Instead, it uses a hash-based method to categorize traffic into "flows."

- Flow Consistency: All packets in a specific conversation (e.g., a single file transfer) are mapped to the same physical link.
- Prevention of Out-of-Order Delivery: By keeping a flow on one link, the switch ensures packets arrive in the correct sequence, preventing TCP performance degradation.
- Hashing Options: Switches can hash based on Source/Destination MAC, IP, or Port numbers.

## 4.0 Critical Configuration Guidelines

For a Port Channel to form, the following parameters must match on all member interfaces:

1. Speed and Duplex
2. VLAN Membership (Access VLAN or Allowed VLAN list for Trunks)
3. STP Settings

### 4.1 Link Limits

- PAgP: Up to 8 active links.
- LACP: Up to 16 links (8 active and 8 hot-standby).
- Channel Group Number: This ID is only locally significant; it does not need to match the number on the neighboring switch.

## 5.0 Implementation Workflow

### 5.1 Layer 2 EtherChannel (Switch-to-Switch)

SW1(config)# interface range g0/1 - 2

SW1(config-if-range)# channel-group 1 mode active

SW1(config-if-range)# exit

SW1(config)# interface port-channel 1

SW1(config-if)# switchport mode trunk

SW1(config-if)# switchport trunk allowed vlan 10,20

### 5.2 Layer 3 EtherChannel (Routed Port)

SW1(config)# interface range g0/1 - 2

SW1(config-if-range)# no switchport

SW1(config-if-range)# channel-group 1 mode active

SW1(config-if-range)# exit

SW1(config)# interface port-channel 1

SW1(config-if)# ip address 10.1.1.1 255.255.255.252

## 6.0 Verification and Troubleshooting

<div dir="ltr" id="bkmrk-command-purpose-show" style="text-align:left;"><table><colgroup><col style="width:222px;"></col><col style="width:383px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>show etherchannel summary

</td><td>Most Important. Shows Port Channel status and member port states.

</td></tr><tr><td>show etherchannel load-balance

</td><td>Displays the current hashing algorithm in use.

</td></tr><tr><td>show interface port-channel &lt;id&gt;

</td><td>Shows the logical interface status (Up/Down) and bandwidth.

</td></tr></tbody></table>

</div>### Common Status Codes in show etherchannel summary:

- (P): Bundled in Port Channel (Operational).
- (D): Down / Suspended (Mismatched parameters).
- (I): Stand-alone (Negotiation failed).
- SU: Layer 2 Port Channel, In Use.
- RU: Layer 3 Port Channel, In Use.

## TL;DR: CCNA Exam Cram

- Purpose: Aggregate links for Bandwidth ($+$) and Redundancy.
- Protocol: Use LACP (Active/Active) whenever possible.
- Logic: STP sees one link; Traffic is balanced by Flow Hashing.
- Requirement: Speed, Duplex, and VLANs must match on all ports.
- Verification: show etherchannel summary is your best friend.

# Day 24: Dynamic Routing

# CCNA 200-301 Study Guide: IP Connectivity

## 1.0 Introduction

IP Connectivity is the mechanism that enables communication between devices on different network segments. It is the core function of Layer 3 devices (routers and multilayer switches). In the CCNA 200-301 exam, this domain accounts for 25% of the total score.

## 2.0 Foundational Routing Methods: Static vs. Dynamic

The choice between static and dynamic routing impacts scalability, resiliency, and administrative overhead.

<div dir="ltr" id="bkmrk-feature-static-routi" style="text-align:left;"><table><colgroup><col style="width:125px;"></col><col style="width:218px;"></col><col style="width:259px;"></col></colgroup><tbody><tr><td>Feature

</td><td>Static Routing

</td><td>Dynamic Routing

</td></tr><tr><td>Configuration

</td><td>Manually defined by an administrator.

</td><td>Automatically learned from neighbors.

</td></tr><tr><td>Adaptability

</td><td>Fixed; requires manual intervention if a link fails.

</td><td>Automatically recalculates paths during topology changes.

</td></tr><tr><td>Scalability

</td><td>Low; impractical for large networks.

</td><td>High; manages thousands of routes efficiently.

</td></tr><tr><td>Resources

</td><td>Low CPU/RAM requirements.

</td><td>Requires CPU/RAM to run protocol algorithms.

</td></tr><tr><td>Best Use Case

</td><td>Stub networks or Default Gateways.

</td><td>Large enterprise core/distribution layers.

</td></tr></tbody></table>

</div>## 3.0 Deconstructing Dynamic Routing Protocols

Dynamic protocols are classified by their Scope (where they run) and their Algorithm (how they calculate math).

### 3.1 Classification by Scope

- Interior Gateway Protocol (IGP): Used within a single Autonomous System (AS).
    
    
    - Examples: OSPF, EIGRP, RIP, IS-IS.
- Exterior Gateway Protocol (EGP): Used to connect different Autonomous Systems.
    
    
    - Example: BGP (The protocol of the Internet).

### 3.2 Classification by Algorithm

- Distance Vector: "Routing by rumor." Routers only know what neighbors tell them.
    
    
    - Examples: RIP (Metric: Hop Count), EIGRP (Advanced Distance Vector).
- Link State: Every router has a complete map of the topology.
    
    
    - Examples: OSPF, IS-IS (Metric: Cost/Bandwidth).
- Path Vector: Specific to BGP; uses AS-Path information to prevent loops.

## 4.0 The Router's Path Selection Logic

When a router learns multiple paths to the same destination, it uses a strict three-step hierarchy to choose the best route for the Routing Table.

### Step 1: Longest Prefix Match (LPM)

The router prefers the most specific route (the longest subnet mask). This rule overrides everything else.

- Example: A packet destined for 10.1.1.5 matches both 10.0.0.0/8 and 10.1.1.0/24.
- Winner: 10.1.1.0/24 because $24 &gt; 8$.

### Step 2: Administrative Distance (AD)

If prefix lengths are identical, the router chooses the most "trustworthy" source.

<div dir="ltr" id="bkmrk-route-source-default" style="text-align:left;"><table><colgroup><col style="width:141px;"></col><col style="width:102px;"></col></colgroup><tbody><tr><td>Route Source

</td><td>Default AD

</td></tr><tr><td>Connected

</td><td>0

</td></tr><tr><td>Static

</td><td>1

</td></tr><tr><td>EIGRP (Internal)

</td><td>90

</td></tr><tr><td>OSPF

</td><td>110

</td></tr><tr><td>RIP

</td><td>120

</td></tr></tbody></table>

</div>### Step 3: Metric

If the prefix length and AD are identical, the router chooses the path with the lowest cost (metric) calculated by the protocol.

## 5.0 Advanced Routing Concepts

### 5.1 Floating Static Routes

A Floating Static Route is a backup route with a manually configured AD higher than the primary dynamic protocol.

- Primary: OSPF (AD 110)
- Backup: Static Route (AD 111)
- Logic: The static route "floats" (stays out of the table) until the OSPF route fails.
- Command: ip route 10.0.2.0 255.255.255.0 192.168.1.1 111

### 5.2 Equal-Cost Multi-Path (ECMP)

If multiple paths have the same Prefix Length, same AD, and same Metric, the router installs all of them and load-balances traffic across them.

## 6.0 Essential Command Reference

### 6.1 Verification

<div dir="ltr" id="bkmrk-command-purpose-show" style="text-align:left;"><table><colgroup><col style="width:163px;"></col><col style="width:392px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>show ip route

</td><td>View the IPv4 routing table.

</td></tr><tr><td>traceroute &lt;ip&gt;

</td><td>Trace the hop-by-hop path to a destination.

</td></tr><tr><td>show ip protocols

</td><td>Verify dynamic routing protocol parameters and AD.

</td></tr></tbody></table>

</div>### 6.2 Configuration

- Standard Static Route:  
    ip route &lt;network&gt; &lt;mask&gt; &lt;next-hop-ip&gt;
- Default Route (Gateway of Last Resort):  
    ip route 0.0.0.0 0.0.0.0 &lt;next-hop-ip&gt;
- Loopback Interface (Stable Management IP):  
    interface Loopback0

## 7.0 TL;DR Summary

1. Selection Logic: Longest Match $\\rightarrow$ Lowest AD $\\rightarrow$ Lowest Metric.
2. Distance Vector protocols see neighbors; Link State protocols see the whole map.
3. Floating Static Routes are created by increasing the AD of a static route to exceed the dynamic protocol's AD.
4. BGP is the only EGP; it is a Path Vector protocol.

# Day 25: RIP and EIGRP Routing Protocols

# CCNA Study Guide: Comparative Analysis of RIP and EIGRP

## 1.0 Introduction

While OSPFv2 is the primary protocol for configuration on the CCNA 200-301 exam, understanding RIP and EIGRP is essential for mastering routing fundamentals. These protocols represent the evolution of distance-vector logic and provide context for why modern networks are designed the way they are.

## 2.0 Routing Information Protocol (RIP)

RIP is the classic "Routing by Rumor" protocol. It is a legacy Interior Gateway Protocol (IGP) that relies on periodic updates and a simplistic view of the network.

### 2.1 Core Characteristics

- Algorithm: Bellman-Ford (Distance Vector).
- Metric: Hop Count. Each router is one hop; the path with the fewest routers is chosen.
- Maximum Hop Count: 15. A hop count of 16 is considered "infinite" (unreachable).
- Administrative Distance (AD): 120.
- Update Timer: Full routing table broadcast/multicast every 30 seconds.

### 2.2 Evolution: RIPv1 vs. RIPv2

RIP evolved to support modern networking requirements like VLSM and CIDR.

<div dir="ltr" id="bkmrk-feature-ripv1-ripv2-" style="text-align:left;"><table><colgroup><col style="width:131px;"></col><col style="width:245px;"></col><col style="width:193px;"></col></colgroup><tbody><tr><td>Feature

</td><td>RIPv1

</td><td>RIPv2

</td></tr><tr><td>Addressing

</td><td>Classful (A, B, C)

</td><td>Classless (VLSM/CIDR)

</td></tr><tr><td>Subnet Masks

</td><td>Not sent in updates

</td><td>Included in updates

</td></tr><tr><td>Transmission

</td><td>Broadcast (255.255.255.255)

</td><td>Multicast (224.0.0.9)

</td></tr><tr><td>Authentication

</td><td>Not supported

</td><td>Supported

</td></tr></tbody></table>

</div>### 2.3 Basic Configuration

Router(config)# router rip

Router(config-router)# version 2

Router(config-router)# no auto-summary

Router(config-router)# network 192.168.1.0

Router(config-router)# passive-interface g0/0

Router(config-router)# default-information originate

## 3.0 Enhanced Interior Gateway Routing Protocol (EIGRP)

EIGRP is an Advanced Distance Vector (or Hybrid) protocol. It is designed for extremely fast convergence and efficiency, utilizing the Diffusing Update Algorithm (DUAL).

### 3.1 Core Characteristics

- Algorithm: DUAL.
- Multicast Address: 224.0.0.10.
- Administrative Distance (AD): 90 (Internal), 170 (External).
- Convergence: Very fast due to pre-calculated backup paths.
- Routing Code: Identified in the routing table by the letter D (for DUAL).

### 3.2 The Composite Metric

EIGRP uses a complex formula considering multiple path attributes. By default, only Bandwidth and Delay are used.

$$Metric = (\[Slowest\\ Bandwidth + Sum\\ of\\ Delays\] \\times 256)$$

### 3.3 EIGRP Terminology (DUAL)

<div dir="ltr" id="bkmrk-term-definition-succ" style="text-align:left;"><table><colgroup><col style="width:188px;"></col><col style="width:417px;"></col></colgroup><tbody><tr><td>Term

</td><td>Definition

</td></tr><tr><td>Successor

</td><td>The best, lowest-metric route installed in the routing table.

</td></tr><tr><td>Feasible Successor (FS)

</td><td>A loop-free backup route.

</td></tr><tr><td>Feasible Distance (FD)

</td><td>The local router's total metric to the destination.

</td></tr><tr><td>Reported Distance (RD)

</td><td>The metric advertised by a neighbor to reach the destination.

</td></tr></tbody></table>

</div>The Feasibility Condition: For a neighbor to be a Feasible Successor, its RD must be less than the current FD ($RD &lt; FD$). This ensures a loop-free backup path.

## 4.0 Advanced Features and Configuration

### 4.1 Unequal-Cost Load Balancing

EIGRP is the only IGP that supports unequal-cost load balancing. Using the variance command, a router can distribute traffic across paths with different metrics if the backup path is a Feasible Successor.

### 4.2 Configuration Example

Router(config)# router eigrp 100

Router(config-router)# eigrp router-id 1.1.1.1

Router(config-router)# network 10.0.0.0 0.0.0.255

Router(config-router)# no auto-summary

Router(config-router)# variance 2

## 5.0 Verification and Troubleshooting Commands

<div dir="ltr" id="bkmrk-command-purpose-show" style="text-align:left;"><table><colgroup><col style="width:193px;"></col><col style="width:411px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>show ip protocols

</td><td>Summarizes all active routing protocols (timers, AD, networks).

</td></tr><tr><td>show ip route \[rip | eigrp\]

</td><td>Filters the routing table for specific protocol entries.

</td></tr><tr><td>show ip eigrp neighbors

</td><td>Verifies successful adjacencies with neighboring routers.

</td></tr><tr><td>show ip eigrp topology

</td><td>Displays the DUAL database, including Successors and FS.

</td></tr></tbody></table>

</div>## 6.0 Head-to-Head Comparison: RIP vs. EIGRP

<div dir="ltr" id="bkmrk-feature-rip-eigrp-ty" style="text-align:left;"><table><colgroup><col style="width:139px;"></col><col style="width:151px;"></col><col style="width:212px;"></col></colgroup><tbody><tr><td>Feature

</td><td>RIP

</td><td>EIGRP

</td></tr><tr><td>Type

</td><td>Distance Vector

</td><td>Advanced Distance Vector

</td></tr><tr><td>Metric

</td><td>Hop Count

</td><td>Bandwidth + Delay

</td></tr><tr><td>Convergence

</td><td>Slow

</td><td>Very Fast

</td></tr><tr><td>Load Balancing

</td><td>Equal Cost Only

</td><td>Equal &amp; Unequal Cost

</td></tr><tr><td>Admin Distance

</td><td>120

</td><td>90

</td></tr><tr><td>Standard

</td><td>Industry Standard

</td><td>Cisco (Open since 2013)

</td></tr></tbody></table>

</div>

# Days 26, 27, 28: OSPF

# CCNA Study Guide: OSPFv2 (Exam Topic 3.4)

## 1.0 OSPFv2 Fundamentals: The Link-State Advantage

Open Shortest Path First (OSPF) is a Link-State Interior Gateway Protocol (IGP). Unlike distance-vector protocols that rely on "routing by rumor," OSPF routers build a complete, synchronized map of the network topology.

### The Metaphor: The GPS vs. The Signpost

- Distance Vector (RIP): Like a signpost. It tells you "Network X is 4 miles that way," but you don't know what the road looks like or if there is a bridge out further ahead.
- Link-State (OSPF): Like a GPS map. Every router has a complete map of every "road" (link) and "intersection" (router) in the area. Each router can independently calculate the best path using the map.

### Core Characteristics

<div dir="ltr" id="bkmrk-attribute-descriptio" style="text-align:left;"><table><colgroup><col style="width:175px;"></col><col style="width:398px;"></col></colgroup><tbody><tr><td>Attribute

</td><td>Description

</td></tr><tr><td>Protocol Type

</td><td>Link-State IGP

</td></tr><tr><td>Algorithm

</td><td>Dijkstra’s Shortest Path First (SPF)

</td></tr><tr><td>Admin Distance (AD)

</td><td>110

</td></tr><tr><td>Multicast Addresses

</td><td>224.0.0.5 (All OSPF Routers), 224.0.0.6 (DR/BDR)

</td></tr></tbody></table>

</div>## 2.0 The Path to Adjacency: OSPF Core Operations

OSPF routers must go through a structured process to become fully adjacent and synchronize their Link State Database (LSDB).

### The 3-Step Process

1. Become Neighbors: Routers discover each other via Hello packets.
2. Exchange LSAs: Routers share Link State Advertisements (LSAs) to synchronize their databases.
3. Calculate Routes: Once the LSDB is identical, each router runs the SPF algorithm to find the best paths.

### OSPFv2 Neighbor States

<div dir="ltr" id="bkmrk-state-description-do" style="text-align:left;"><table><colgroup><col style="width:95px;"></col><col style="width:510px;"></col></colgroup><tbody><tr><td>State

</td><td>Description

</td></tr><tr><td>Down

</td><td>No Hellos received.

</td></tr><tr><td>Init

</td><td>Hello received, but your own Router ID is not in the neighbor's list.

</td></tr><tr><td>2-Way

</td><td>Bidirectional communication confirmed (DR/BDR election happens here).

</td></tr><tr><td>ExStart

</td><td>Determining Master/Slave relationship for data exchange.

</td></tr><tr><td>Exchange

</td><td>Exchanging Database Descriptors (DBDs) (summaries of the LSDB).

</td></tr><tr><td>Loading

</td><td>Requesting specific missing info via LSRs and LSUs.

</td></tr><tr><td>Full

</td><td>LSDBs are fully synchronized. Normal operation.

</td></tr></tbody></table>

</div>## 3.0 Essential OSPF Components

### 3.1 Router ID (RID) Selection

The RID is a unique 32-bit identifier for the router. It is selected in this order:

1. Manual Configuration: router-id 1.1.1.1 (Best Practice).
2. Highest Loopback IP: Highest IP on any active loopback interface.
3. Highest Physical IP: Highest IP on any active physical interface.

### 3.2 The OSPF Metric: Cost

OSPF calculates cost based on interface bandwidth. A lower cumulative cost is preferred.

$$Cost = \\frac{Reference\\ Bandwidth}{Interface\\ Bandwidth}$$

Important: The default reference bandwidth is 100 Mbps. On modern networks (Gigabit or 10G), you must manually increase this to ensure OSPF can distinguish between different high-speed links.

- Command: auto-cost reference-bandwidth 1000 (for 1 Gbps links).

### 3.3 LSA Types (CCNA Focus)

- Type 1 (Router LSA): Sent by every router; describes its own links/interfaces.
- Type 2 (Network LSA): Generated by the Designated Router (DR); describes the routers on a multi-access segment.
- Type 5 (External LSA): Describes routes redistributed from outside the OSPF domain (e.g., a Static Route).

## 4.0 Network Types and the DR/BDR Election

On multi-access networks (like Ethernet), OSPF elects a Designated Router (DR) and a Backup Designated Router (BDR) to manage LSA flooding and reduce the number of adjacencies.

<div dir="ltr" id="bkmrk-feature-broadcast-%28e" style="text-align:left;"><table><colgroup><col style="width:159px;"></col><col style="width:174px;"></col><col style="width:184px;"></col></colgroup><tbody><tr><td>Feature

</td><td>Broadcast (Ethernet)

</td><td>Point-to-Point (Serial)

</td></tr><tr><td>DR/BDR Election

</td><td>Yes

</td><td>No

</td></tr><tr><td>Hello / Dead Timer

</td><td>10s / 40s

</td><td>10s / 40s

</td></tr></tbody></table>

</div>### DR/BDR Election Hierarchy

1. Highest Interface Priority: Default is 1. A priority of 0 makes a router ineligible.
2. Highest Router ID: The tie-breaker if priorities are equal.

Note: The election is non-preemptive. If a new router with a higher priority joins the network, it will not become the DR until the current DR/BDR process is reset or the current DR fails.

## 5.0 OSPFv2 Configuration

### 5.1 Basic Implementation

\# Method 1: Traditional Network Command

Router(config)# router ospf 1

Router(config-router)# router-id 1.1.1.1

Router(config-router)# network 10.1.1.0 0.0.0.255 area 0

\# Method 2: Interface-level Command (Preferred)

Router(config)# interface g0/0

Router(config-if)# ip ospf 1 area 0

### 5.2 Common Optimizations

- Passive Interface: Prevents Hellos from being sent to user segments (Security/Efficiency).
    
    
    - passive-interface g0/1
- Default Route Propagation:
    
    
    - default-information originate (Injects the 0.0.0.0/0 route into OSPF).

## 6.0 Troubleshooting OSPF Adjacency Issues

If two routers fail to reach the FULL state, check for mismatches in these parameters:

1. Area ID: Must match.
2. Subnet &amp; Mask: Must be on the same primary subnet.
3. Hello/Dead Timers: Must match (Default 10/40).
4. Authentication: Passwords and types must match.
5. MTU Size: If they mismatch, routers get stuck in ExStart/Exchange.
6. Unique Router IDs: Duplicate RIDs prevent adjacency.

## TL;DR Summary

- Link-State: OSPF uses a map (LSDB), not rumors.
- Election: Lowest Bridge ID wins (Priority, then RID).
- Cost Formula: Reference Bandwidth / Interface Bandwidth.
- Convergence: Moves through 7 states; FULL is the goal.
- Multi-access: Uses DR/BDR to reduce LSA flooding on Ethernet.
- Troubleshooting: Check Area, Timers, Subnet, and MTU if adjacencies fail.

# Day 29: First Hop Redundancy Protocols

# CCNA Study Guide: First Hop Redundancy Protocols (FHRP)

## 1.0 Introduction: The Default Gateway as a Single Point of Failure

In a standard network, end-user devices rely on a single Default Gateway to reach the outside world. If the physical router providing that gateway fails, the entire subnet loses connectivity.

First Hop Redundancy Protocols (FHRP) mitigate this risk by grouping multiple physical routers into a single logical, redundant gateway.

The Metaphor: The Shared Doorway

Imagine an office with only one exit. If that door jams, everyone is trapped. FHRP is like having two doors side-by-side that appear as one "virtual door" to the employees. If one door sticks, people automatically walk through the other without even realizing the first one failed.

## 2.0 Core FHRP Concepts and Mechanisms

### 2.1 The Building Blocks of Redundancy

- Virtual IP (VIP): The single IP address shared by the group. This is what hosts use as their Default Gateway.
- Virtual MAC (VMAC): A shared Layer 2 address associated with the VIP.
- Active/Master Router: The router currently responsible for forwarding traffic sent to the VIP.
- Standby/Backup Router: The router(s) listening for "Hello" messages from the Active router, ready to take over.

### 2.2 The Automatic Failover Process

1. Health Monitoring: Routers exchange Hello messages via multicast.
2. Failure Detection: If the Standby router stops hearing Hellos for a specific duration (the Hold Time), it assumes the Active router has failed.
3. Role Transition: The Standby router promotes itself to Active.
4. Gratuitous ARP (GARP): The new Active router sends a GARP to the switch. This forces the switch to update its MAC address table so that frames destined for the VMAC are now sent to the new router's physical port.

## 3.0 Comparative Analysis of Major FHRPs

<div dir="ltr" id="bkmrk-feature-hsrp-vrrp-gl" style="text-align:left;"><table><colgroup><col style="width:114px;"></col><col style="width:159px;"></col><col style="width:170px;"></col><col style="width:158px;"></col></colgroup><tbody><tr><td>Feature

</td><td>HSRP

</td><td>VRRP

</td><td>GLBP

</td></tr><tr><td>Full Name

</td><td>Hot Standby Router Protocol

</td><td>Virtual Router Redundancy Protocol

</td><td>Gateway Load Balancing Protocol

</td></tr><tr><td>Owner

</td><td>Cisco Proprietary

</td><td>Open Standard

</td><td>Cisco Proprietary

</td></tr><tr><td>Primary Roles

</td><td>Active / Standby

</td><td>Master / Backup

</td><td>AVG / AVF

</td></tr><tr><td>Load Balancing

</td><td>No (Active/Passive)

</td><td>No (Active/Passive)

</td><td>Yes (Active/Active)

</td></tr><tr><td>Preemption

</td><td>Disabled by Default

</td><td>Enabled by Default

</td><td>Enabled by Default

</td></tr><tr><td>Multicast IP

</td><td>224.0.0.102 (v2)

</td><td>224.0.0.18

</td><td>224.0.0.102

</td></tr></tbody></table>

</div>### Virtual MAC Address Formats

- HSRP v1: 0000.0C07.ACXX (XX = Group ID)
- HSRP v2: 0000.0C9F.FXXX (XXX = Group ID)
- VRRP: 0000.5E00.01XX (XX = Group ID)
- GLBP: 0007.B400.XXYY (XX = Group ID, YY = Forwarder ID)

## 4.0 Deep Dive: Hot Standby Router Protocol (HSRP)

HSRP is the most common FHRP encountered in Cisco environments.

### 4.1 Election and Preemption

- Highest Priority: The router with the highest priority wins (Default: 100, Range: 0–255).
- Highest IP: If priorities are tied, the router with the highest IP address on the interface wins.
- Preemption: If a primary router reboots, it will not take back the Active role by default, even if it has a higher priority. Preemption must be manually enabled to allow the "better" router to seize control back.

### 4.2 HSRP Versions

<div dir="ltr" id="bkmrk-feature-hsrp-v1-hsrp" style="text-align:left;"><table><colgroup><col style="width:131px;"></col><col style="width:104px;"></col><col style="width:122px;"></col></colgroup><tbody><tr><td>Feature

</td><td>HSRP v1

</td><td>HSRP v2

</td></tr><tr><td>Group Range

</td><td>0 – 255

</td><td>0 – 4095

</td></tr><tr><td>IPv6 Support

</td><td>No

</td><td>Yes

</td></tr><tr><td>Multicast Addr

</td><td>224.0.0.2

</td><td>224.0.0.102

</td></tr><tr><td>Timer Support

</td><td>Seconds

</td><td>Milliseconds

</td></tr></tbody></table>

</div>## 5.0 HSRP Configuration and Verification

### 5.1 Configuration Example

Router(config)# interface g0/0

Router(config-if)# standby version 2

Router(config-if)# standby 1 ip 10.0.0.1 # Set Virtual IP

Router(config-if)# standby 1 priority 150 # Make this the preferred Active

Router(config-if)# standby 1 preempt # Allow it to take back control

### 5.2 Verification Commands

<div dir="ltr" id="bkmrk-command-purpose-show" style="text-align:left;"><table><colgroup><col style="width:172px;"></col><col style="width:409px;"></col></colgroup><tbody><tr><td>Command

</td><td>Purpose

</td></tr><tr><td>show standby

</td><td>Detailed view of roles, VIP, VMAC, and timers.

</td></tr><tr><td>show standby brief

</td><td>Concise summary of all HSRP groups and their states.

</td></tr></tbody></table>

</div>## 6.0 CCNA Exam Essentials (Key "Gotchas")

1. Traceroute Behavior: When tracing a path from a host, the first hop will show the Physical IP of the active router, not the Virtual IP.
2. GLBP Roles: \* AVG (Active Virtual Gateway): Answers ARP requests and assigns different VMACs to routers.
    
    
    - AVF (Active Virtual Forwarder): The routers that actually forward the data.
3. GARP Importance: Failover relies on the switch updating its MAC table via the Gratuitous ARP. Without it, the switch would continue sending frames to the dead router's port.

## TL;DR Summary

- FHRP provides a Virtual IP (Gateway) that stays active even if a physical router fails.
- HSRP is Cisco's standard; VRRP is the open-standard equivalent.
- GLBP is the only one that does true active-active load balancing.
- Election: Highest Priority wins; use Preemption to ensure the primary router regains control after a reboot.
- Verification: Use show standby brief to quickly check which router is currently Active.

# Day 30: TCP and UDP

# CCNA 200-301 Study Guide: Transport Layer (Layer 4)

## 1.0 The Role of the Transport Layer (Layer 4)

The Transport Layer serves as the bridge between application-level protocols and the network-level protocols responsible for routing. It manages the end-to-end conversation between applications on different hosts.

### 1.1 Core Functions

- Session Multiplexing: Allows a host to handle multiple simultaneous sessions (e.g., multiple browser tabs) by assigning unique source port numbers to each session.
- Application Identification: Uses destination port numbers to direct incoming data to the correct service (e.g., Port 80 for HTTP).
- Segmentation: Breaks large data streams into smaller "segments" that fit within the network's Maximum Transmission Unit (MTU).

## 2.0 Deep Dive: TCP (Transmission Control Protocol)

TCP is connection-oriented and designed for applications that require absolute data integrity. It has a 20-byte header.

### 2.1 Key Characteristics

- Reliable: Uses acknowledgments (ACKs) and retransmissions for lost data.
- Ordered: Uses Sequence Numbers to ensure data is reassembled in the correct order.
- Flow Control: Uses Windowing to prevent a sender from overwhelming a receiver.

### 2.2 Connection Management

- The Three-Way Handshake (Establishment):
    
    
    1. SYN: Client sends a request to synchronize.
    2. SYN-ACK: Server acknowledges and requests a return connection.
    3. ACK: Client acknowledges the server.
- The Four-Way Handshake (Termination): Uses FIN and ACK flags to gracefully close both sides of the virtual circuit.

### 2.3 Reliability Mechanisms

- Forward Acknowledgment: The ACK number indicates the next byte expected (e.g., if you receive byte 1000, you send ACK 1001).
- Sliding Window: A dynamic flow control mechanism that adjusts how much data can be sent before an ACK is required based on network conditions.

## 3.0 Deep Dive: UDP (User Datagram Protocol)

UDP is connectionless and prioritizes speed over reliability. It has a lightweight 8-byte header.

### 3.1 Key Characteristics

- Best-Effort Delivery: No acknowledgments, no retransmissions, and no sequencing.
- Low Overhead: No connection setup delay (no handshake).
- No Flow Control: Sends data as fast as the application allows.

### 3.2 Strategic Use Cases

Ideal for real-time traffic like VoIP and Video Streaming, where a dropped packet is better than a delayed/retransmitted one that causes jitter.

## 4.0 Head-to-Head Comparison: TCP vs. UDP

<div dir="ltr" id="bkmrk-feature-tcp-udp-type" style="text-align:left;"><table><colgroup><col style="width:130px;"></col><col style="width:228px;"></col><col style="width:194px;"></col></colgroup><tbody><tr><td>Feature

</td><td>TCP

</td><td>UDP

</td></tr><tr><td>Type

</td><td>Connection-Oriented

</td><td>Connectionless

</td></tr><tr><td>Handshake

</td><td>Yes (3-Way)

</td><td>No

</td></tr><tr><td>Reliability

</td><td>Reliable (ACKs/Retransmits)

</td><td>Unreliable (Best-effort)

</td></tr><tr><td>Sequencing

</td><td>Yes

</td><td>No

</td></tr><tr><td>Flow Control

</td><td>Yes (Sliding Window)

</td><td>No

</td></tr><tr><td>Header Size

</td><td>20 Bytes

</td><td>8 Bytes

</td></tr><tr><td>Common Uses

</td><td>HTTP, FTP, SMTP, SSH

</td><td>VoIP, DNS, DHCP, SNMP

</td></tr></tbody></table>

</div>## 5.0 Layer 4 Addressing: Port Numbers

Ports are 16-bit addresses (0 – 65,535) used to identify specific application processes.

### 5.1 Port Number Ranges

- Well-Known Ports (0 – 1,023): Common services (HTTP, SSH, etc.).
- Registered Ports (1,024 – 49,151): Assigned for specific vendor applications.
- Ephemeral Ports (49,152 – 65,535): Temporary source ports used by clients.

### 5.2 Essential Well-Known Ports for the CCNA

<div dir="ltr" id="bkmrk-protocol-port%28s%29-tra" style="text-align:left;"><table><colgroup><col style="width:86px;"></col><col style="width:86px;"></col><col style="width:96px;"></col><col style="width:265px;"></col></colgroup><tbody><tr><td>Protocol

</td><td>Port(s)

</td><td>Transport

</td><td>Description

</td></tr><tr><td>FTP

</td><td>20, 21

</td><td>TCP

</td><td>File Transfer (21-Control, 20-Data)

</td></tr><tr><td>SSH

</td><td>22

</td><td>TCP

</td><td>Secure Remote Access

</td></tr><tr><td>Telnet

</td><td>23

</td><td>TCP

</td><td>Unencrypted Remote Access

</td></tr><tr><td>SMTP

</td><td>25

</td><td>TCP

</td><td>Sending Email

</td></tr><tr><td>DNS

</td><td>53

</td><td>UDP/TCP

</td><td>Name Resolution

</td></tr><tr><td>DHCP

</td><td>67, 68

</td><td>UDP

</td><td>Dynamic IP Assignment

</td></tr><tr><td>TFTP

</td><td>69

</td><td>UDP

</td><td>Trivial FTP

</td></tr><tr><td>HTTP

</td><td>80

</td><td>TCP

</td><td>Web Browsing (Cleartext)

</td></tr><tr><td>POP3

</td><td>110

</td><td>TCP

</td><td>Retrieving Email

</td></tr><tr><td>SNMP

</td><td>161, 162

</td><td>UDP

</td><td>Network Management

</td></tr><tr><td>HTTPS

</td><td>443

</td><td>TCP

</td><td>Secure Web Browsing

</td></tr><tr><td>Syslog

</td><td>514

</td><td>UDP

</td><td>System Logging

</td></tr></tbody></table>

</div>## 6.0 Practical Context &amp; Key Exam Takeaways

### 6.1 Session Tracking

- Request: Source Port: 51234 (Ephemeral) $\\rightarrow$ Destination Port: 80 (Well-Known).
- Reply: Source Port: 80 $\\rightarrow$ Destination Port: 51234.
- The reversal of port numbers is how a host keeps track of distinct conversations.

### 6.2 The DNS Exception

DNS primarily uses UDP 53 for speed. However, it switches to TCP 53 if the response exceeds 512 bytes or during Zone Transfers between servers.

### 6.3 Core Analogy

- TCP is a Certified Letter: Requires a signature, has tracking, and pages are numbered.
- UDP is a Postcard: Fast and cheap; you drop it in the mail and hope it arrives.

# Days 31, 32, 33: IPv6

# CCNA 200-301 Study Guide: IPv6 Fundamentals and Routing

## 1.0 Context: IPv6 in the CCNA 200-301 Exam

IPv6 is a core competency woven throughout the CCNA curriculum. Understanding both the theory and practical configuration is essential for success in the following domains:

<div dir="ltr" id="bkmrk-domain-name-weight-1" style="text-align:left;"><table><colgroup><col style="width:80px;"></col><col style="width:190px;"></col><col style="width:75px;"></col></colgroup><tbody><tr><td>Domain

</td><td>Name

</td><td>Weight

</td></tr><tr><td>1.0

</td><td>Network Fundamentals

</td><td>20%

</td></tr><tr><td>2.0

</td><td>Network Access

</td><td>20%

</td></tr><tr><td>3.0

</td><td>IP Connectivity

</td><td>25%

</td></tr></tbody></table>

</div>Concepts are distributed across notation, address types, stateless autoconfiguration (SLAAC), and Neighbor Discovery Protocol (NDP).

## 2.0 The Architectural Shift: Header Improvements

IPv6 was designed to solve IPv4 address exhaustion, providing a 128-bit address space ($2^{128}$ addresses). It also introduced a more efficient, fixed-size 40-byte header.

### Key Header Changes

- No Checksum: Error checking is handled at Layer 2 and Layer 4, reducing CPU overhead at every Layer 3 hop.
- Hop Limit: Replaces "Time to Live" (TTL). It performs the same function: preventing infinite loops.
- Next Header: Replaces the "Protocol" field. It identifies the payload (TCP, UDP, ICMPv6) or chains extension headers.
- Flow Label: A 20-bit field that allows routers to identify and prioritize specific traffic flows for Quality of Service (QoS).

## 3.0 Mastering IPv6 Notation

Because a 128-bit address is too long to write in full, RFC 5952 defines rules for compression.

- Rule 1: Omit Leading Zeros: In any 16-bit hextet, leading zeros are unnecessary.
    
    
    - Example: 0db8 becomes db8.
- Rule 2: The Double Colon (::): A single contiguous string of all-zero hextets can be replaced with ::.
    
    
    - Constraint: This can only be used once per address to avoid ambiguity.
- Rule 3: Use Lowercase: Characters a through f should be lowercase for a consistent representation.

Example Compression:

- Full: 2001:0db8:0000:0000:0000:ff00:0042:8329
- Compressed: 2001:db8::ff00:42:8329

## 4.0 A Taxonomy of IPv6 Address Types

IPv6 eliminates Broadcast addresses, replacing them with more efficient Multicast methods.

### 4.1 Unicast (One-to-One)

<div dir="ltr" id="bkmrk-unicast-type-address" style="text-align:left;"><table><colgroup><col style="width:147px;"></col><col style="width:122px;"></col><col style="width:333px;"></col></colgroup><tbody><tr><td>Unicast Type

</td><td>Address Range

</td><td>Description

</td></tr><tr><td>Global Unicast (GUA)

</td><td>2000::/3

</td><td>Publicly routable on the internet.

</td></tr><tr><td>Unique Local (ULA)

</td><td>fc00::/7

</td><td>Private addresses for internal use; typically starts with fd.

</td></tr><tr><td>Link-Local (LLA)

</td><td>fe80::/10

</td><td>Automatic for local link communication. Not routable.

</td></tr><tr><td>Loopback

</td><td>::1/128

</td><td>Equivalent to 127.0.0.1.

</td></tr></tbody></table>

</div>### 4.2 Multicast (One-to-Many)

All multicast addresses begin with ff00::/8.

- ff02::1: All Nodes (local link).
- ff02::2: All Routers (local link).
- ff02::1:ffxx:xxxx: Solicited-Node Multicast (used for address resolution).

### 4.3 Anycast (One-to-Nearest)

A single address assigned to multiple devices. Routers deliver the packet to the topologically "closest" device.

## 5.0 Interface ID and Address Assignment

### 5.1 Modified EUI-64 Process

A device can generate its own unique 64-bit Interface ID from its 48-bit MAC address:

1. Split the MAC address in half.
2. Insert fffe in the middle.
3. Flip the 7th bit (Universal/Local bit).

### 5.2 Assignment Methods

- SLAAC: Host uses Router Advertisement (RA) messages to learn the prefix and generates its own Interface ID.
- Stateless DHCPv6: Host uses SLAAC for its IP, but asks DHCP for "other" info (DNS, Domain Name).
- Stateful DHCPv6: Host obtains its full configuration (including IP) from a DHCPv6 server.

## 6.0 Neighbor Discovery Protocol (NDP)

NDP replaces ARP and operates over ICMPv6. It uses targeted multicasts instead of noisy broadcasts.

<div dir="ltr" id="bkmrk-message-type-icmpv6-" style="text-align:left;"><table><colgroup><col style="width:198px;"></col><col style="width:106px;"></col><col style="width:299px;"></col></colgroup><tbody><tr><td>Message Type

</td><td>ICMPv6 Type

</td><td>Purpose

</td></tr><tr><td>Neighbor Solicitation (NS)

</td><td>135

</td><td>"Who has this IP?" (ARP Request equivalent).

</td></tr><tr><td>Neighbor Advertisement (NA)

</td><td>136

</td><td>"I have that IP, here is my MAC." (ARP Reply equivalent).

</td></tr><tr><td>Router Solicitation (RS)

</td><td>133

</td><td>Host asks, "Are there any routers here?"

</td></tr><tr><td>Router Advertisement (RA)

</td><td>134

</td><td>Router says, "I am here, use this prefix."

</td></tr></tbody></table>

</div>## 7.0 Practical Application: CLI Reference

### Global Configuration

\# Mandatory command to allow the router to forward IPv6 packets

Router(config)# ipv6 unicast-routing

\# Static Default Route

Router(config)# ipv6 route ::/0 &lt;next-hop&gt;

\# Standard Static Route

Router(config)# ipv6 route &lt;prefix&gt;/64 &lt;next-hop&gt;

### Interface Configuration

Router(config-if)# ipv6 enable # Generates an LLA only

Router(config-if)# ipv6 address 2001:db8:1::1/64 # Static GUA

Router(config-if)# ipv6 address autoconfig # Use SLAAC

Router(config-if)# ipv6 address fe80::1 link-local # Manually set LLA

### Verification

- show ipv6 interface brief: High-level status check.
- show ipv6 route: View the IPv6 routing table.
- show ipv6 neighbors: View the Neighbor Cache (equivalent to the ARP table).

## 8.0 Conclusion: Core Takeaways

1. Link-Local Addresses (fe80::/10) are mandatory for local communication and serve as the next-hop for routing protocols.
2. ipv6 unicast-routing must be enabled globally for a Cisco device to function as a router.
3. NDP replaces ARP, using Solicited-Node Multicasts for efficiency.
4. Header Efficiency: Removing the checksum and fixing the header size at 40 bytes improves core routing performance.

# Days 34, 35: Access Control Lists

# CCNA 200-301 Study Guide: Mastering Access Control Lists (ACLs)

## 1.0 Introduction: The Role of ACLs

In network engineering, an Access Control List (ACL) acts as a security bouncer. It inspects every packet attempting to cross a router interface and decides to Permit or Deny it based on specific rules.

Beyond security, ACLs are also used to "match" or classify traffic for:

- NAT (Network Address Translation)
- QoS (Quality of Service)
- Demand Dial Routing

## 2.0 The Core Principles of ACL Processing

ACL logic is strict and predictable. Routers follow three fundamental rules when evaluating a packet against a list:

1. Sequential Order (Top-Down): The router starts at the first line and moves down.
2. First Match Execution: As soon as a match is found, the action (Permit/Deny) is taken, and processing stops. The router does not check subsequent lines.
3. The Implicit Deny: Every ACL ends with an invisible, unwritten deny any any. If a packet doesn't match any of your permit rules, it is dropped.

Instructor's Note: Because of the implicit deny, every functional ACL must contain at least one permit statement, or it will block 100% of traffic.

### Application Rules

- One ACL per interface, per protocol, per direction.
- An interface can have one inbound IPv4 ACL and one outbound IPv4 ACL.

## 3.0 Standard vs. Extended ACLs

<div dir="ltr" id="bkmrk-feature-standard-acl" style="text-align:left;"><table><colgroup><col style="width:130px;"></col><col style="width:206px;"></col><col style="width:266px;"></col></colgroup><tbody><tr><td>Feature

</td><td>Standard ACL

</td><td>Extended ACL

</td></tr><tr><td>Criteria

</td><td>Source IP Address only.

</td><td>Source/Dest IP, Protocol, and Ports.

</td></tr><tr><td>Number Range

</td><td>1–99 and 1300–1999

</td><td>100–199 and 2000–2699

</td></tr><tr><td>Granularity

</td><td>Low (Sledgehammer)

</td><td>High (Scalpel)

</td></tr><tr><td>Placement

</td><td>Closest to the Destination

</td><td>Closest to the Source

</td></tr></tbody></table>

</div>### The Placement Logic

- Standard (Sledgehammer): Since it only checks the source, placing it near the source might block the user from reaching everything. Place it near the destination to be specific.
- Extended (Scalpel): Since it knows exactly where the packet is going and what port it's using, place it near the source to drop unwanted traffic early and save bandwidth.

## 4.0 Wildcard Masks and Syntax

### 4.1 Wildcard Mask Logic

Wildcard masks are the inverse of subnet masks.

- 0 bit: Match Exactly.
- 1 bit: Ignore ("Don't Care").

Keywords:

- host: Equivalent to wildcard 0.0.0.0 (matches one IP).
- any: Equivalent to wildcard 255.255.255.255 (matches everything).

### 4.2 Configuration Syntax

Standard ACL:

access-list 10 permit 192.168.1.0 0.0.0.255

Extended ACL:

access-list 101 permit tcp 10.1.1.0 0.0.0.255 any eq 80

Pro Tip: The established keyword in Extended ACLs allows return traffic for already active TCP sessions but blocks new connections initiated from the outside.

## 5.0 Essential Protocol and Port Reference

<div dir="ltr" id="bkmrk-service-protocol-por" style="text-align:left;"><table><colgroup><col style="width:79px;"></col><col style="width:86px;"></col><col style="width:56px;"></col><col style="width:96px;"></col></colgroup><tbody><tr><td>Service

</td><td>Protocol

</td><td>Port

</td><td>Transport

</td></tr><tr><td>ICMP

</td><td>1

</td><td>N/A

</td><td>IP

</td></tr><tr><td>TCP

</td><td>6

</td><td>N/A

</td><td>IP

</td></tr><tr><td>UDP

</td><td>17

</td><td>N/A

</td><td>IP

</td></tr><tr><td>SSH

</td><td>N/A

</td><td>22

</td><td>TCP

</td></tr><tr><td>Telnet

</td><td>N/A

</td><td>23

</td><td>TCP

</td></tr><tr><td>DNS

</td><td>N/A

</td><td>53

</td><td>TCP/UDP

</td></tr><tr><td>HTTP

</td><td>N/A

</td><td>80

</td><td>TCP

</td></tr><tr><td>HTTPS

</td><td>N/A

</td><td>443

</td><td>TCP

</td></tr><tr><td>TFTP

</td><td>N/A

</td><td>69

</td><td>UDP

</td></tr></tbody></table>

</div>## 6.0 ACL Management and Verification

### 6.1 Editing with Sequence Numbers

Modern IOS allows you to edit specific lines without deleting the whole list:

1. ip access-list extended 101
2. no 20 (Deletes line 20)
3. 25 permit udp any any eq 53 (Inserts new rule at line 25)

Resequencing: ip access-list resequence 101 10 10 (Starts at 10, increments by 10).

### 6.2 Verification Commands

- show access-lists: The most important command. Shows the rules and the "hit counts" (how many times a rule was matched).
- show ip interface &lt;id&gt;: Confirms if an ACL is applied and in which direction (In/Out).

## 7.0 Key Takeaways Summary

1. Top-Down Logic: Once a match is made, the router stops looking.
2. Implicit Deny: If you don't permit it, it's denied by default.
3. Standard: Match Source IP; place near Destination.
4. Extended: Match Source, Dest, Protocol, Port; place near Source.
5. Troubleshooting: Use show access-lists to check hit counts and verify your logic is actually catching traffic.

# Day 36: CDP and LLDP

# CCNA 200-301 Study Guide: Layer 2 Discovery (CDP &amp; LLDP)

## 1.0 Fundamentals of Layer 2 Discovery

Layer 2 discovery protocols act as the "digital handshake" of a network, allowing devices to identify neighbors without requiring an IP address. They operate at the Data Link Layer, meaning discovery occurs as long as the physical link is up and the protocol is enabled.

### Core Attributes

- Operational Scope: Information is strictly point-to-point. Discovery frames are processed by the direct neighbor and then discarded; they are never forwarded.
- Shared Data: Device IDs (Hostnames), IP addresses (for management), platform/capabilities, and local/remote interface mappings.
- Security Risk: These protocols are "chatty" and broadcast sensitive topology data. Standard Practice: Disable discovery on untrusted ports (e.g., user-facing access ports) to prevent reconnaissance.

## 2.0 Cisco Discovery Protocol (CDP)

CDP is a Cisco-proprietary protocol used for identifying and managing Cisco hardware.

### Operational Defaults

- Status: Enabled globally and on all interfaces by default.
- Multicast MAC: 0100.0CCC.CCCC
- Default Timers:
    
    
    - Hello Timer: 60 seconds.
    - Holdtime: 180 seconds.
- Version 2 (Default): Includes enhanced features like Native VLAN and duplex mismatch detection.

### Configuration &amp; Management

<div dir="ltr" id="bkmrk-command-mode-purpose" style="text-align:left;"><table><colgroup><col style="width:167px;"></col><col style="width:89px;"></col><col style="width:263px;"></col></colgroup><tbody><tr><td>Command

</td><td>Mode

</td><td>Purpose

</td></tr><tr><td>cdp run

</td><td>Global

</td><td>Enables CDP globally.

</td></tr><tr><td>no cdp run

</td><td>Global

</td><td>Disables CDP globally.

</td></tr><tr><td>cdp enable

</td><td>Interface

</td><td>Enables CDP on a specific port.

</td></tr><tr><td>cdp timer \[sec\]

</td><td>Global

</td><td>Adjusts advertisement frequency.

</td></tr><tr><td>cdp holdtime \[sec\]

</td><td>Global

</td><td>Adjusts neighbor retention time.

</td></tr></tbody></table>

</div>### Verification Commands

- show cdp: Checks global status and timers.
- show cdp neighbors: Provides a summary table of adjacent Cisco devices.
- show cdp neighbors detail: Provides Layer 3 addresses and software versions.
- show cdp entry \[name\]: Focuses on a specific neighbor.

## 3.0 Link Layer Discovery Protocol (LLDP)

LLDP (IEEE 802.1AB) is the vendor-neutral standard required for discovery in multi-vendor environments.

### Operational Defaults

- Status: Typically disabled by default on Cisco switches.
- Multicast MAC: 0180.C200.000E
- Default Timers:
    
    
    - Hello Timer: 30 seconds.
    - Holdtime: 120 seconds.
    - Reinit Delay: 2 seconds.

### Configuration &amp; Management

Unlike CDP, LLDP allows for granular control over transmission and reception.

<div dir="ltr" id="bkmrk-command-mode-purpose-1" style="text-align:left;"><table><colgroup><col style="width:167px;"></col><col style="width:89px;"></col><col style="width:334px;"></col></colgroup><tbody><tr><td>Command

</td><td>Mode

</td><td>Purpose

</td></tr><tr><td>lldp run

</td><td>Global

</td><td>Enables LLDP globally.

</td></tr><tr><td>lldp transmit

</td><td>Interface

</td><td>Enables sending LLDP frames on the port.

</td></tr><tr><td>lldp receive

</td><td>Interface

</td><td>Enables processing incoming LLDP frames.

</td></tr><tr><td>lldp timer \[sec\]

</td><td>Global

</td><td>Configures advertisement frequency.

</td></tr><tr><td>lldp holdtime \[sec\]

</td><td>Global

</td><td>Configures the holdtime.

</td></tr></tbody></table>

</div>### Verification Commands

- show lldp
- show lldp neighbors
- show lldp neighbors detail
    
    
    - Note: LLDP uses B (Bridge) in its capability codes where CDP uses S (Switch).

## 4.0 Protocol Comparison Matrix

<div dir="ltr" id="bkmrk-feature-cisco-discov" style="text-align:left;"><table><colgroup><col style="width:134px;"></col><col style="width:235px;"></col><col style="width:233px;"></col></colgroup><tbody><tr><td>Feature

</td><td>Cisco Discovery Protocol (CDP)

</td><td>Link Layer Discovery (LLDP)

</td></tr><tr><td>Ownership

</td><td>Cisco Proprietary

</td><td>IEEE 802.1AB (Standard)

</td></tr><tr><td>Cisco Default

</td><td>Enabled

</td><td>Disabled

</td></tr><tr><td>Hello Timer

</td><td>60 Seconds

</td><td>30 Seconds

</td></tr><tr><td>Holdtime

</td><td>180 Seconds

</td><td>120 Seconds

</td></tr><tr><td>Interface Logic

</td><td>cdp enable (Binary)

</td><td>transmit / receive (Granular)

</td></tr><tr><td>VTP Support

</td><td>Yes

</td><td>No

</td></tr><tr><td>Capability Code

</td><td>S (Switch)

</td><td>B (Bridge)

</td></tr></tbody></table>

</div>