当前位置:网站首页>IP address

IP address

2022-07-07 07:06:00 Aegean child

Point to point communication between computers

Under normal circumstances , You and I both have a computer , But what a computer can do is limited , We may be between two computers in order to do more things , We need data interaction , We can go through U Disk as medium , Data exchange , But this efficiency is too slow , therefore , In order to improve efficiency , Someone came up with a good idea , We plug a data cable between the two computers , Data interaction through data lines

With this data cable , Or network cable , The two computers can interact with each other , however , What if there are more than two computers ? With multiple computers , It's time to pull the cable again ?

You found out , If every machine wants to communicate with other machines , Then you have to establish a connection with that machine , With more and more machines , How complicated the number of network cables will be , This is definitely unacceptable .

Switch

In order to solve the complexity of point-to-point communication between computers , The concept of switch we introduced

With the switch , The switch distributes the data from each machine . At this time, there are new problems , On point-to-point data connections , If two computers want to interact with each other , Just find the data line of the corresponding host from many data lines , But now it's all sent to the switch . How should the switch distribute data ? It's like a package that should not have a clear address , Switches are like express companies , You gave it to the express company , No address , Then the express company doesn't know who to send the package to . As long as the express company has the express address, it knows where to send the package , The same goes for switches , We can assign one to each machine IP Address .

With IP After the address , Just add the corresponding host to the sent packet IP Address , Then the switch can be based on the IP The address sends the data to the corresponding machine .

LAN to WAN

Through the switch , We can let the computer connected to the switch exchange data , If these machines are your school computers , Your school wants to cooperate with the school next door , We need each other's computers to exchange data , It happens that the computer next door also uses the switch for data exchange , So we just connect the switches of the two schools , Then the computers on both sides can access each other .

By connecting two switches , So that computers on both sides can exchange data , If you want to add more LAN later , That's connecting each other's switches

With more and more switches in LAN , Switches are also as complex as point-to-point connections between computers before , So a new switch is put between the switches .

this is it , More and more switches , Know that it covers the whole world , You just need to enter any of these nodes , You can access any design in the world that is also connected to the network , This constitutes the wan .

You can understand it as : Wan is the combination of countless LANs . Obviously , Building these networks must require a lot of money , The companies that build these networks are called ISP Internet service provider , The familiar mobile , Telecom and China Unicom are ISP supplier .

IPV4

Every machine on the Internet needs one IP Address to access each other , Then first we have to talk IP The composition of the address .IP The address is generally IPV4 Of IP Address , It is from 32 A composition , that IP The combination of addresses that can be used is 2 Of 32 Power , Greater than or equal to 42.28 Billion .

To facilitate memory and input , Will each 8 A binary is divided into a group , common 4 Group , In the transformation of 10 Base number

meanwhile , Will also be right IP Address classification , Some addresses for special purposes

The last really available address may not yet 42 One hundred million . It is known that there are 70 More than 100 million people , Even if not everyone will access the Internet , But many people don't have more than one device , One person may have multiple mobile phones , Computer, etc. , If you want to assign one to each device IP, What about this 36 Billions of IP Is the address enough ? It's not enough .

NAT Network address translation

In order to solve IP We used a new technology ,NAT Network address translation . Suppose there are five computers , their IP The address is 192.168.0.1----192.168.0.5, They connected to the same switch , Or router , The wide area network of the switch they are connected to IP yes 6.6.6.6

If these five machines are going to one 8.8.8.8 Send data to your server , that NAT Will take the original of these computers IP convert to 6.6.6.6 Of ip towards 8.8.8.8 send data , Realization 5 One for each device IP The effect of . If 8.8.8.8 Many devices are also mounted under the switch , The five servers are based on 8.8.8.8 Sent by this machine , How do you send it to 8.8.8.8 What about the specific equipment attached below ?

Port mapping

To solve the above problems , We introduced a new concept , Port mapping . We can do it in IP Add a port after the address , Pictured

such as 192.168.0.1 and 6.6.6.6 Of 1000 Port binding , The other side 192.168.0.1 and 8.8.8.8 Of 500 Port binding , such , If 6.6.6.6 The next mounted machine wants to access 8.8.8.8 Remove the mounted machine , Just add the corresponding port .

Public network IP And private IP

If you open cmd, Input ipconfig see IP Address

You'll see ip The address is 192.168 At the beginning , Why? , Just mentioned ,ip The address is not enough , But in order for most machines to access the Internet , We usually share a public network with multiple machines ip, You go to Baidu search ip Inquire about .

You can see the public network attached to your current device ip 了 . Now I know why many ip All are 192.168 It's the beginning ? Because it is attached to a small transfer device C Class private ip, This private class IP The public network that depends on the converter IP surf the internet .

Give me an example , Public network IP Is the name of your community , The private network IP It's the floor unit where you live , Assuming that the names of communities across the country are not repeated , According to the name of the community , You can find your approximate location , This is equivalent to according to the public network IP Locate your specific lan , But to know where you are , You also need to know the number of the unit in the community , The number of several units in the community is equivalent to the private network IP, So the private network of many machines IP It's all repetitive .

原网站

版权声明
本文为[Aegean child]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070215346959.html