Network Fundamentals (I)
1. Agreements
An agreement is a convention, a generalization of what is agreed upon between things of the same kind.
For example, the transmission medium between computers is optical and electrical signals, and people communicate with each other using language, this kind of is the protocol, the protocol can be many kinds of
Can two hosts link at will as long as a protocol is agreed upon between them?
There are many manufacturers of computers and many corresponding operating systems
There are also a lot of network hardware devices such as telecom and mobile
So how to let the various different manufacturers to build consensus between it, at this time it is necessary to put forward a common standard, which is thenetwork protocol
2. Introduction to network protocols
2.1 Protocol Layers
Because of the requirements, the protocol is the same level of agreement between the layers, but sometimes between the layers to exist between the upper and lower levels of the invocation relationship, so the concept of layering appeared
For example, if two people want to chat on the phone, then these two people are a layer, and the chat language used between them is a layer of agreement, and the phone is a layer between them, and there must be a common agreement between the phone calls to reach communication as well
Multiple protocols can exist at the same layer, because of the differences
So for each layer there can be multiple protocols between them, with call relationships between the levels, but the lower levels only need to beencapsulateThis is done by exposing the appropriate interfaces for the upper layers to call.Object-oriented thinking.
** Advantages of layering : **
- Layers are independent of each other, with corresponding interfaces between each layer, linking the upper and lower layers
- If any layer changes, only the corresponding interface needs to be changed, and the layers above and below that layer are unaffected
- If the entire system is broken down into a number of relatively independent subsystems, i.e., layered ideas, in the commissioning and maintenance, each layer can be individually debugged, and not because of a layer of the cause of the entire system paralyzed.
Combine modules with more centralized functionality and higher coupling into one layer, and then layer down, this layering utilizes theThe idea of high cohesion and low coupling , decoupling layers from each other
Networks are more complex with more layers between them
2.2 OSI seven-layer model
- The OSI (Open System Interconnection) seven-layer network model, known as the Open System Interconnection Reference Model, is a logical definition and specification.
- The network is logically divided into 7 layers. Each layer has associated, corresponding physical devices, such as routers, switches.
- The OSI seven-layer model is a framework design methodology whose primary function is to help different types of hosts realize data transfer.
- Its biggest advantage is that it clearly distinguishes the concepts of services, interfaces and protocols, which makes the concepts clear and the theory complete. The seven hierarchical structural models enable reliable communication between different systems and different networks.
- However, it is both complex and impractical; so we follow the TCP/IP four-layer model.
OSI seven-layer model
- application layer (computing) :: Application-specific protocols.
For example, the protocol when logging in to a certain mailbox, the protocol when logging in to QQ, and so on.
- presentation layer : Conversion of device-intrinsic and network-standard data formats
Receive information in different forms such as text, sound, images, audio, etc.
-
session layer :: Communications management, responsible for establishing/disconnecting communications links
-
transport layer : Responsible for data transfer between two hosts, providing services for communication, obtaining data packets, etc.
such as Transmission Control Protocol (TCP), which ensures that data is reliably sent from the source host to the destination host.
- network layer : A host sends to the destination host through many nodes, where the nodes on the way are like maps, and the transmitted information may even pass through many communication subnets.The network layer is responsible for address management and route translation, selecting appropriate nodesEnsure successful data transfer
For example, in the IP protocol, through the IP address to identify a host, and through the routing table way to plan out the line of data transmission between two hosts (routing). Router (Router) working in the network layer
- data link layer :: Because the transmission from one host to the destination host is not direct, there must be a medium in between, it is a segmented transmission.This requires the use of specialized protocols for transmission between nodes. The data link layer encapsulates the frames handed over by the network layer, adds its own header and then transmits them between nodes.
Example.
Ethernet
,token ring network
,wireless LAN
Standards such as the data link layer, in addition to the data link layer is also responsible for frame synchronization (such as transmission of the signal is gradually weakened, to give you to strengthen the signal), detection of errors, etc.
-
physical layer : The role of the lowest layer, the physical layer, is to enable the transparent transmission of bit streams between computer nodes
The main task of this layer is to determine some characteristics of the interface with the transmission media (mechanical, electrical, functional, process characteristics)
This layer is primarily hardware related and has little to do with software
For example, now Ethernet with the network cable (twisted pair), optical fiber, cable television electromagnetic wave signals, etc. are part of the physical layer, the physical layer to achieve the nodes between the bit stream transmission
included among these
The data link layer and the physical layer can be treated as a whole i.e..Device Drivers and Network Interfaces
The network and transport layers can be treated as one layer, and this part is made up of theoperating system
The other three layers can be treated asApplications section
This whole is like an operating system, so the network contains the operating system and the operating system contains the network
2.3 The TCP/IP Layer 4 (Layer 5) Model
Because the top three floorsapplication layer (computing)
,presentation layer
,session layer
are usually together, it is common to combine these three layers into one, collectively known as theapplication layer (computing)
And the physical layer is the hardware side that handles the transmitted signals, sometimes called thefour-ply
Four floors, that is.
- application layer (computing)
- transport layer
- network layer
- data link layer
3. Basic flow of network transmission
Recognition of protocol headers
- Each layer has to have at least one protocol, and the representative implementation of each protocol is the header
- Protocols are usually expressed in headers
- Each piece of data has to have a corresponding header at each protocol layer
The header can be understood as the seller's shipment, between the various courier stations through the courier single to transmit the logo, where the courier single is the header, courier station and courier between the layer of
How LANs work (a primer)
- Two hosts on the same LAN can communicate directly
- Each host has its own "name", each host has its own NIC, each NIC has aMAC address, this address is unique within the LAN, just like an ID card.
As shown in the above figure, assuming there are 8 hosts in the LAN, where the host with MAC address MAC1 is the message initiator, and assuming that a message is to be sent to MAC5, it works as follows.
- The initiator, MAC1, sends the same message to everyone in the network, and everyone receives it, and then discards the message if he is not MAC5, so only MAC5 receives the message.
Only one host at a time on a LAN is allowed to send messages at any given time
Assuming that two hosts are sending a message, then a message collision will be sent : Collision Field
So, from the system's point of view, the resources in the network are all visible ----> shared resources ----> but only one host at a time in the LAN can send messages -----> corresponding to the mutual exclusion ----> so the network is also a critical resource
3.1 Network Transmission Process
Process : The user sends a "huh" message, which is encapsulated at the application layer, then sent to the transport layer, which is encapsulated at the transport layer, then encapsulated at the network layer, then encapsulated at the data link layer, and transmitted through the data link layer, where each layer encapsulates something that ismasthead (of a newspaper etc)The encapsulated content is calledpayloadThe data link layer at the destination accepts the message, then separates the header and the payload for unpacking, and then sends it to the upper layer in a directional manner, and then in a sequential process, the destination host will be able to receive the sent message
The process of separating the header from the payload is called unpacking.
The process of delivering the payload directed upwards is called diversion.
File transfer between hosts across network segments
Data passes through one or more routers in transit from one computer to another
Different protocol layers have different names for packets, in the transport layer called segment (segment), in the network layer called datagram (datagram), in the link layer called frame (frame)
4. Address management in networks
IP address
There are two versions of the IP protocol, one is IPv4, the other is IPv6, IPv6 is not as widely spread, IPv4 is still the majority of the scenarios used nowadays.
The following are all elaborated on IPv4
- An IP address is the address used in the IP protocol to label the different hosts in a network
- IPv4 is a 4-byte, 32-bit integer
- IPv4 uses thedotted decimal systemwhere each number ranges from 0-255, eg: 120.80.65.00
MAC address
MAC addresses are like out-of-sequence, but function more than just traceability; MAC addresses are used to identify connected nodes in the link layer
- The length is 6 bytes, 48 bits, and is typically used with thebold hexadecimalRepresentation eg : 08:00:27:03:fb:19
- The MAC address is determined when the NIC is shipped from the factory and cannot be changed, it is globally unique (except for virtual machines)