====== CCNA - Switch & Router ====== ===== TL;DR ===== A **switch** connects devices on the same local network. A **router** connects multiples networks to each other. ===== Key takeaways ===== * Switch = layer 2 * Router = layer 3 * Switch = MAC Address * Router = IP Address * Switch = CAM table * Router = Routing table ===== Key Differences ===== ^ Element ^ Switch ^ Router ^ | OSI Layer | Layer 2 | Layer 3 | | Address used | MAC (Physical) | IP (Logical) | | Role | Connects devices on a LAN | Connects different networks | | Table used | CAM table | Routing table | | Typical usage | Local network, VLAN, Ethernet ports | Internet, inter-networks | ===== How does it work? ===== **Switch:** * Learns MAC addresses by looking at source MAC address from incoming traffic * Sends the frame to the right port by checking its CAM table * Stays in local network **Router:** * Check the destination IP address * Choose the right interface / the right route * allow to go from one network to another ===== Simple example ===== PC -> Switch -> Router -> Internet ===== Frequent errors ===== * Confuse MAC and IP * To think a switch routes between networks * To forget that a router is required to get out of the LAN ===== Packet Tracer Notes ===== * Make a small lab with 2 PCs, 1 switch and 1 router * Test to ping inside the LAN * Test the connection to another network ===== Useful links ===== * [[ccna:ethernet|Ethernet]] * [[ccna:vlan|VLAN]] * [[ccna:osi-tcpip|OSI - TCP/IP]]