1 layer, 2 layers, 3 layers? [World: TCP / IP base lecture]
Author: code_tin
Below is my previous post in [Technology China] original post is something shallow. If you have a mistake, please move to move to you.
1: 1 layer, 2 layers, 3 layers? [World in cans: TCP / IP base lecture]
This article is mainly reader for self-study TCP / IP. Because there are many books on the market, although there are very many books, individuals think that there is no one can be deeply shalled. They are all in some authoritative books, making Many readers are still there without specific concepts after reading. I hope that I have written something to have a specific concept, not only to stay in the concept of official, rigorous, and esoteric. Because I have limited level, if you are in article The error was found, please contact me immediately. I will modify it as soon as possible.
TCP / IP base lecture - 1: 1 layer, 2 layers, 3 layers?
After reading the courses of the network, I know the ISO-OSI 7 layer protocol, and many books will draw the picture, then labeled the physical layer, data link layer, network layer, etc. The back is to die. But I don't know if the specific these levels do? Is actually in the Internet, because the TCP / IP model is actually used, that is, the DOD model (now I don't know if it doesn't matter, it will be said). So the 7-layer model is in reality The network environment is just a theoretical thing. In this model, we truly care about the 3rd floor below.
1. Physical layer. Oh. Yes. This noun is still easy to understand. The network card has the network cable constitutes this layer. The binary data stream propagating in the network cable is the specific appearance of this layer. That is, this There is no agreement on the floor (not very accurate, but you can understand this). Some are current. We connect two machines to the network cable. Or use hub to connect the machine, these work is the physical layer. work.
There are 2 devices that belong to the physical layer, one is a repeater, one is hub. You know. The physical cable will generate an electrical signal attenuation. In order to reinforce this signal, we need to be a certain distance. After the addition of a signal amplifier, this is the repeater (Repeater)
Well ... This is easier to understand. REPEATER is connected between 2 network cables. So just a physical device. It belongs to 1 layer. So how come the hub (hub)? How can this be 1? Layer ??? It seems very difficult to understand. When I said Hub's nature, everyone can clearly understand.
The essence of HUB is actually just a multi port repeater. Ah ... so everyone can understand .Hub is not called multi-mouth repeater actually just to sell the above strategy. His essence is connected to multiple network cables A physical device. It is also not to do any logic.
2. Data link layer Ou ~ This noun has some other twisted. Data Link layer. English seems to be more easily understood.
The things above this level are no longer an electric signal. But Data. Yes, since Data has logical relationship. The basic unit above this level is frame (Frame). This layer and physical layer contact is the most Tight. He is a combination of 0 and 1 by converting the current transmitted from the network cable.
The physical layer is only sent to the network cable or accepted various levels of level signals, that is, the physical layer is unable to discriminate the source and target of the current. So after the current is made of 0 and 1, there is logic data. The data can be discriminated from which the data can be discriminated, and it will be true. So you can really form a link. Since you can discriminate the address, then what is the address of the most important concept: One of the most important concepts: Mac addresses that everyone must have heard that our NIC has a MAC address. Some people may also know that the MAC address is unique. The MAC address is the only thing. That is to say that your network card is cheap. But he is also the world Unique. Some people say that he can change Mac. That is not the only. Yes. Although it can be changed, it is just deceiving the MAC address inside the package. Your NIC is really MAC address. Can't modify.
We have a MAC address. This allows for a targeted computer to communicate with a computer that is connected together. Yes. We can finally communicate in a local network. But there is a problem we have not mentioned before. Just The layer is transmitted is an electric signal. So if I have 2 machines to generate electricity signals, isn't the signal? It is very correct. This problem becomes a "collision" in the network, so the agreement is specified if you need to export data, Do you need to see if there is any other signal in the cable. If not, you can send it. If 2 simultaneously send, then 2 after the collision is waiting for a random time, then retransmit. This is important "collision detection ". Ha. It seems that the problem is solved. Isn't it. Now the entire network can run normally. It is true. But if you connect the computer connected to the network, then the collision will become more frequent. Such efficiency must It is very low. Well. There is also an important concept "conflict domain". All devices on the same physically connected network belong to the same conflict domain. Next, we need to introduce our 2-storey device to split conflict domains. .
Bridge (Bridge) is connected to 2 different physical networks. The main function is to forward Frames between 2 networks. Because we can know from actual. In fact, it is not a common network to communicate with each other. A set of computers can be divided into a small conflict domain. This segmentation can reduce conflict domains, which also reduces the chance of conflicts. And use the bridge to bridge, because the communication between the bridge is not very frequent, So use the bridge to be 2 sides as "spokesperson." This opportunity to conflict in any small network is less.
Switch is our most familiar equipment. The essence of switches is actually a multi port bridge. The same can be obtained. Every mouth of the switch is a conflict domain. We all say that the switch is better Hub is fast, because the switch splits all conflict domains. Since the switch is very cheap now. So we all take a computer directly in the hands of the switches. This allows each computer to be a separate conflict domain. This collision is not The speed is fast than HUB. And said that the 2nd floor is mainly a forward function. The main function of the switch is to forward the package. Instead of letting all conflict domains directly physically connected. So there is CPU, memory, Frame can be processed, and so on. These are also the difference between the switches and HUBs.
3. Network layer We can build a local area network. With the network layer. Data can really transfer throughout the world
Due to Leonard Bosck and Tie Tie. Sandy Lerner In order to solve the communication problem between them (there are many versions of the router invented. Don't say anything else may be more than this. More accurate, but who knows. Ha ha). The router is used to solve the "information island" problem. And if it is built by Switch, the entire network will have "central node", which does not comply with Arpanet The original intention. So we have this floor. (This may feel that this is invert, but first understand it first.)
The basic unit of this layer is a package (Packet). All packs have an IP header. Ammy. It sounds familiar. Is it very familiar? IP is used to identify the source and destination address of the package above this layer. This layer A main concept is "Routing", which is the same as Switch, which is sent to other places. However, there is a different place, Switch only knows where the specific Mac can be sent to the specified computer, while the route If you don't need to know where the computer where the final IP is located, you can work if that way you can work.
These three layers build the basis of the entire network. Since the TCP / IP model combines the bottom 2 layers into a layer, the 2nd floors in TCP / IP are also the most basic content of the entire architecture. And the network to do It is also for these 2 layers.