Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Network fundamentals (1) = OSI seven-layer model

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

I really do not know what kind of language to sort out the network knowledge I have learned. if it is theoretical knowledge, there will be a lot of search on Baidu encyclopedia. I hope all the things I have sorted out can find templates in life, close to life, and come from life.

We are all familiar with the network, whether it is qq, Wechat and other social software or games, we can not do without the network, the network runs through every bit of our lives, and today's mature network systems are developed from the traditional network bit by bit.

Think about it with questions, we all know that OSI has seven layers, so what is layer and why should it be layered? What are the advantages of layering? Why is there a different protocol for each layer?

Layers: describes the effective communication processes on all requirements, which we call layers.

Why layering?

This is like a company, at the beginning, there are very few people in the company, with the expansion of the size of the company, we have to divide each department to achieve the role of each department, the network after long-term development, increasingly mature and robust, people are logically divided into seven layers, to let each layer to achieve the role of each layer, to form a perfect network system.

The advantage of layering?

The complex network is divided into layers that are easy to manage, easy to troubleshoot, create a better integrated environment, and the lower layer provides services for the upper layer. (what is the lower level and what is the high level? see the picture above)

Why are there devices and protocols for each layer?

Devices and protocols are related, because the development of networks has led to manufacturers of different devices, mainly routers and switches. at first, their respective manufacturers had their own standards, resulting in no communication between devices of different manufacturers. For example, Dell routers may not be able to communicate with Lenovo, which leads to a lot of obstacles to network communication, so in order to form a unified standard There is a standard agreement that all manufacturers must abide by.

This is similar to Putonghua, the agreement is only to reach a recognized and unified standard.

Starting with the upper layer protocol, the seven layers of OSI are introduced:

Application layer (user interface)

The application layer is generally an application: QQ Browser mailbox (specifically for the first layer of applications with communication functions)

To put it simply, an application with communication function is the interface of a user in the application layer (not called a port, which is relative to the transport layer).

Common protocols: telnet http smtp ftp

Presentation layer (there is no protocol, just a detailed division of the application layer)

The upper data represents special processes such as encryption, and defines the data format and encryption.

Session layer (there is no protocol, just a detailed division of the application layer)

Ensure data differentiation between different applications (applications).

For example, if you open a qq and a browser, you have two applications, but the content in your qq chat is only rendered in the qq, not in the browser, so the session layer makes a data distinction.

If it is more general, these three layers can be collectively called the application layer.

The following describes the lower layer protocols (devices are hardware devices)

Physical layer

At the lowest level, send or receive bitstreams.

What is the bitstream? we all know that there are only 0 and 1 in the computer world, which is relative to the physical layer. 1Byte 8bmt 1MBbyte 1024kB (byte) b (bit, for 0 1)

For example, 00101011 is 8 bits, 1 byte

What does flow mean? it means a lot, such as water flow, so there are a lot of zeros and ones called bitstreams in the network cable.

Hardware equipment: network cable card, optical fiber, cable

Data link layer

Function: convert bitstreams into data frames, responsible for framing

At this layer, the data is called frames.

Typical equipment: switch

Protocol data unit: Fram

Where there are devices, there are protocols, data link layer protocols: ppp HDLC ATM Ethernet (Ethernet, including 802.3 802.2) FR (frame Relay)

How the switch works:

The switch receives data frames (all the data to the switch is encapsulated into data frames, and the switch only receives data frames with source MAC addresses and destination MAC addresses), updates the MAC address table according to the source MAC address, and makes forwarding decisions based on the destination MAC address.

If it is a known unicast or broadcast frame, it is forwarded directly by the known port, and if it is unknown, all interfaces except the interface that received the frame are forwarded, which is called flooding. At this time, the computer received will give the switch a corresponding (tell the switch that I am the computer with the destination address), and there will be one more record in the switch, the correspondence between the MAC address and the port, but this record is dynamic, with an aging time of 300 seconds, and this record lasts only 300 seconds.

The MAC address is equivalent to a database inside the switch, recording the corresponding relationship between the MAC address and the interface number

The switch views the MAC address table show mac-address-table

Ethernet (an important protocol at this layer) frame format:

* Network layer (point-to-point communication)

Determine the logical addressing of the path and realize the communication between different networks

Devices: router

Protocol: ip arp icmp (ping command)

Protocol data Unit (pdu): packet

These protocols are very important. Ip is a general term for Internet protocols. Format of ip protocol:

The function of arp: parsing ip address into MAC address is the bridge of computer communication, which is very important, because ip is only a definite range, and MAC address is the unique identification of each computer. Why does the ip address determine only one range? This is determined by the routing table, which contains only the corresponding network segments and ports. Ip is equivalent to which class you are in, and MAC is equivalent to who you are in this class.

* Transport layer (end-to-end communication)

Protocol: TCP UDP

Devices: none

Function: reliable or unreliable data transmission, data correction before data retransmission.

TCP is reliable, connection-oriented data transmission, UDP is unreliable, not connection-oriented data transmission.

Why would you say that? Why is it reliable? Why is it connection-oriented?

TCP goes through three handshakes and four disconnections.

