# Routing Basics
### Layer 2 and 3 Addressing
Layer 3 addresses provide a way of grouping network devices.

Layer 3 -> 192.168.1.101 -> 1.1
Layer 2 -> 0019.d16e.9282 -> 82
Layer 2 -> Collision domain
Layer 3 -> Broadcast domain (Group of devices that can be reached by sending a frame addressed to the broadcast MAC address)
### Address Resolution
When a PC want to send data to another PC, this is how they communicate

SA will send broadcast and ask certain PC for MAC address. Layer 2 and 3 both are required to send data.

*Address Resolution Protocol (ARP)/AR*: Process of using Layer 3 addresses to determine Layer 2 addresses
### Routers and Routing Tables
The process above can caused traffic. So, they break the broadcast domain into smaller segments.


Routing table contains destination network number (prefix/length), next hop along the way to destination network, and port should be use to reach the next hop (origin port). Routing table only know next hop, not the complete path.

### Routing in Action
*Default gateway*: a device that serves as an access point (door) to another network. Configured by network administrator/learned dynamically.
If PC know the default gateway MAC address, it skips the address resolution and send the packet to the router for further processing. If it doesn't know, it sends address resolution req to determine it.
*Default route*: used to direct traffic if it encounters a network that is not in its routing table
Layer 3 -> Identifies final destionation
Layer 2 -> Identifies the stop made along the way to get to the final destination. Change with it's stop along the route to the final destination

1. Converts data to bits -> electrical signal
2. Ethernet switch connecting PC to the router
3. Router received a frame (destination information) and look up in the MAC address table
4. If the destination MAC address is intended to the port, router will strip off the Layer 2 frame and examine the destination network of the Layer 3 address
5. Router add a new Layer 2 frame to send packet to the correct Next Hop
6. Router can't changes Layer 3 addresses, but can changes Layer 2 addresses with each hop. The opposite, switch can access Layer 2 addresses to forward frames, but it cannot change those addresses or access Layer 3 addresses
7. Decapsulating
### Connecting Different Layer 2 Technologies



