- OSI and TCP/IP Models
- Application layer — HTTP/FTP/SMTP
- Presentation layer
- Session layer
- Transport layer — TCP/UDP — Segment — Computer Program
- Network layer — IP Packet — Routers
- Data link layer — Frame — MAC addresses
- Physical layer — WAN and LAN — Bits & Volts
- Router vs switch vs hub
- References
OSI and TCP/IP Models
- OSI = Open System Integration
- OSI describes how the data is transferred from one computer into another in a network.
- LAN = local area net, WAN = wide area net
- Web browser performs application layer, presentation layer and session layer.
Application layer — HTTP/FTP/SMTP
- Computer program operating in ports, we need ports so that applications can communicate between each other.
‣
‣
Presentation layer
This layer receives data from application layer in the form of characters and encodes (translates and compresses) them into binary form. It is needed to reduce the size of file, to send data faster.
Session layer
- It is like the Python’s context manager, establishes the connection and removes the coupling after the work is done.
- Responsible for Authentication, Authorization, and session management (session layer receives the data in the form of Data Packets from the network layer, it knows what is text and what is the image file, and it knows to which website the data should be redirected).
Transport layer — TCP/UDP — Segment — Computer Program
- Responsible for reliability of communication with segmentation, flow control, error control.
- Data received from session layer are divided into bunches called segments.
- Each segment contains, source and destination port number, and sequence number. Port number helps to direct the application to correct application. And sequence number is used to reassemble sequences in a correct order to form the correct message in the receiver.
- Flow control. Controls the amount of data transferred. Responsible for speed of data transferred. Buffers and offsets.
- Error control. If the data is not sent, transport layer ask sender to send the one more time. Checksum is added to each segment to determine if the data is consistent.
- TCP = Transmission control protocol
- Connection oriented
- Lost data will be retransmitted.
- Used by HTTP, FTP, SMTP, POP. Where full data deliver is must.
- Header size from 20 → 60 bytes
- UDP = User datagram protocol
- Connectionless
- Faster, because UDP doesn’t say if the segment/packed was delivered or not.
- Used by video conferencing, playing videos, streaming, DNS, gaming.
- Header size → 8 bytes
- TCP rules inside a computer is typically the operating system's kernel and network stack. The network stack is a software component of the kernel that handles the data transmission and reception over the network. The network stack is responsible for implementing the TCP protocol, it takes care of creating and managing TCP connections, breaking down data into packets, and handling flow control, error-checking, and retransmission of lost or corrupted packets.
‣
Network layer — IP Packet — Routers
- Transport layer sends data segments to network layer. This layer works for the transmission of the received data segments from one computer into another located in different networks.
- Data units in this layers are called packets. Network layer assigns IP addresses of sender and receiver to segment to create a packet. Size of packet is 2^16 bytes. Header consists of 24 bytes, and the rest is for data.
- Responsibilities: logical addressing (giving IP addressing to devices in a network), routing (moving data packet from source into destination, in one network all devices have the same network address ), path determination (to find the best path to send the data - OSPF - open shortest path first).
- IPv4 = 32 bits → Network portion + host portion, subnet mask is used
Data link layer — Frame — MAC addresses
- Switch operates on this layer.
- It receives data packet from network layer. Contains IP addresses of sender and receiver.
- Logical addressing: done in network layer
- Physical addressing: done in data link layer, where MAC addresses are assigned to packets to form a FRAME.
- MAC address = 12 digit alpha-numeric text embedded into Network Interface Card by manufacturer as a software.
Physical layer — WAN and LAN — Bits & Volts
- Hub operates in this layer.
- Generates the signal after converting Frame to Bits.
Router vs switch vs hub
- Router transmits data from one network to another in form of packets.
- Switch transmits data from one device to another in form of frames.
- When use it? To increase the number of ports.
- Hub transmits data from one device to another in form of binary bits.
- When use it? It doesn’t filter data and does not know where data to be sent. Used to increase the network distance.
- Hub is a broadcast device that sends data from one node to all nodes but a Switch is a multicast device that can send data to a particular node.