Alterna · учебный материал
Network protocols
Chapter 6: Network protocols - TCP, UDP, HTTP, FTP, SMTP, SSH. TCP/IP model, application protocols, HTP methods and codes.
Что в этом материале
- TCP/IP model: four levels
- Incapsulation Matron
- TCP and UDP: two delivery patterns
- TCP handshake
- Application protocols
- Gather HTTP request
- Protocol Research
- Ports: Addresses inside the computer
- Set the port protocol.
- OSI model: seven levels
Содержание и основные понятия
Back to the table of contents
Alterna · Chapter 6 · page 6.1
Network protocols
The protocol is the language in which computers agree to share data. Without protocols, the network is a set of wires without meaning.
In chapter 4, you learned that the data in the network are broken down into
Packages
And they travel by
TCP/IP
Now let's look at every level in detail.
The protocols define how to connect, how to guarantee delivery, how you send a letter or download a file.
GEF · Basic
EEG · task 13
01
TCP/IP model: four levels
Each level solves its task and uses the following protocols:
GEF
EEG 13
Why do you need levels?
When you open
https://alterna-edu.ru
The TCP/IP model divides them into multiple processes.
4 levels
so that each one is responsible for one task:
Level
Objective
Protocols
Data Unit
Application
Data format for user
HTTP, FTP, SMTP, DNS, SSH
Communication
Transport
Delivery between processes
TCP, UDP
Segment
Internet
Network-to-network routes
IP, ICMP, ARP
Package
Canal
Transfer to local network
Ethernet, Wi-Fi
(Frame)
Analogies
Sending the package:
Application
- You write a letter;
Transport
- Register the purchase order (delivery guarantee);
Internet
- state the address on the envelope;
Channel
- the courier's driving between the buildings.
Incapsulation
When sent, each level
Adds its title
Data:
Data
TCP + Data
IP + TCP + Data
ETH + IP + TCP + Data
Application
Transport
Internet
Canal
Sending: Headings added
Receive: Headings are removed
ETH
IP
TCP
HTTP data (GT / index.html)
♪ full frame in the cable ♪
Figure 1.
Incapsulation: each level adds a headline (as a mattress)
🪆
Incapsulation Matron
· which headings are added
Interactor
The data goes through four levels. Each has its own headline. Set it to the level to see the real fields.
L4
Ethernet
MAC Source:
AA:BB:CC:11:22:33
MAC recipient:
DD:EE:FF:44:55:66
EtherType:
0x0800
(IPv4)
FCS:
Control amount of personnel
L3
IP package
IP source:
192.168.1.10
IP recipient:
93.184.216.34
TTL:
64
(max. hops)
Protocol:
6
(TCP)
L2
TCP segment
Port source:
49152
(dynamic)
Port recipient:
80
(HTTP)
Seq:
1001
(byte number)
ACK:
2001
(confirmation)
Flags:
SYN, ACK, FIN
L1
HTTP Data
Request:
GET /index.html HTTP/1.1
Host:
alterna-edu.ru
User-Agent:
Mozilla/5.0
If you're on the level, you'll see the real headlines.
02
TCP and UDP: two delivery patterns
TCP is reliable and slow; UDP is fast and unsafeguarded
GEF
EEG 13
TCP — Transmission Control Protocol
Guaranteed delivery
: each segment is confirmed. If the package is lost, it goes again. Data come in.
I'm fine.
Sending.
Before the transmission, the TCP will install a connection —
three-way handshake
:
Client ~ server:
SYN
(Wanting to connect)
Client server:
SYN+ACK
(Applicable, confirmed)
Client ~ server:
ACK
(received, started)
Where TCP is used
Web (HTTP/HTTPS), e-mail (SMTP, IMAP), file transfer (FTP), remote access (SSH) - wherever important
Accuracy
.
UDP — User Datagram Protocol
No connection
:Dategrams are sent "how it works." No confirmations, no order, no reschedules.
Quick.
and
Low overhead costs
.
Where UDP is used
Video calls, online games, DNS requests, strimming wherever
Speed is more important
A lost video isn't a disaster.
Property
TCP
UDP
Connection
Yes.
None
Delivery guarantee
Yes (ACK + retry)
None
Data procedure
Retained
Not guaranteed
Speed
Slow down.
Hurry.
Overhead costs
Large (headings 20+ byte)
Minimum (8 bytes)
Examples
HTTP, FTP, SMTP, SSH
DNS, VoIP, games, strimming
🤝
TCP handshake
step-by-step animation · thate-way handshake
Interactor
Press "Shak" or "Auto" to see how the client and server install the TCP connection.
→
SYN (seq=x)
The client sends a SYN package with an initial sequence number. "I want to connect!"
←
SYN+ACK (seq=y, ack=x+1)
The server says, "I agree, this is my number, I confirm yours."
→
ACK (ack=y+1)
The client confirms: "Received!" The connection is established. You can transmit the data.
⇄
DATA + ACK
The data is transmitted. Each segment is confirmed. If you lose, you re-send.
Press "Shak" to start the handshake.
03
Application protocols
The protocols you encounter every day
GEF
EEG 13
HTTP / HTTPS — Web
HTTP
HyperText Transfer Protocol (HyperText Transfer Protocol) is the main source of the web.
Request
, server returns
Response
.
The request contains
method
(what to do) and
URL
(for which resource):
Method
Appointment
Example
GET
Get Resource
Open Page
POST
Send Data
Fill out the form
PUT
Replace Resource
Update Profile
DELETE
Remove Resource
Remove Comment
PATCH
Partial update
Change One Field
The server response contains
Status code
:
Code
Meaning
Example
200
OK — Success
Page loaded
301
Redirected forever.
Old Url ♪ New
404
Not found
Page deleted
403
Prohibited
No access rights
500
server error
Code failure
HTTPS = HTTP + TLS
HTTPS encrypts traffic. Without HTTPs, your password, bank card, and correspondence fly.
Open text
Always check.
🔒
in the line!
FTP - Transfer Files
FTP
File Transfer Protocol is a protocol for downloading and downloading files.
Command
(port 21) and
data
(port 20).
SMTP, POP3, IMAP — E-mail
Protocol
Port
Appointment
SMTP
25 / 587
Send
Mail (client ~ server ~ servers)
POP3
110
download
mail to device (from server)
IMAP
143
Synchronization
Mail (maintained on server)
SSH — Safe Access
SSH
Secure Shell (port 22) is an encrypted remote access to the server command line.
Telnet
(port 23, no encryption).
DNS — Internet Telephone Book
DNS
Domain System 53 converts domain names to IP addresses.
Page 6.2
.
📝
Gather HTTP request
Drag-and-drop · collect the request in the right order
Interactor
Pull the HTTP parts in the right order. The first line is the method and the path, then the headlines, the empty string, the body.
GET /index.html HTTP/1.1
Host: alterna-edu.ru
User-Agent: Mozilla/5.0
Accept: text/html
1
First line (mode + route)
2
Host Heading
3
User-Agent Heading
4
Accept Heading
5
An empty line (end of the headings)
Relationship to Chapter 8
B
Chapter 8, "Web development"
You'll learn to use
fetch()
to JavaScript to send HTTP requests from code. Everything you've learned about protocols here works under the hood of everyone.
fetch()
.
Go to JavaScript
🔌
Protocol Research
press level · details and examples
Interactor
Push the drain levels to see what protocols they work on.
Application level
HTTP · HTTPS · FTP · SMTP · DNS · SSH · IMAP · POP3
Protocol for specific tasks: web, mail, files, remote access. Work with user data. Ports: HTTP=80, HTTPS=443, FTP=21, SMTP=25, DNS=53, SSH=22.
Transport level
TCP · UDP
Data delivery between processes. TCP is reliable with confirmation. UDP is fast without assurance.
Ports
It is used to distinguish between applications (80 on the web, 53 on DNS).
Internet level
IP · ICMP · ARP
IP addresses and routes between networks. IP delivers packages from source to recipient. ICMP is a diagnostic (ping) ARP definition of MAC address on IP.
Canal level
Ethernet · Wi-Fi (802.11) · PPP
It's a local network transfer. Ethernet is on cable. Wi-Fi is on radio channel. MAC ad