OSI Model
- Open Systems Interconnection Model
- dictating how all networked devices will send, receive and interpret data
- consists of 7 layers
The model (layers)
- 7. Application
- determine how the user interact with the data
- Email clients, file browsers or chat application belongs here
- 💡 Users interact with data trough GUI (Graphical user interface)
- DNS (Domain Name System) protocol also belongs here
- Translates web addresses to the IP addresses
- 6. Presentation
- standardization - the data of one application needs to be handled the same way
- 💡acts as translator for data and from the application layer
- data encryption occur here
- 5. Session
- create and maintain the connection to other computer (When a connection is established, a session is created)
- responsible for closing the connection
- session can contain “checkpoints”
- save bandwidth by only requiring send newest pieces of data
- data cannot travel over different sessions
- 4. Transport
- plays important part in transmitting data across network
- Data sent between devices follows 2 protocols
- TCP
- UDP
- 3. Network
- routing & re-assembly of data is part of this layer
- 💡protocol of this layer determine what’s the “optimal” path for data to reach device
- 💡 e.g. OSPF (Open Shortest Path First) and RIP (Routing Information Protocol)
- Deciding is based on the following
- What path is the shortest? I.e. has the least amount of devices that the packet needs to travel across.
- What path is the most reliable? I.e. have packets been lost on that path before?
- Which path has the faster physical connection? I.e. is one path using a copper connection (slower) or a fibre (considerably faster)?
- 💡 everything here is dealt with via IP addresses
- 2. Data Link
- focuses of the physical adresing of the transmission
- adds MAC address to the packet
- Mac addresses are unique, set by manufacturer and can be spoofed
- 💡 MAC address belongs to the network cards. Devices need network cards to connect to the network
- present the data in format suitable for transmission
- 1. Physical
- physical components of hardware
- 💡 Devices uses electrical signals to transfer data in a binary system
- 💡 For example, ethernet cables are part of this layer
Transport Protocols
TCP
- 💡Transmission Control protocol
- designed with reliabailit and guarantee in mind
- reserves constant connection between devices for the ammout of time it takes for the data to be send and received
- incorporates error checking
- can guarantee that data sent from the small chunks in the session layer (layer 5) has then been received and reassembled in the same order.
- stateful - 3-way handshake
Pros
- Guarantees the accuracy of data.
- Capable of synchronising two devices to prevent each other from being flooded with data.
- Performs a lot more processes for reliability.
Cons
- Requires a reliable connection between the two devices.
- A slow connection can bottleneck another device as the connection will be reserved on the receiving computer the whole time.
- is significantly slower than UDP because more work has to be done by the devices using this protocol
Used in situation as file share, internet browsing or sending email.
UDP
- 💡User Datagram Protocol
- much simpler than TCP
- does not include error checking
- synchronization between devices is not guaranted, hope is what you left
- 💡 stateless
Pros
- much faster than TCP
- leaves the application layer (user software) to decide if there is any control over how quickly packets are sent.
- does not reserve a continuous connection on a device.
Cons
- doesn’t care if the data is received.
- It is quite flexible to software developers in this sense.
- unstable connections result in a terrible experience for the user.
This protocol is used in situation where you sending and receive small data. e.g. Discovering protocols - ARP, DHCP
Also using for video streaming (packet loss result in pixelating).
UDP packet consist of following headers:
| Header | Description |
|---|---|
| Time to Live (TTL) | This field sets an expiry timer for the packet, so it doesn’t clog up your network if it never manages to reach a host or escape! |
| Source Address | The IP address of the device that the packet is being sent from, so that data knows where to return to. |
| Destination Address | The device’s IP address the packet is being sent to so that data knows where to travel next. |
| Source Port | This value is the port that is opened by the sender to send the UDP packet from. This value is randomly chosen (out of the ports from 0-65535 that aren’t already in use at the time). |
| Destination Port | This value is the port number that an application or service is running on the remote host (the one receiving the data); for example, a webserver running on port 80. Unlike the source port, this value is not chosen at random. |
| Data | This header is where data, i.e. bytes of a file that is being transmitted, is stored. |
Packet vs Frame
- Packet
- part of layer 3
- contain information such and IP address and payload
- efficient ways to communicate data across network
- have different structures that are dependant upon the type of packet that is being sent
- Frame
- part of layer 2
- Adds MAC address to the packet in process called encapsulation
- analogy is envelope
Some headers that packets can include
| Header | Description |
|---|---|
| Time to Live | This field sets an expiry timer for the packet to not clog up your network if it never manages to reach a host or escape! |
| Checksum | This field provides integrity checking for protocols such as TCP/IP. If any data is changed, this value will be different from what was expected and therefore corrupt. |
| Source Address | The IP address of the device that the packet is being sent from so that data knows where to return to. |
| Destination Address | The device’s IP address the packet is being sent to so that data knows where to travel next. |