up:: [[Networking MOC]]
tags:: #note/boat #note/develop #on/computing/networking
# Ethernet LAN Switching
- Most of this is Layer 2 stuff
- Routers are used to connect separate LANs
## Ethernet Frames
- Header has 5 fields
- Preamble & SFD (Start Frame Delimiter): Allows device to be prepared to receive the rest of the data in the frame
- Destination: Layer 2 address where data is being sent
- Source: Layer 2 address of the device that sent the frame
- Type: Indicated the Layer 3 protocol used in the encapsulated packet
- Sometimes this is a "Length" field, indicating the length of the encapsulated data
- Trailer has 1 field
- FCS (Frame Check Sequence): used by the receiving device to detect errors
- Header + Trailer = 26 bytes
- Unicast Frame = frame destined for a single target
### Preamble & SFD
- Preamble
- 7 bytes long (56 bits)
- 10101010 * 7
- allows devices to synchronize their receiver clocks, to make sure they're ready to receive the rest of the frame
- SFD
- 1 byte
- 10101011
- Marks the end of the preamble, and the beginning of the rest of the frame
### Destination and Source
- Indicate the devices receiving and sending the frame
- Consist of MAC (Media Access Control) addresses
- 6 byte (48 bit) address of the physical device, assigned to device when made
### Type/Length
- 2 bytes
- Value of 1500 or less == length of the encapsulated packet
- Value of 1536 or greater == type of encapsulated packet (length is determined via other methods)
- IPv4 = 0x0800 (2048)
- IPv6 = 0x86DD (34525)
### FCS
- Frame Check Sequence
- 4 bytes
- Detects corrupted data by running a CRC (Cyclic Redundancy Check) algorithm over received data
## MAC Addresses
- 6 byte physical address assigned to a device when it is made
- Different from an IP address
- Also called a BIA (Burned-In Address)
- Globally unique
- First 3 bytes are the OUI (Organizationally Unique Identifier), which is assigned to the company making the device
- Last 3 bytes are unique to the device
- Written as 12 hex characters
## Switching
For this example, let's say that PC1 is sending a frame to PC2
- PC1 sends the frame to the switch
- The switch looks at the source address of the frame and uses that to learn where PC1 is
- Switch associates the source address with the interface it's plugged into (Dynamically learned MAC address)
- Unknown unicast frame == frame for which the switch doesn't have an entry in its MAC address table
- Switch doesn't know where to send the frame, so it floods the frame (forward the frame out of all its interfaces except the one it received the frame on)
- If a device receives a frame with a destination address that doesn't match its own, it's just ignored
- PC2 receives the frame and processes it
- The switch can't update its MAC address table with PC2's information unless PC2 sends something to it
- Known Unicast Frame == frame for which the switch already has the destination device in it's MAC address table
- On Cisco switches, MAC addresses are removed from the table after 5 minutes of inactivity
- Every switch keeps a MAC address table and dynamically fills it by looking at the source addresses of frames it receives
## References
_Free CCNA | Ethernet LAN Switching (Part 1) | Day 5 | CCNA 200-301 Complete Course_. YouTube Video. Vol. 5. 63 vols. CCNA 200-301 Complete Course, 2019. [https://youtu.be/u2n762WG0Vo?si=fMqNaeyslRXk3dQN](https://youtu.be/u2n762WG0Vo?si=fMqNaeyslRXk3dQN).
_Free CCNA | Ethernet LAN Switching (Part 2) | Day 6 | CCNA 200-301 Complete Course_. YouTube Video. Vol. 6. 63 vols. CCNA 200-301 Complete Course, 2019. [https://youtu.be/5q1pqdmdPjo?si=tfgJI_iHyRzg9JYa](https://youtu.be/5q1pqdmdPjo?si=tfgJI_iHyRzg9JYa).