The OSI Model
DATA in Layers
Layer | PDU/Datagram | Use Case |
---|---|---|
Application | Data | Bridge between applications and the network |
Presentation | Data | Translates data if needed, encryption |
Session | Data | Manages session state |
Transport | Segment | Protocols, segmenting, ordering of packets |
Network | Packet | IP Addressing, Routing, Switches(L3) |
Data-Link | Frame | MAC, Switches(L2), Organizes bits to Frames |
Physical | Bit | TX/RX bits, cabling, standards. |
Layer 1: The Physical Layer is the lowest layer of the OSI/TCP model, representing the literal physical means of data transmission via bits. Every bit transmitted and received by a NIC, data cable, and antenna pass through this layer. Layer 1 defines these devices and mediums along with the standards in which they physically communicate. It focuses on pure data transmission at it’s rawest form, like a radio wave or fiber pulse, not the logical elements like addressing.
Layer 2: The Data-Link layer focuses on creating Ethernet frames from bits and their transmission via a MAC Address. On a local level, this helps us define where a frame will be sent or received. Data-Link frames stay within their LAN.
The Ethernet Frame
The data-link layer utilizes Ethernet frames to transmit layer 1 data into logical form to direct said data to a switch or other device locally. It’s a post card, an encapsulating unit of data(PDU) for addressing who(MAC) our data is going to. MAC addresses will be stripped and added depending on whether the data needs to be routed or retained on the local network.
- Preamble - Aids receiving device synchronization to read the frame.
- Start frame Delimiter - indicates the end of the preamble/beginning of the frame
- Destination MAC Address - MAC address of where frame is being sent
- Source MAC Address - MAC address identifying device sending frame
- Type - Specifies type of protocol in the payload or length of payload (IPV4/6, ARP)
- Payload - The data being transmitted. Between 46-1500 bytes
- Frame Check Sequence(FCS) - Error checking. Aids identifying errors during transmission
If VLAN’s are present, a VLAN tag will be applied to the frame between Source MAC and type
Or
Where’s my data?
In Layer 1, a client’s NIC converted outgoing data into binary and sends it across a physical medium. At layer 2, our interface(NIC) translated the binary data into a logical form for local addressing. An Ethernet frame is created with a destination and source address to either send to a device locally or to prepare the transmission for routing outside the LAN via Layer 3.
Layer 3: The Network layer is responsible for routing between different networks by utilizing logical addressing(IP). With these IP address’, we can identify devices and route packets on a global scale dynamically. When thinking of layer 3, think routers, hardware firewalls, and layer 3 switches.
Packets
Due to packets being delivered globally, the number of fields within layer 3’s PDU are larger.
- Version - provides IP version (4/6)
- Header Length - a 4 bit field describing IP header length in 32 bit incremenents
- Type of Service - used for prioritizaion (QOS)
- Total Length - indicaties size of entire packet (header and data)
- Identification - Value for fragmented packets to ID as a set
- IP Flags - Used for fragmentation process
- Fragment Offset - describes fragment position in the original fragmented packet
- Time to Live - used to prvent endless loops by reducing value over time. If value drops to 0, packet is dropped
- Protocol - ID’s which protocol is being utilized in the packet (TCP =6, UDP = 17)
- Header Checksum - error correction
- Source Address - sender IP
- Destination Address - reciever IP
- IP Option - used for various options(not common)
Layer 4: The transport layer