The OSI seven-layer model enables reliable communication between different networks of different systems through seven hierarchical structural models, so its main function is to help different types of hosts achieve data transfer.
The nodes that complete the relay function are often referred to as trunking systems. In the OSI seven layer model, the relay systems at different tiers have different names.
The level at which a device works, the key is to see which layer of data head information it is working with. When the bridge is working, it is the head of the Mac that determines the forwarding port, so obviously it is the device of the data link layer.
specifically says:
Physical layer: Network card, network cable, hub, Repeater, modem
Data Link layer: Bridge, switch
Network layer: Router
The gateway works on the fourth transport layer and above
Hubs are physical layer devices that transmit information in the form of broadcasts.
A switch is a machine used for exchanging messages. Many for the link layer equipment (two-layer switch), the ability to address learning, the use of storage and forwarding in the form of exchange of messages.
One function of routers is to connect to different networks, and the other is to choose the route of information transmission. Choose unobstructed shortcut, can greatly improve communication speed, reduce network system communication load, save network system resources, improve network system patency rate.
The difference between a switch and a router
The switch has a very high bandwidth back bus and an internal switching matrix. All the ports on the switch are hooked up on this bus, and after the control circuit receives the packet, the processing port looks for the in-memory address table to determine which port the NIC (NIC) of the destination Mac (the hardware address of the network card) is hooked on, and the internal switch fabric quickly transmits the packet to the destination port. The destination MAC is broadcast to all ports if it does not exist, and after the receive Port responds the switch "learns" the new address and adds it to the internal MAC address table.
Using a switch can also "segment" The network, by comparing the MAC Address table, the switch only allows the necessary network traffic through the switch. Through the filtering and forwarding of the switch, it can effectively isolate the broadcast storm, reduce the occurrence of the mistake packet and the error packet, avoid the sharing conflict.
The switch can transmit data between multiple port pairs at the same time. Each port can be treated as a separate network segment, and the network devices connected to it enjoy full bandwidth on their own without competing with other devices. When node A sends data to node D, node B can send data to node C at the same time, and the two transports all have their own virtual connection with all the bandwidth of the network. If this is a 10Mbps Ethernet switch, then the total flow of the switch is equal to 2x10mbps=20mbps, and the total flow of a hub will not exceed 10Mbps when using the 10Mbps shared hub.
In a word, the switch is a kind of network device which can complete the packet forwarding function based on MAC address recognition. The switch can "learn" the MAC address and store it in the internal Address table, by establishing a temporary switching path between the originator of the data frame and the target receiver, so that the data frame is directly from the source address to the destination site.
From the point of view of filtering network traffic, the role of routers is very similar to switches and bridges. But unlike switches that work on the physical layer of the network, physically dividing the network segments, routers use specialized software protocols to logically divide the entire network. For example, a router that supports an IP protocol can divide the network into multiple sub-segments, and only network traffic that points to a particular IP address can pass through the router. For each packet received, the router recalculates its checksum value and writes a new physical address. As a result, it is often slower to use routers to forward and filter data than the switch that only looks at the physical address of the packet. However, for those networks with complex structures, using routers can improve the overall efficiency of the network. Another obvious advantage of routers is the ability to automatically filter webcasts.
What is the difference between a hub and a router?
First say hub, which is the hub. Its role can be simply understood as connecting some machines together to form a local area network. A switch (aka Interchange Hub) acts in much the same way as a hub. But there is a difference in performance: the way the hub uses shared bandwidth, and the switch is bandwidth-exclusive. In this way, when the machine is large or the amount of data is high, the two will be more obvious. The router and the above two have obvious difference, its function is to connect the different network segment and find the most suitable path of data transmission in the network. Routers are generated after the switch, just as the switch is generated after the hub, so the router and the switch have a certain connection, not completely independent of the two devices. Routers mainly overcome the inability of the switch to route forward packets.
in general, the main differences between routers and switches are shown in the following areas:
(1) different working levels
The initial switch is working at the data Link layer, and the router is designed to work at the network layer at the beginning. Because the switch works in the data link layer, it works relatively simple, and the router works at the network layer, can get more protocol information, the router can make a more intelligent forwarding decision.
(2) data forwarding is based on a different object The
switch uses the physical address or MAC address to determine the destination address of the forwarded data. The router uses the IP address to determine the address of the data forwarding. The IP address is implemented in the software and describes the network on which the device resides. MAC addresses are usually hardware-brought, distributed by the manufacturer of the network card, and have been cured to the network card, which is generally non-changing. The IP address is usually assigned automatically by the network administrator or the system.
(3) The traditional switch can only split the conflict domain, cannot split the broadcast domain, and the router can split the broadcast domain  
the network segment connected by the switch still belongs to the same broadcast domain, and the broadcast packet propagates across all network segments connected by the switch. In some cases, traffic congestion and security vulnerabilities can result. Network segments connected to routers are assigned to different broadcast domains, and broadcast data does not pass through the router. Although the third layer above the switch has the VLAN function, may also divide the broadcast domain, but each sub-broadcast domain is unable to communicate the communication, the communication between them still needs the router.
(4) The router provides the service of the firewall; The
router forwards only packets of a specific address, does not transmit packets that do not support routing protocols, and the transmission of unknown destination network packets, thus preventing broadcast storms.
Physical Layer
In the OSI reference Model, the physical layer (physical layer) is the lowest layer of the reference Model and the first layer of the OSI model.
The main function of the physical layer is to use the transmission medium to provide the physical connection to the data link layer, and realize the transparent transmission of the bit stream.
The function of physical layer is to realize the transparent transmission of bitstream between neighboring computer nodes, and to shield the difference between specific transmission media and physical equipment as much as possible. The data link layer above does not have to consider what the network's specific transport media is. The "Transparent transmit bitstream" indicates that the bit stream has not changed after the actual circuit is transmitted, and the circuit seems to be invisible to the transmitted bit stream.
Data Link Layer
The data link layer, the second layer of the OSI model, is responsible for establishing and managing links between nodes. The main function of this layer is: through various control protocols, the error-prone physical channel becomes error-free and can reliably transmit data frame data link.
The physical link is unreliable in the computer network due to the existence of various disturbances. Therefore, the main function of this layer is to provide the physical layer on the basis of the bit stream, through the error control, flow control method, the error of the physical line into a error-free data link, that is, providing a reliable way to transfer data through physical media.
This layer is also typically divided into two sub-layers of media access control (MAC) and Logical Link Control (LLC).
The main task of Mac sub-layer is to solve the problem of multi-user channel competition in the shared network, and complete the access control of the network media.
The main task of the LLC Sublayer is to establish and maintain network connections, perform error checking, flow control, and link control.
The specific work of the data link layer is to receive data from the physical layer in the form of a bit stream, and encapsulate it into a frame and transfer it to the previous layer, as well as the data frames from the upper layers, which are disassembled into the physical layer, and are also responsible for processing the acknowledgement frames sent back by the receiving end to provide reliable data transfer.
Network layer
The network layer is the third layer of the OSI model, which is the most complex layer in the OSI Reference model and the highest level of communication subnets. It provides services to resource subnets on the basis of the next two tiers. The main task is to select the most appropriate path for the message or packet through the communication subnet through the routing algorithm. This layer controls the forwarding of information between the data link layer and the transport layer, establishing, maintaining, and terminating the network connection. Specifically, data at the data link layer is converted to a packet at this level, and then the information is transferred from one network device to another via path selection, segment composition, sequence, and/or exit control.
In general, the data link layer solves the communication between nodes in the same network, and the network layer mainly solves the communication between different subnets. For example, when communicating between WANs, it is inevitable that routing (that is, there may be multiple paths between two nodes) is a choice problem.
The main issues that need to be addressed when implementing network layer functionality are as follows:
Addressing: A physical address (such as a MAC address) used in the data link layer solves only addressing problems within the network. When communicating between different subnets, the devices in each subnet are assigned a unique address in order to identify and locate the devices in the network. Because the physical technology used by each subnet may be different, this address should be a logical address (such as an IP address).
Exchange: Specify different ways of exchanging information. The common switching technologies are: line switching technology and storage and forwarding technology, and the latter includes message exchange technology and packet switching technology.
Routing algorithm: when there are multiple paths between the source node and the destination node, this layer can select the best path for the data grouping by the network according to the routing algorithm, and transmit the information from the most suitable path from the sending side to the receiving end.
Connection service: Unlike data link layer traffic control, the former controls the traffic between neighboring nodes of the network, and the latter controls the traffic from the source node to the destination node. The aim is to prevent blocking and to detect errors.
Transport Layer
The main task of the OSI under Layer 3 is data communication, and the 3-tier task is data processing. The Transport layer (Transport layer) is the 4th layer of the OSI model. Therefore, this layer is the interface and bridge of communication subnet and resource subnet, which plays a connecting role.
The main task of this layer is to provide users with reliable end-to-end error and flow control to ensure the correct transmission of the message. The function of the transport layer is to block the details of the lower layer data communication to the high level, i.e. transparently transmitting the message to the user. Common protocols for this layer are TCP protocols in TCP/IP, SPX in Novell networks, and Microsoft's Netbios/netbeui protocol.
The transport layer provides a transport service between the session layer and the network layer, which obtains data from the session layer and, if necessary, splits the data. The transport layer then passes the data to the network layer and ensures that the data is delivered correctly to the network layer. Therefore, the transport layer is responsible for providing reliable transmission of data between two nodes, when the connection between the two nodes is determined, the transport layer is responsible for monitoring the work. In summary, the main functions of the transport layer are as follows:
Transport Connection Management: provides the ability to establish, maintain, and dismantle transport connections. In the network layer, the transport layer provides the two services of "connection-oriented" and "non-link oriented" to the high level.
Handling Transmission errors: Provides reliable "connection-oriented" and less reliable "non-connected" data transfer services, error control, and flow control. When providing a "connection-oriented" service, data transmitted through this layer will be confirmed by the target device and the data will be re-sent if no acknowledgement has been received within the specified time.
Monitor Service quality.
Session Layer
The session layer, the 5th layer of the OSI model, is the interface between the user application and the network, and the main task is to provide a method for establishing and using a connection to the presentation layer of two entities. Connecting a presentation layer between different entities is called a session. Therefore, the task of the session layer is to organize and coordinate the communication between the two session processes and manage the data exchange.
The user can set up a session in half-duplex, simplex, and full duplex mode. When a session is established, the user must provide the remote address that they want to connect to. These addresses, unlike Mac (media access control sub-layer) addresses or network layer logical addresses, are designed for users and are more user-friendly to remember. A domain name (DN) is a remote address used on a network for example: Www.3721.com is a domain name. The specific functions of the session layer are as follows:
Session Management: Allows users to establish, maintain, and terminate sessions between two physical devices, and to support data exchange between them. For example, you can provide single-direction sessions or two-way simultaneous sessions, and manage the order of sending in a session, and the length of time that the session takes.
Session Flow control: Provides session traffic control and cross-session functionality.
Addressing: Establishing a session connection using a remote address. L
Error control: The conversational layer is logically responsible for the establishment, maintenance, and termination of data exchange, but the actual work is to receive data from the transport layer and be responsible for correcting errors. Both session control and remote procedure calls belong to this layer of functionality. It should be noted, however, that this layer checks for errors that are not errors in the communication media, but rather advanced errors such as disk space, printer paper, and so on.
Presentation Layer
The presentation layer (Presentation layer) is the sixth layer of the OSI model, which interprets commands and data from the application layer, assigns meanings to the various grammars, and transmits them to the session layer in a certain format. Its main function is "handling the representation of user information, such as encoding, data format conversion and encryption and decryption". The specific functions of the presentation layer are as follows:
Data format processing: Negotiate and establish the format of data interchange to resolve differences in data format representations between applications.
Encoding of data: handles conversion of character sets and numbers. For example, because data types in user programs (integer or real, signed or unsigned, etc.), user identities, and so on can be represented differently, there is a need to have the ability to convert between different character sets or formats between devices.
Compression and decompression: In order to reduce the amount of data transferred, this layer is also responsible for data compression and recovery.
Data encryption and decryption: can improve the security of the network.
Application Layer
The application layer (application layer) is the highest layer of the OSI Reference Model, which is the interface between the computer user and the various applications and networks, with the function of providing services directly to the user and accomplishing the various tasks that the user wishes to accomplish on the network. Based on the other 6-tier work, it is responsible for completing the connection between the application and the network operating system in the network, establishing the connection with the end user, and completing various protocols such as the Network Service and the supervision, management and service required by the network users. In addition, the layer is responsible for coordinating the work between the various applications.
The services and protocols that the application layer provides to users are: File services, directory services, File transfer Service (FTP), Remote Login service (telnet), e-mail Service (email), Print service, security Service, network Management Service, database service, and so on. The various network services mentioned above are completed by different application protocols and programs of this layer, and the differences between different network operating systems in the functions, interfaces, implementation technologies, hardware support, security reliability and various application interfaces are very large. The main functions of the application layer are as follows:
User interface: The application layer is a direct interface between the user and the network, and the application and the network, allowing the user to interact with the network interactively.
Implement a variety of services: the layer has a variety of applications that can complete and implement the various services requested by the user.
Summary of OSI7 layer model
Since OSI is an ideal model, the general network system involves only a few layers, and few systems can have all 7 layers and fully comply with its provisions.
In a 7-tier model, each layer provides a special network function. From the point of view of the network function: The following 4 layers (physical layer, Data link layer, network layer and Transport layer) mainly provide data transmission and exchange functions, namely node-to-node communication, the 4th layer as the upper and lower part of the bridge is the most critical part of the network architecture, and the upper 3 layer (Session layer, The presentation layer and the application layer) provide the information and data processing functions between the user and the application. In short, the next 4 layers mainly complete the function of the communication subnet, the upper 3 layer mainly completes the function of the resource subnet.
The following is a TCP/IP layered model
┌────------────┐┌─┬─┬─-┬─┬─-┬─┬─-┬─┬─-┬─┬─-┐
│││d│f│w│f│h│g│t│i│s│u││
│││n│i│h│t│t│o│e│r│m│s│ its │
│ fourth floor, application layer ││s│n│o│p│t│p│l│c│t│e││
││││g│i││p│h│n││p│n││
││││e│s│││e│e│││e│ It │
││││r││││r│t│││t││
└───────------─┘└─┴─┴─-┴─┴─-┴─┴─-┴─┴─-┴─┴-─┘
┌───────-----─┐┌─────────-------┬──--------─────────┐
│ third layer, transport layer ││tcp│udp│
└───────-----─┘└────────-------─┴──────────--------─┘
┌───────-----─┐┌───----──┬───---─┬────────-------──┐
││││icmp││
│ Layer Two, ││└──---──┘│
│││ip│
└────────-----┘└────────────────────-------------─-┘
┌────────-----┐┌─────────-------┬──────--------─────┐
│ The first layer, network interface ││arp/rarp│ other │
└────────------┘└─────────------┴─────--------──────┘
TCP/IP four-layer Reference Model
The TCP/IP protocol is organized into four conceptual layers, with three layers corresponding to the corresponding layers in the ISO reference model. The ICP/IP protocol family does not contain the physical layer and the data link layer, so it cannot complete the function of the whole computer network system independently, and must work in conjunction with many other protocols.
The four protocol tiers of the TCP/IP tiered model perform the following functions, respectively:
First layer: Network interface layer
Includes protocols for collaborating on the transfer of IP data over existing network media. In fact, the TCP/IP standard does not define the functions corresponding to the ISO data link layer and the physical layer. Instead, it defines protocols such as Address Resolution Protocol (Resolution Protocol,arp), which provides the interface between the data structure of the TCP/IP protocol and the actual physical hardware.
Second floor: The Inter-network layer
The network layer corresponding to the OSI seven-layer reference model. This layer contains IP protocol, RIP protocol (Routing information Protocol, routing Information Protocol), which is responsible for the packing, addressing and routing of data. It also includes the inter-Network Control Message Protocol (Internet Command message PROTOCOL,ICMP) to provide network diagnostic information.
Layer Three: Transport layer
The transport layer, which corresponds to the OSI seven-layer reference model, provides two end-to-end communication services. Where the TCP protocol (transmission Control Protocol) provides reliable data flow transport services, the UDP protocol (use Datagram Protocol) provides unreliable user datagram services.
Layer Fourth: Application layer
The application layer and the expression layer corresponding to the OSI seven-layer reference model. The Internet Application layer protocol includes finger, Whois, FTP (File Transfer Protocol), Gopher, HTTP (Hypertext Transfer Protocol), Telent (Remote terminal Protocol), SMTP (Simple Mail Transfer Protocol), IRC (Internet Relay session), NNTP (Network News Transfer Protocol) and so on, this is also the focus of this book will be discussed.
OSI seven-layer model