Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

"detailed explanation of IP address" in IP address and subnetting study notes

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Before learning IP address and subnetting, we must have some understanding of binary counting, especially the translation between binary and decimal, which is very helpful for us to master IP address and subnetting. Please refer to the directory details below.

IP address and subnetting Learning Notes related chapters:

1. "preliminary knowledge: progressive counting" of IP address and subnetting learning notes

2. "detailed explanation of IP address" in IP address and subnetting study notes

3. "detailed explanation of subnet mask" of learning notes on IP address and subnetting

4. "detailed explanation of subnetting" of IP address and subnetting study notes

5. "detailed explanation of supernet merging" of IP address and subnetting study notes

1. IP address and MAC address 1, MAC address

The MAC (Media Access Control, Media access Control) address, or physical address, or hardware address, is used to define the location of the network device. The MAC address is set when the network card leaves the factory and is fixed (but it can be modified in the device manager or registry, etc., and the MAC address in the same network segment must be unique). The MAC address is represented in hexadecimal numbers and is 6 bytes (48 bits) long, divided into the first 24 bits and the last 24 bits.

1. The first 24 bits are called Organizationally Unique Identifier (OUI), which is the code assigned to different manufacturers by the registration authority of IEEE, which distinguishes different manufacturers.

2. The last 24 bits are assigned by the manufacturer themselves and are called extension identifiers. The last 24 bits of the MAC address in the network card produced by the same manufacturer are different.

The MAC address corresponds to the second data link layer of the OSI reference model. The switch working in the data link layer maintains the database of the computer MAC address and its own port, and the switch forwards the data frame according to the "destination MAC address" field in the received data frame.

2. IP address

IP address (Internet Protocol Address), abbreviated as IP Adress, is a unified address format for hosts on Internet, also known as Network Protocol (IP Protocol) addresses. It assigns a logical address to every network and host on the Internet. The common IP address is divided into two categories: IPv4 and IPv6. At present, IPv4 is widely used. At present, IPv4 is almost exhausted. The next stage is bound to upgrade to IPv6;. If there is no special note, the IP address we are talking about generally refers to IPv4.

The IP address corresponds to the third network layer of the OSI reference model. The router working in the network layer determines whether it belongs to the same network segment according to the destination IP and the source IP, and forwards the packet if it is a different network segment.

3. IP address format and representation

In computer binary, 1 byte = 8 bits = 8bit (bits)

① IP address format and representation

The IP address (IPv4) consists of 32-bit binary numbers, divided into 4 segments (4 bytes), each 8-bit binary number (1 byte)

Each paragraph is 8-bit binary, with English punctuation in the middle. Separate

Because the binary number is too long, in order to facilitate memory and recognition, each segment of 8-digit binary number is converted into decimal system, the size is 0 to 255.

This representation of IP addresses is called dotted decimal representation.

The IP address is expressed as: xxx.xxx.xxx.xxx

Take Chestnut: 210.21.196.6 is a representation of an IP address.

② understands the exponential power of 2

The power of 2 is also called the exponent of 2, and it can also be called the power of 2, such as the 2nd power of 2, the 3rd power of 2, and so on. The 0 power of any number is equal to 1.

In IP addresses, the power of 0 to the power of 7 is exactly 8 bits, which is very convenient for IP address binary to decimal conversion.

Take a chestnut: 0 = 1 × 2 ^ 7 + 1 × 2 ^ 6 + 0 × 2 ^ 5 + 1 × 2 ^ 4 + 0 × 2 ^ 3 + 0 × 2 ^ 2 + 1 × 2 ^ 1 + 0 × 2 ^ 0 = 12864 ^ 0160002o = 11010010

We need to remember the result of the power of 2 above, there is no need to memorize the result, this is skillful, from the above picture, it is easy to find that because it is the power of 2, all the adjacent powers are twice as different, so as long as you know one of the powers, you will know the value of the adjacent powers.

4. Composition of IP address

IP address = network address + host address, for example:

The IP address of the computer consists of two parts, one is the network ID and the other is the host ID. The computer network part in the same network segment is the same, and the host part repeats at the same time. The router connects different network segments and is responsible for data forwarding between different network segments, and the switch connects computers in the same network segment. By setting the network address and host address, it is guaranteed that the IP address of each host will not overlap each other in the whole interconnected network, that is, the IP address is unique.

5. The difference length between IP address and MAC address is different: IP address is 32-bit (binary), MAC address is 48-bit (hexadecimal). Allocation varies: IP address assignment is based on network topology, and MAC address assignment is based on manufacturer. The addressing protocol layer is different: the IP address is applied to the OSI layer 3 (network layer), while the MAC address is applied to the OSI layer 2 (data link layer). 6. The function and relationship between IP address and MAC address.