Data format of TCP:

Data format of UDP:

Comparing the source port number or the destination port number, we find that UDP has a lot less than TCP, no sequence number, no confirmation sequence number, no tag field, nothing important.

The role of some important tag fields:

RST: reconnect

FIN: request to disconnect

SYN: request a connection

ACK: confirm serial number

The concept of port: range (0mm 65535)

The process of three-way handshake:

Why is TCP reliable?

Because it is troublesome, just like your Wechat login device, you have to go through the old device authentication, and there are many confirmation mechanisms, so it is safe. The same is true of TCP, because it has more confirmation mechanisms, so it is safe and reliable.

What is connection oriented?

Connection-oriented means to manage data connections by relying on the sender and receiver to display communication or blocking.

Three-way handshake language description:

The connection of TCP is a very careful process. An and B say I request a connection, but computers are different from people. How can B tell the difference that what you said is used to request a connection? Did A send a tag field to B and send a sequence number seq=A, then B sent An a confirmation sequence number, which means I agreed, so ack=A+1 (confirm that the sequence number is all source sequence number plus 1), and also sent A his own sequence number seq=B;. At this time, it is not over yet. When A receives the reply from B, it begins to establish a session, and when the reply is established, seq=A+1. Used to indicate that this is the second sentence said by host An and host B, ack=B+1: (the confirmation of ack is always the confirmation of the other party)

Schematic diagram of four disconnections:

Three-way handshake and four disconnections are mainly due to the fact that there is a tag field in the format of the TCP protocol, but not in UDP.

TCP (Transmission Control Protocol) UDP (user data Protocol)

There is a port number in the protocol format of TCP UDP. Sometimes we say web service-- http protocol-- tcp--80 port.

Http protocol refers to the application layer protocol, tcp refers to the transport form at the transport layer of this protocol, and port 80 is the port number at the transport layer.

At this point, you may be very confused. To sum up, ip is used to indicate a scope, such as a class, MAC is used to identify a specific host, such as a person in a class, and the port number is used to identify an application on this computer, such as a person's hand in a class.

So as long as there is client software that provides services, there is an application layer protocol, and when passing through the transport layer, there is a port number, but there are two cases of data, either TCP or UDP.

Introduction of port number:

For example, the Telent protocol, when data transmission, the source port number is any one, the destination port number is 23. 5.

About seven layers of TCP/ will be introduced, but it may not be so fine in actual production, so people habitually say that OSI IP has five layers:

Network interface layer, Internet layer, host to host layer, application layer.

I drew a picture myself to show my understanding of these seven layers.

Summary:

Common service agreement port

1. POP3 TCP 110

2. IMAP TCP 143

3. SMTP TCP 25

4. Telnet TCP 23

5. Terminal Services TCP 3389

6. TFTP UDP port 69

7. HTTP TCP 80

8. NTP UDP port 123

9. HTTPS TCP 443

10. FTP controls TCP 21 FTP default data TCP 20

11. RADIUS UDP 1645

12. DHCP Server UDP 67

13. DNS UDP 53 DNS TCP 53

14. SNMP UDP 161

15 ipsec UDP 500

16 PPTP TCP 1723

17 L2TP UDP 1701

The following ports are commonly used in proxy servers:

(1)。 HTTP protocol proxy server commonly used port number: 808080Universe 3128According to 8081Universe 9080

(2)。 Common port number of SOCKS proxy protocol server: 1080

(3)。 FTP (File transfer) Protocol proxy server commonly used port number: 21

(4)。 Telnet (remote login) protocol proxy server common port: 23

HTTP server, default port number is 80/tcp (* Executor opens this port)

HTTPS (securely transferring web pages) server, default port number is 443/tcp 443/udp

Telnet (unsecured text transfer). The default port number is 23/tcp (the port opened by * Tiny Telnet Server).

FTP, the default port number is 21/tcp (ports opened by * * Doly Trojan, Fore, Invisible FTP, WebEx, WinCrash and Blade Runner)

TFTP (Trivial File Transfer Protocol), the default port number is 69/udp

SSH (secure login), SCP (file transfer), port redirection. The default port number is 22/tcp.

SMTP Simple Mail Transfer Protocol (E-mail), the default port number is 25/tcp (* * Antigen, Email Password Sender, Haebu Coceda, Shtrilitz Stealth, WinPC, WinSpy all open this port)

POP3 Post Office Protocol (E-mail), the default port number is 110/tcp

WebLogic, the default port number is 7001

Webshpere application, the default port number is 9080

Webshpere management tool, the default port number is 9090

JBOSS, the default port number is 8080

TOMCAT, the default port number is 8080

WIN2003 remote login. The default port number is 3389.

Symantec AV/Filter for MSE, default port number is 8081

Oracle database, default port number is 1521

ORACLE EMCTL, the default port number is 1158

Oracle XDB (XML database), the default port number is 8080

Oracle XDB FTP service, default port number is 2100

MS SQL*SERVER database server, default port number is 1433/tcp 1433/udp

MS SQL*SERVER database monitor, default port number is 1434/tcp 1434/udp

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report