Calculation _ipv6 of IP address number

Source: Internet
Author: User
Tags ip number reserved
An IP address, but too much knowledge is associated with it

Binary and 8 bits

The number shown in the computer is 10, each key of the keyboard is encoded by a 8-bit binary, so 1 bytes equals 8 bits. For numbers, the binary of 1 is 00000001, 255 is 11111111, and the 256 binary is 9 bits. So from the 8-bit concept, 255 is the maximum value. But don't forget the number 0, from the 0~255, the total is 256, 2 of 8 times is 256. This is binary with 8 bits. IPv4 's rule is 4 sets of 8-bit values, then 4 2 of the sum of 8 times, that is 2 32 times side, this is the number of IPv4.

IPv4 IP number representation and calculation method, for example


192.168.1.1/24, this is how many IP, the calculation method is 32-24 = 8, then 2 of 8 times = 256, is 256 IP address, equivalent to a C segment address

192.168.1.1/32 32-32=0, 2 of 0 times is 1, represents an IP address

192.168.1.1/16 32-16 = 16, 2 16-Time IP address


For IPv6, the total is 128 digits,

FE80::216:3CFF:FED6:F41E/64 says 2 of the 64-time party




Data source https://www.zhihu.com/question/27050740/answer/57646373

IPV4 IPV4 consists of 4 sets of 8-bit binary numbers
For example: 1.1.1.1 conversion to binary is 00000001.00000001.00000001.00000001
The binary is full binary one, so each one has only two numbers 0 and 1, then 32-bit binary has 2 of 32 times a different combination.
So theoretically IPV4 has a total of 2 of the 32-time IP address, that is, 2^32=4294967296.
IPV4 some special IP addresses
-127.x.x.x to the local network address.
-224.X.X.X is a multicast address segment.
-255.255.255.255 is a generic broadcast address.
-10.x.x.x,172.16.x.x to 172.31.x.x and 192.168.x.x for local network use.
The actual IPV4 address is very small, and is far from enough to use.
When I said IPV4, I had to mention IPV6.
IPv4, there's 2^32=4294967296,ipv6 2^128=3.4028236692094*1038.
Far beyond the human count, and without exaggeration, IPV6 can assign an IP address to every grain of sand on earth.
About IP Address There is a lot of knowledge, the title of interest can look at the encyclopedia.
To do an ad, I am ready to do an IT technical question and answer community, welcome friends interested to visit, we can communicate together, the site is also in the functional improvement stage, address Itwen
Add up, have time to thank an article, the original address about IPV4 and IPV6 those things
IPV4 is InternetProtocolversion4 's abbreviation, the fourth version of the Internet Protocol, the next version to be applied is IPV6, V4 and V6 have v1,v2,v3,v5, perhaps for some reason they have not been able to get out of the lab.
IPV4 is the core protocol of TCP/IP protocol family, which runs on the network layer of TCP/IP seven-layer protocol. The current protocol used by the global Internet is TCP/IP (except for individual laboratories).
IPV4 's address length is 32 bits (that is, 4 bytes), and the computer uses binary, so IPV4 is a 32-bit binary number, For example, one of the simplest IPV4 address 00000001.00000001.00000001.00000001, binary number is too long, not easy to remember so we used to write in decimal, the top of the string of 0 and 1 of the IP address of the conversion to decimal is 1.1.1.1, or the decimal look comfortable. As for how to convert everyone can Baidu for the binary and decimal conversion knowledge.
IPV4 can be divided into A,b,c,d,e5 class addresses
The reason for the classification is to better manage and apply the IPV4 address, a IPV4 is divided into network bits and host bits. For example 192.168.1.1/24, this IP address is followed by A/24, indicating that the first 24 bits are network bits, and the last 8 bits are the host bits (remember the binary and decimal conversions we mentioned above). )。
The IPV4 classification method is to use different lengths of network bits.
1. Class A IP address
A Class A IP address consists of 1-byte network address and 3-byte host address, the highest bit of network address must be "0", Address range 1.0.0.1-126.255.255.254 (binary representation is: 00000001000000000000000000000001-01111110111111111111111111111110). There are 126 available Class A networks, each of which can hold 1,677,214 hosts (1677214 is the host bit binary conversion).
2. Class B IP Address
A class B IP address consists of 2 bytes of network address and 2 bytes of host address, the highest bit of network address must be "10", Address range 128.1.0.1-191.255.255.254 (binary representation is: 10000000000000010000000000000001-10111111111111111111111111111110). There are 16,384 B-type networks available, each of which can hold 65534 hosts.
3. Class C IP Address
A Class C IP address consists of a 3-byte network address and a 1-byte host address, and the highest bit of the network address must be "110". Range 192.0.1.1-223.255.255.254 (binary representation is: 11000000000000000000000100000001-11011111111111111111111011111110). The Class C network can be up to 2,097,152, and each network can hold 254 hosts.
4. Class D addresses are used for multicast (multicast).
Class D IP Address the first byte begins with "1110", which is a specially reserved address. It does not point to a particular network, which is currently used in multicast (multicast). Multicast addresses are used to address a group of computers at once, identifying a group of computers that share the same protocol.
Address range 224.0.0.1-239.255.255.254
5. Class E IP Address
Starting with "1111", Keep for future use.
Class E address reservation, only for experimental and development purposes.
All 0 ("0"). 0. 0. 0 ") address refers to any network. Full "1" IP address ("255"). 255. 255. 255 ") is the broadcast address of the current subnet.
IPV4 How many IP addresses are there altogether? We've described the IPV4 as a 32-bit binary system, this means that there are 32 IPV4, each can have 2 different numbers 0 and 1, so IPV4 theoretically a total of 2 32 times the address, probably 4294967296 so much, at first glance there are quite a lot of it, it is not , and some reserved IP addresses are not used on the public web.
For example:
-127.x.x.x to local network address
-224.x.x.x for multicast address segments
-255.255.255.255 is a generic broadcast address
-10.x.x.x,172.16.x.x to 172.31.x.x and 192.168.x.x for local network use
So, remove the reserved IP address, the actual available IP address is even less. The actual number of addresses is not much, coupled with the uneven distribution of IPV4 we can use less IPV4, because the IP address is produced in the United States, so the United States has a majority of the world's Class A address, to know that a class of network has 126, each network can accommodate 1,677,214 hosts, There are also some big American companies, such as Microsoft, Dell,,,,, and they don't remember, they have a company a lot of a type of address, specifically how much memory is not clear. The number of IPV4 addresses in the United States is about 40 times times that of China.
Although the application of NAT,PAT technology can temporarily alleviate some of the problems caused by IPV4 address, but the era of the Internet of Things has come, IPV4 has nearly dried up, after our bicycles, watches, televisions need IP address, so IPV6 is a logical launch.
IPV6 relative IPV4 The biggest change is that the number of addresses, more than the number of addresses, address a number of important things say three times. IPV6 is composed of 128-bit binary, which means that IPV6 has 2^128=340282366920940000000000000000000000000 address altogether (I don't know if I can miss 0.) Guess how big this number is, and you can assign an IP address to every grain of sand on the planet.
But like IPV4, IPv6 can cause a lot of waste of IP addresses. To be exact, a IPV6 network does not have a 2^128 address to use. First, to achieve automatic IP address configuration, the subnet used by the LAN prefix must be equal to 64, but very few LAN can accommodate 2^64 network terminals, secondly, because IPV6 address assignment must follow the principle of clustering, address waste is unavoidable.
The following from Baidu Encyclopedia copy (for reference) some IPV6 characteristics
(1) The IPV6 address length is 128 bits, and the address space adds 2^128-2^32.
(2) Flexible IP message header format. Replaces the variable-length option field in IPV4 with a series of fixed-format extension headers. IPV6 selection of the appearance of the way also changed, so that routers can simply pass the option without any processing, speed up the message processing speed;
(3) IPV6 simplifies the message header format, the field only 8, speeds up the message forwarding, enhances the throughput;
(4) Improve security. Identity authentication and privacy are the key characteristics of IPV6;
(5) Support more types of service;
(6) Allow the agreement to continue to evolve, to add new functions to adapt to the future development of technology;
Well, first introduced to this, due to limited capacity in some places may not be accurate, about the IP address of the knowledge there are many many, write a few books are not much, we are interested in Google or Baidu, we welcome reprint remember to stay.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.