IP and MAC have a clear division of labor and tacit cooperation to complete the communication process. In data communication, IP addresses focus on the network layer, and network layer devices (such as routers) forward packets from one network to another based on IP addresses, while MAC addresses focus on the data link layer, while data link layer devices (such as switches) transmit a data frame from one node to another on the same link based on the MAC address. The mapping relationship between IP and MAC address is completed by ARP (Address Resolution Protocol, address Resolution Protocol) protocol. According to the destination IP address, ARP finds the MAC address of the intermediate node, transmits it through the intermediate node, and finally reaches the destination network.

Before communicating with other computers, the computer must first judge whether the target IP address and its own IP address are in the same network segment, which determines whether the target MAC address of the data link layer is the MAC address of the target computer or the router interface. The destination IP address of the packet determines which computer the packet eventually arrives at, while the destination MAC address determines which device will receive the next hop of the packet, not necessarily the destination.

2. Classification of IP addresses 1. Detailed explanation of IP address classification

IP addresses are divided into five categories A, B, C, D and E, among which A, B and C are the more commonly used IP addresses, and D and E are special addresses.

①, Class An address Class An address the first byte is the network address (the highest bit is always 0), and the other three bytes are the host address. Class An address range: 1.0.0.0-126.255.255.255, where 0 and 127 are special addresses. The default subnet mask for a Class A network is 255.0.0.0, or / 8. The maximum number of hosts in a Class A network is 256 × 256 × 256-2166777214 (minus 1 network address with 0 host bits and 1 broadcast address).

In the computer network, the address of the host whose ID is all 0 is the network address, while the address of the host ID is all 1 is the broadcast address, these two addresses can not be assigned to the host.

②, Class B address Class B address the first byte (the highest bit is always 10) and the second byte is the network address, and the other two bytes are the host address. Class B address range: 128.0.0.0-191.255.255.255. The default subnet mask for a Class B network is 255.255.0.0, or / 16. The maximum number of hosts in Class B network is 256 × 256-2mm 65534. ③, Class C address Class C address the first byte (the highest bit is always 110), the second byte and the third byte, and the other byte is the host address. Class C address range: 192.0.0.0-223.255.255.255. The default subnet mask for Class C networks is 255.255.255.0, or / 24. The maximum number of hosts in Class C network is 256-230254. ④, Class D address Class D address regardless of network address and host address, the highest bit of its first byte is fixed at 1110. Class D addresses are used for multicast (also known as multicast) and do not have a subnet mask. Class D address range: 224.0.0.0-239.255.255.255. ⑤, Class E address Class E address does not distinguish between network address and host address, and the highest bit of its first byte is fixed at 11110. Class E address range: 240.0.0.0-255.255.255.255. Among them, 240.0.0.0-255.255.255.254 is used as the reserved address, which is mainly used for Internet experiment and development, and 255.255.255.255 as the broadcast address. 2. IP address classification mind map

The IP address summary learning mind map is as follows:

3. Reserved special IP address

The following special IP addresses are addresses that cannot be assigned to hosts:

The address where the host ID is all 0: specifically refers to a certain network segment, such as 192.168.10.0255.255.255.0, which refers to 192.168.10.0 network segment. Host ID is all 1 address: specifically refers to the network segment of all hosts, such as: 192.168.10.255, if your computer sends packets using host ID is all 1 IP address, data link layer address with broadcast address FF-FF-FF-FF-FF-FF. 127.0.0.1: is the local loopback address, which refers to the local address, which is generally used for testing. The loopback address (127.x.x.x) is the native loopback address (Loopback Address), which is the IP address inside the host IP stack. 169.254.0.0-169.254.255.255 is actually an automatic private IP address. 0.0.0.0: if the computer's IP address conflicts with other computer addresses in the network, what you see with the ipconfig command is 0.0.0.0, and the subnet mask is 0.0.0.0.

The mind map of the reserved special IP address is as follows:

4. IP addresses of public and private networks

Public network IP address

Inter NIC (Internet Network Information Center Internet Information Center) is responsible for the allocation and management of public addresses. The public network addresses used by all levels of ISP need to be applied to Inter NIC and issued uniformly by Inter NIC, so as to ensure that the address blocks do not conflict.

Private network IP address

The person who created the IP addressing scheme also created a private IP address. These addresses can be used for private networks, there are no IP addresses in Internet, and routers on Internet do not have a routing table to the private network.

Class A: 10.0.0.0 255.0.0.0, retaining 1 Class A network. Class B: 172.16.0.0 255.255.0.0 172.31.0.0 255.255.0.0, retaining 16 Class B networks. Class C: 192.168.0.0 255.255.255.0mm 192.168.255.0 255.255.255.0, 256 Class C networks are retained.

PS: private network address access to Internet requires NAT or PAT network address translation

The mind map of IP addresses in public and private networks is as follows:

The end of this article is over.

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: 0

*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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report