In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > IT Information >
Share
Shulou(Shulou.com)11/24 Report--
Yes, it's still my rookie, some technical blogger, an old emotional blogger.
Let's tell a story.
The veteran licking dog Xiao Zhang was very excited today and wanted to treat everyone to milk tea whatever he said.
Because he said he felt that he was going to have a positive result with Xiao Lu, the girl he liked.
Ask why.
His ears are red, said, "I think Xiao Lu is implying me, she said she likes to watch Avatar, I happen to look like Avatar."
It makes people frown.
He continued, "she says she likes Sagittarius, and I happen to be."
I scratched my head and said, "OK, stop talking. I get it." she lives in Shanghai, and you live in Shanghai, so you two live together. "
He was stupefied for a moment and looked at me: "Don't say this kind of dog licking talk, but what you said actually has a point. Last time she asked me to fix her computer, I found that her ip was 192.168.xx.xx. Coincidentally, mine, too, I suspect we live very close."
I'm touched.
I didn't even dare to tell him that my family's IP also started with 192.168, and I guess yours is, too, as you are reading this article right now.
But the question is, why is everyone's IP 192.168.xx.xx?
Let's talk about this topic today.
What is the IP address? we know that the essence of network communication is to send and receive data packets. If we say that sending and receiving data packets is the same as sending and receiving express delivery. The IP address is similar to the receiving address and sending address on the express delivery. With it, the router can begin to act as a courier, finding out who should receive the packet in this complicated network world.
Sending and receiving data is like sending and receiving express delivery. as our mainstream address is still IPV4, we take IPV4 as an example by default.
This IP looks something like this.
The IPv4 address can be seen by executing ifconfig in the console. 192.168.31.170 next to inet is the IP address.
$ifconfig en0: flags=8863 mtu 1500 options=400 ether 88:36:3d:33:a0:15 inet6 fe70::1009:aabf:ecc6:2d10%en0 prefixlen 64 secured scopeid 0x6 inet 192.168.31.170 netmask 0xffffff00 broadcast 192.168.31.255 nd6 options=201 media: autoselect status: active to put it bluntly, it is a special point number that is used to uniquely locate a computer on the Internet.
To represent this number, the IP address is divided into 4 bytes, a byte of 8 bits, a total of 32 bits, which can be used to represent up to 2 ^ 32, that is, 4.2 billion addresses.
It seems that. A little less?
There will be 7.8 billion in the world in 2021, and it will break through 8 billion this year, that is to say, less than one IP per capita.
The current global population many years ago, it was said that IPV4 addresses were not enough and would be exhausted, so there would be later IPV6 addresses.
IPv6 uses more bytes, so it can represent more addresses. It looks like this.
IPv6 address is not very strange, I don't feel like I've seen it very much.
That's right.
Have you noticed that after so many years, most people are still using IPV4 addresses, don't they say they are running out?
Why do people keep using IPV4?
Don't worry, let's talk about the pre-knowledge points, the classification of IP addresses.
The classification of IP addresses is to better manage the purpose of these 4.2 billion IP addresses. We should also have seen such a picture of IP classification in textbooks.
The classification of IP addresses roughly means that the 32-bit address begins with zero, which is a Class An address. What starts with 10 is class B, and what starts with 110 is class C. After that, split the remaining bytes into two segments, one for the network number and the other for the host number.
The relationship between the network number and the host number is like the relationship between a parking lot number and a parking lot number. There are many parking lots in a city, and there are many parking spaces in the parking lot. One car can be parked in each parking space. a car here is actually a computer (mainframe).
There are few large parking lots, but there are a lot of cars that can be parked, and there are fewer network numbers corresponding to Class An addresses, but more host numbers.
Small parking lots are everywhere, but generally there are few cars that can be parked, and there are more network numbers corresponding to class C addresses, but fewer host numbers.
At the beginning, the bosses divided the network in this way, in fact, it is also for the convenience of management. For example, Class An addresses are for large organizations. The number of host addresses is as high as 1600wpm. Class C addresses are for small companies, and the host number is only 200 +.
This gap is a bit wide, but it is not very reasonable today. I may open an Internet bar with more than 200 machines, right? there are too few host numbers in Class C and too many host numbers in Class A. Therefore, this classification mechanism is seldom used now.
Instead, the so-called ABC classification is cancelled directly, leaving only the network number and host number, and the number of bits of the network number is not as dead as before, using a slash to tell the user how many bits are the network number, and the rest are the host number. For example, 172.20.61.69max 20, the number of digits of the network number is 20 digits, and the number of digits of the host number is 32-20cm 12 digits, which can hold 4096 machines, which is very flexible and sufficient.
1668126898773 this is called CIDR (Classless Inter-Domain Routing, classless inter-domain routing).
Is there not enough IP address? But no matter how you classify it, under the 32-bit limit, even if you spend more time, as long as you add Class A + Class B + Class C + Class X, the maximum number of IP is still 4.2 billion. It's still not enough.
Well, since addition doesn't work, let's use multiplication.
What do you mean?
The number of 4.2 billion is too big for everyone. To make it easier to understand, we changed it to 6 IP.
Suppose you split 6 into 4 times 2 and multiply 4 by 2, then the result 8 must be greater than 6.
At the beginning, we understand that the online world has only one layer, each person has an IP, then only six people can access the Internet.
Together, it only allows six people to access the Internet. Now we divide the network into two layers. Like down there.
Multiplication allows eight people to surf the Internet and every two people form a "small network", sharing an IP externally, while everyone inside has a different IP, and four small networks together form a "big network". For example, Xiao Ming's computer is No. 6 under the No. 1 network, and Xiao Hong's computer is No. 6 under the No. 2 network. This can also achieve the effect of uniquely identifying a machine.
Like the above, each two-person small network is called the local area network, that is, the so-called intranet, and the IP (the above 5Power6) is also called the private IP or the intranet IP, while the "big network" mentioned above is the wide area network, and the IP used is called the public IP or the public network IP.
In this way, only six people were allowed to go online, but now eight people can go online at the same time. This is still the case that there are only 6 IP, if you change the number back to 4.2 billion, you will be able to support computers much larger than 4.2 billion to surf the Internet.
The concept of public and private IP follows this line of thinking, going back to the ABC class IP address above, and the bosses have divided them into private and public parts.
The range of private addresses is defined in the rfc1918 document. They will not appear in the WAN, only in the local area network.
* Category An address: 10.0.0.0Muray 10.255.255.255 * Category B address: 172.16.0.0Muray 172.31.255.255 * Category C address: 192.168.0.0Murray 192.168.255.255 at this time, look at the private address range in Category C. do you look familiar?
192.168.xx.xx is one of the IP addresses in this network segment. There are about 6w + host numbers in this range. What family conditions can be used up?
As a result, it becomes a street or a community, or several buildings in the community share a public network IP, while the interior uses an intranet IP like 192.168.xx.xx. So as long as you are at home, there is a good chance that your IP address is a class C 192.168.xx.xx.
Several buildings share a public network IP, but in fact, class An and B private addresses can also be used in the LAN as long as you want.
When you go to the company and execute the ifconfig command, you are likely to find that your LAN IP does not start at 192.168, but at 172 or 10.
This is because in the company intranet, the number of IP required will be larger, and the IP at the beginning of 172 and 10 can represent more hosts, for example, those at the beginning of 10 can represent 1600w +.
If nothing else, the Class An address only takes a network number starting with 10 as the intranet IP to represent 1600w + host numbers, and the remaining 100 + Class A network numbers are used as public network addresses. Multiply according to the algorithm mentioned above, public network IP number * private network IP number = (100 + * 1600w) * 1600w, never mind whether my calculation is correct or not, it can be provided for a lot of devices, not to mention category B and C not yet.
And only one layer of local area network is considered above, in fact, the local area network can be further divided into multiple layers, and the local area network is then nested within the local area network. As shown below, more IP can be used this way.
There is also a local area network in the local area network, so although there are not many IP addresses, they are actually enough, which is why we have been slow to switch to IPv6. Enough to run, why change?
At this point, I actually answered the question of the title of the article. Why does everyone's IP start at 192.168 because the IPv4 address is limited? in order to make effective use of these limited addresses, we can divide the network into local area network and wide area network, and divide IP into private IP and public network IP. Many machines in a local area network can share a wide area network IP, thus achieving the effect of "multiplication". Greatly increased the "number of available IP", several buildings in the community can share a public network IP, and because of the small number of devices, generally choose class C private address, that is, the address at the beginning of 192.168.
But the question is, how do I know what my public network IP address is?
Query your public network IP address on your home computer. Through ifconfig, you can get your own intranet IP address, for example, mine is 192.168.31.170.
$ifconfig en0: flags=8863 mtu 1500 options=400 ether 88:36:3d:33:a0:15 inet6 fe70::1009:aabf:ecc6:2d10%en0 prefixlen 64 secured scopeid 0x6 inet 192.168.31.170 netmask 0xffffff00 broadcast 192.168.31.255 nd6 options=201 media: autoselect status: active but what should you do if you want to know your public network IP address?
There's an easy way. You can directly search for "my IP address" on baidu and you will see your public network IP address.
Don't go to the ping address, this picture has been passed by me.
If you are using a Liyun machine. You will also find that your machine has both a private IP address and a public IP address.
Cloud can assign both public and private IP.
It is also a graph of p.
When you go to the private address 172.21.56.59 on ping, you will find that it does not ping at all.
$ping 172.21.56.59 PING 172.21.56.59 (172.21.56.59): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 ^ C-172.21.56.59 ping statistics-4 packets transmitted, 0 packets received, 100.0% packet loss while the public network address 46.101.121.11 can be ping. In other words, in your local area network, you can only access this cloud server through the public network IP address.
$ping 46.101.121.11 PING 46.101.121.11 (46.101.121.11): 56 data bytes 64 bytes from 46.101.121.11: icmp_seq=0 ttl=48 time=273.481 ms 64 bytes from 46.101.121.11: icmp_seq=1 ttl=48 time=268.018 ms 64 bytes from 46.101.121.11: icmp_seq=2 ttl=48 time=266.606 ms ^ C-46.101.121.11 ping statistics-- 3 packets transmitted, 3 packets received, 0.0% packet loss People who have used their home server may have a question.
As long as you apply for a cloud service, Liyun can give you a public network IP address. How do you do that?
Here. So rich?
In fact, a number of IP addresses leased by an organization in charge of IP can be leased to you for a fee when you need them, and can be recycled and assigned to others if you don't need them.
In addition, under the public network IP address, you can also hang multiple CVMs, so that multiple CVMs can share the same IP in the way mentioned above.
So there is little need to worry about IP exhaustion.
A summary IP address, like a delivery and pickup address, is a string of numbers used to identify your location in the complex online world.
IPv4 has 32 bits and can represent up to 4.2 billion IP addresses. In order to better manage them, there has been a classification like ABC in textbooks, and it is divided into private and public addresses in the ABC class. But at present, it is popular to use CIDR to classify.
In order to represent more hosts, we can divide the network into a wide area network and a local area network, with public addresses for the wide area network and private addresses for the local area network. Multiplying the public address by the private address represents a machine much larger than 4.2 billion.
The home network is relatively small, often several buildings in the community form a local area network, and these buildings share a public IP address. The private address of class C, which is ip at the beginning of 192.168.xx, is chosen in the local area network, so you will find that the IP in our home basically starts with 192.168.
Search for "my IP address" on baidu and you will see your public network IP address.
Almost. Let's leave a question for everyone.
As mentioned above, the network is divided into wide area network and local area network, and IP is divided into public and private. All computers in a local area network use a public IP externally and a private IP internally.
Then the problem arises: private IP is not used in the public network. If a private IP in a local area network wants to access the public IP outside the local area network, it must make an IP conversion. Where is this conversion done?
Where is the conversion between private IP and public IP finally when I was writing an article, I came across a small colored egg.
When I open the browser console with F12 in the web page searched by baidu.
I saw the following paragraph. Found that it is a recruitment promotion, think about it, will open a console to see basically people who are close to programmers, this wave is accurate drainage.
The recruitment slogan is really well written.
After reading my emo, when I graduated, I thought that one day I could change the world by writing code.
Many years later, I found that it was great to be able to change myself.
This article comes from the official account of Wechat: rookie debug (ID:xiaobaidebug), author: Xiaobai
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: 260
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.