A detailed explanation of IP addresses: meaning, function, format, classification, etc.

1. What is the IP address?

The IP address is a unique address of the Internet protocol. It is a unified address format provided by the IP protocol. It assigns a logical address to each network and each host on the Internet to shield the difference in physical addresses.

2. So, why do we use IP addresses?

In a single LAN segment, computers can use the MAC address provided by the network access layer to communicate with each other. If in a routed network, the communication between computers cannot use the MAC address to achieve data transmission: because the MAC address cannot run across the routing interface; even if the crossing is forcibly realized, it is very troublesome to use the MAC address to transmit data.

This is because the fixed MAC address built into the network card cannot introduce a logical structure into the address space, making it impossible to have a real address to represent the country, province, city, district, street, road, number and other levels. Therefore, for data transmission, a logical and hierarchical addressing scheme must be used to organize the network, which is the IP address.

3. IP address representation

IP address representation

The IP address is 32 bits in length and consists of 4 bytes. For the convenience of reading and writing, IP addresses are usually expressed in dotted decimal notation.

dotted decimal notation

The expression form of IP address can help us better use and configure the network, but communication equipment uses binary operation mode when calculating IP address, so it is very necessary to master decimal and binary conversion operations.

IPv4 address range

00000000.00000000.00000000.00000000~11111111.11111111.11111111.11111111, that is, 0.0.0.0~255.255.255.255.

4. IP address format

An IPv4 address consists of the following two parts:

Network part (network number): used to identify a network.

The IP address cannot reflect any geographical information about the location of the host, and only the network number field can be used to determine which network the host belongs to.

For devices with the same network number, regardless of their actual physical location, they are all in the same network.

Host part (host number): used to distinguish different hosts within a network.

Netmask (Netmask), also known as subnet mask (Subnet Mask):

The network mask is 32 bits, which is the same as the number of bits in the IP address, and is usually expressed in dotted decimal notation.

The netmask is not an IP address. In binary representation, it is a bunch of consecutive 1s followed by a bunch of consecutive 0s.

The number of 1s in a netmask is usually referred to as the length of the netmask. For example: the length of mask 0.0.0.0 is 0, and the length of mask 252.0.0.0 is 6.

The network mask is generally used in combination with the IP address, where the bit with a value of 1 corresponds to the network bit in the IP address; the bit with a value of 0 corresponds to the host bit in the IP address, so as to help us identify the network bit in an IP address with the host bit. That is, the number of 1s in the network mask is the number of digits of the network number of the IP address, and the number of 0s is the number of digits of the host number of the IP address.

5. IP address classification

In order to facilitate the management and networking of IP addresses, IP addresses are divided into five categories:

The category fields of categories A, B, C, D, and E are binary numbers 0, 10, 110, 1110, and 1111 respectively. The first few bits of the network number field can determine which category the IP address belongs to. The easiest way to class address.

The three types of addresses A, B, and C are unicast IP addresses (except some special addresses), and only these three types of addresses can be assigned to the host interface.

Class D addresses are multicast IP addresses.

Class E addresses are reserved for special experimental purposes.

In this section, we only focus on the three types of addresses A, B, and C.

Comparison of A, B, and C addresses:

A network using class A addresses is called a class A network; a network using class B addresses is called a class B network; a network using class C addresses is called a class C network.

The network number of a class A network is 8 bits, and the number is small, but the number of allowed host interfaces is large; the first bit is always 0, and the address space is: 0.0.0.0~127.255.255.255.

The network number of Class B network is 16 bits, which is between Class A and Class C networks; the first two digits are always 10, and the address space is: 128.0.0.0~191.255.255.255.

The network number of a class C network is 24 bits, and there are many, but the number of host interfaces allowed is very small; the first three bits are always 110, and the address space is: 192.0.0.0~223.255.255.255.

Note:

Host (Host), usually refers to the collective name of routers and computers. And the IP address of an interface of the host is often referred to as the host IP address for short.

Multicast address: Multicast can realize one-to-many message delivery.

6. IP packet format

special IP address

Public IP address: IP addresses are uniformly assigned by IANA to ensure the uniqueness of any IP address on the Internet. The IP address here refers to the public network IP address.

Private network IP address: In fact, some networks do not need to be connected to the Internet, such as the network in a closed laboratory of a university, as long as the IP addresses of network devices in the same network do not conflict. In the IP address space, some addresses are reserved in each of the three types of addresses A, B, and C, which are called private network IP addresses.

Class A: 10.0.0.0~10.255.255.255

Class B: 172.10.0.0~172.31.255.255

Class C: 192.168.0.0~192.168.255.255

255.255.255.255

This address is called a limited broadcast address, and it can be used as the destination IP address of an IP packet.

After receiving an IP packet whose destination IP address is a limited broadcast address, the router stops forwarding the IP packet.

0.0.0.0

If this address is used as a network address, it means the network address of "any network"; if this address is used as a host interface address, it means the IP address of "a host interface on this network".

For example: when a host interface has not obtained its own IP address during the startup process, it can send a DHCP request message to the network with the destination IP address as the limited broadcast address and the source IP address as 0.0. After your own request, you can assign yourself an available IP address.

127.0.0.0/8

This address is a loopback address, which can be used as the destination IP address of an IP message. Its role is to test the software system of the device itself.

It is impossible for an IP packet generated by a device and whose destination IP address is the loopback address to leave the device itself.

169.254.0.0/16

If a network device is set to obtain an IP address automatically, but the device does not find an available DHCP server on the network, then the device will use an address in the 169.254.0.0/16 network segment to obtain the IP address. Temporary correspondence.

Note: DHCP (Dynamic Host Configuration Protocol), a dynamic host configuration protocol, is used to dynamically allocate network configuration parameters, such as IP addresses.

7, ipv4 and ipv6

The IP address we often say at present refers to the IPV4 address, but the available IPv4 addresses are limited. On February 3, 2011, IANA has announced that it will distribute its last 4.68 million IPv4 addresses to five RIRs (Regional Internet Registry) around the world. , the Regional Internet Registry), after which IANA has no IPv4 addresses to assign.

The application of NAT technology alleviates the problem caused by the shortage of IPv4 addresses, but the deployment of IPv6 is the ultimate solution to the shortage of IPv4 addresses. At present, different regions in the world have different demands for deploying IPv6, and the current IPv4 network still occupies the mainstream position, so IPv6 and IPv4 will coexist in a short time.

Advantages of IPV6:

Guess you like

Origin blog.csdn.net/zhynet000001/article/details/124164670