The relationship between the subnet mask and ip address

1. What is the ip address

       In the network, all devices are assigned an address. This address is equivalent to a certain way of XX XX No. rooms. [No.] wherein the corresponding number is assigned to an entire subnetwork, the number corresponding to [the chamber] is assigned to the subnet of the computer, which is a network address. [No.] network number corresponding to the number called, the number corresponding to [the chamber] is called host number, the entire address called an IP address. Through this we can locate the IP address of the server.

2, IP address format

Because humans rely decimal, so the IP address here expressed in decimal way

Let the machine identification, or have converted to binary

(Decimal IP address) 14.145.184.184

(Binary IP address) 00,001,110.10010001. 10,111,000.10111000

This method represents IP mode, called the IPV4, each IP address is represented by a 4 * 8 = 32

In this case, there are a number of IP addresses it?

00000000 00000000 00000000 00000000 minimum address is 0.0.0.0

1,111,111,111,111,111 1,111,111,111,111,111 maximum address is 255.255.255.255

IPV4 way, can represent up to 255 * 255 * 255 * 255 = 4,228,250,625 = 4,000,000,000 ip address has now run out

3. Private IP

In order to solve the case of shortage of public IP addresses, the invention thus private IP (Private IP)

For example, a family (company) have several computers, each computer has a private IP, consisting of a local area network between them

These private IP, through certain techniques (NAT), share a public IP

In other words, a public IP, you can separate many have a lot of Private IP, IPV4 lack of such a problem is solved

In order to better manage the private IP divided into three types

CLASS A:10.0.0.0 ~ 10.255.255.255
CLASS B:172.16.0.0 ~ 172.31.255.255
CLASS C:192.168.0.0 ~ 192.168.255.255

4, IP address is how composed

Find the IP address, you can find the house number analogy by courier

Each building has a floor, for example 4 building, Building 5, etc.
Each building has a house number, such as Room 101, No. 102 and the like Room

IP address also has two partial address, namely the "network address (network number)" and "host address (host ID)."

Different categories (A, B, C) of the division "network number" and "host ID" is different, there is a table

 

As long as "network number net_id (purple)" IP address is the same, we'll call these IP addresses in the same network segment

Mutual access to each other, such as playing online games

When the host number are all 0, the first representing the whole building a house, also known as network address network ip

When whole host No. 1, representing the whole building and finally a house, also called broadcast address broadcast ip

5, the subnet mask is what? what's the effect?

Or make an analogy with building No. Well

In reality, we can say so, Building 1, Room 201 on the
IP address, the figures are linked together, 10101010.10101010.10101010.00000001
how do we know which part is the floor? Which part is the room number it? How to divide it?

The answer is the subnet mask by --Netmask

Mask means, it is to conceal a portion of the code, while exposing another portion of the code

Subnet mask, in order to conceal the "network number net_id", exposed the "host number host_id"

Expressed as a cover for 1
with 0 exposure

With this, for example, IP address notation: 10.10.10.1/24 10.10.10.1/25

24 illustrates the subnet mask covered the 24, also illustrates this IP "network number net_id" is 24, the segment accounted for 24

25 illustrates the subnet mask covered the 25, also illustrates this IP "network number net_id" is 25, the segment accounted for 25

Because 10.10.10.1/24 and 10.10.10.1/25 "network number" different, different segments

The network address (a first IP address), the subnet mask (binary) operation with the derived IP address (binary) and

The binary 10.10.10.1/24 10.10.10.1 is 10101010.10101010.10101010.00000001
10.10.10.1/24 subnet mask is 1,111,111,111,111,111 1,111,111,100,000,000
so the network address is in 10.10.10.1/24 10101010.10101010.10101010.00000000, i.e. 10.10.10.0
broadcast address 10.10.10.1/24 is 10101010.10101010.10101010.11111111 that 10.10.10.255
so this network segment can be allocated to a total of 254 IP addresses used by the host, from 10.10.10.1 ~ 10.10.10.254

The binary 10.10.10.1/25 10.10.10.1 is 10101010.10101010.10101010.00000001
10.10.10.1/25 subnet mask is 1,111,111,111,111,111 1,111,111,110,000,000
so the network address in the range 10101010.10101010.10101010.00000000 10.10.10.1/25, i.e. 10.10.10.0
10.10.10.1/25 a broadcast address 10101010.10101010.10101010.01111111, namely 10.10.10.127
(address change when the network broadcast address, subnet mask because the mask the 25, so only the last 27 becomes 1)
Therefore, this segment can be, can be assigned to hosts using a total of 126 addresses from 10.10.10.1 ~ 10.10.10.126

10.10.10.1/24 and 10.10.10.1/25

One is the subnet mask of the IP address 10.10.10.1 24

25 is a subnet mask for the IP address of 10.10.10.1

Two surfaces are the same IP address, subnet mask, but because different, resulting in different network segments

Like a building has 201 rooms, the second floor also has 201 rooms, two rooms but not in the same room

10.10.10.1/24 and 10.10.10.1/25 also two IP addresses




 
Know almost the foregoing excerpt
Author: know almost Users
link: https: //www.zhihu.com/question/29723388/answer/66737890
Source: know almost

Guess you like

Origin www.cnblogs.com/pachongshangdexuebi/p/11961897.html