Class A, B, C, D address and subnet mask, the network address is obtained from the IP address and subnet mask

The IP address of a host is 192.168.34.178 and the subnet mask is 255.255.255.192. What is the network ID of the host?

Convert 192 into binary: 11000000. Subnet mask (binary): 11111111.11111111.11111111.11000000

Number of hosts: 2 to the 6th power = 64 units -2 = 62 units Subtract 2 because the host does not include network addresses and broadcast addresses. That is, if the subnet mask is all 1, the first 26 bits are the network ID, and the last 6 bits are the host ID.

10000000 is converted to decimal to 128

That is, the network ID is 192.168.34.128/26

For example, if there are 10 hosts in a subnet, the IP address required for this subnet is
10+1+1+1=13.
Note: The first 1 added refers to the gateway address required for this network connection, and the next two 1s respectively refer to Network address and broadcast address.
Because 13 is less than 16 (16 is equal to 2 to the 4th power), the host bit is 4 bits.

And 256-16=240, so the subnet mask is 255.255.255.240

 
The IP address of a host in the LAN is 202.116.1.12/21, and the subnet mask of the LAN is ().

According to the subnet mask /21, we know that there are 21 1s, and divide it into 11111111, 11111111, 11111000, 00000000->255.255.248.0 as the subnet mask
206 110 4 0/20 is divided into 16 subnets, each subnet Netmask?

/20 means that there is an IP address that specifies the network bit as 20, and its default subnet mask defaults to: 11111111 |11111111| 1111|0000 00000000, 1 represents the network bit, 0 represents the host bit, and only the last 12 0s can be operated , It is required to be divided into 16 subnets, indicating that the network bit of the subnet is 4, then the host bit is 8, 11111111.11111111.11111111.00000000, which is 255.255.255.0. In
a network, the IP address of a host is 172.16.45.12/30. The host belongs to the same subnet is _

If the subnet mask is 30, there are only 2^2-2=2 hosts, 12->00001100, and the address of the other host is 00001101; 13

The IP address is composed of 32 bits, divided into four segments, composed of the network number and the host number. It is divided into five types of ABCDE addresses. ABC type addresses are used to distribute to network users around the world, and DE type is a special address.
1. Class A address 1.0.0.0 to 126.255.255.255

Only the first segment is the network number, and the remaining three segments are the host number. In binary representation, there are 8 bits, that is, one byte is the network number, and 24 bits, that is, three bytes are the host number. Therefore, the class A address has fewer network addresses, but it can accommodate the most hosts. The number is 2 to the 24th power minus 2 is equal to 16777214 hosts (the minus 2 is because when the host number is all 1, it means that the network broadcast address is 0 means the network number of the network, these are two special addresses) equal to the highest bit of the network address must be "0", then the address range expressed in binary is: 00000001 00000000 00000000 00000000——01111110 11111111 11111111 11111111, which is 1.0 .0.0 to 126.255.255.255. The subnet mask is 255.0.0.0

(The network address between A and B is 127.0.0.0 to 127.255.255.255. Among them, 127.0.0.0 is a reserved address, and 127.0.0.1 to 127.255.255.254 are special addresses, which are local loopback addresses and local loopback addresses. Address does not belong to any categorized address class. It represents the local virtual interface of the device, so it is regarded as an interface that will never fail by default. There are similar definitions in the windows operating system, so it is usually before installing the network card You can ping the local loopback address. It is generally used to check whether the local network protocol, basic data interface, etc. are normal. The local loopback address has two main functions: one is to test the network configuration of the machine, and it can ping through 127.0.0.1 (Usually use 127.0.0.1) It means that there is no problem with the network card and IP protocol installation of the machine; another function is that some SERVER/CLIENT applications need to call the resources on the server when they are running, and generally specify the IP address of the SERVER , But when the program is to be run on the same machine and there is no other SERVER, the SERVER resources can be installed on this machine, and the SERVER’s IP address is set to 127.0.0.1 and it can also be run.)

127.255.255.255 is the broadcast address 2.
Class B address 128.0.0.0 to 191.255.255.255

The first two paragraphs are network numbers, and the remaining two paragraphs are host numbers. The number of hosts that can be accommodated is 2 to the 16th power minus 2 equals 65534 units. The highest bit of the address must be "10". The binary representation is: 10000000 00000000 00000000 00000000——10111111 11111111 11111111 11111111, which is 128.0.0.0 to 191.255.255.255. The last one is the broadcast address. The subnet mask is 255.255.0.0. The broadcast address is when its host number is all 1.

 
3. Class C address 192.0.0.0 to 223.255.255.255

The first three segments are the network number, and the remaining segment is the host number. It can accommodate 256-2=254 hosts. Class C addresses have more network addresses and are suitable for small-scale local area networks. The highest bit of the network address must be "110", and the binary representation is: 11000000 00000000 00000000 00000000——11011111 11111111 11111111 11111111, which is 192.0.0.0 to 223.255.255.255. The last address is the broadcast address. The subnet mask is 255.255.255.0 4.
Class D address 224.0.0.0 to 239.255.255.255

Class D IP addresses are historically called multicast addresses, that is, multicast addresses. In Ethernet, the multicast address names a group that should
receive a packet site in this network application . The highest bit of the multicast address must be "1110", and the binary representation is: 11100000 00000000 00000000 00000000 ——11101111 11111111 11111111 11111111, which is 224.0.0.0 to 239.255.255.255

5. Subnet mask

The subnet mask cannot exist alone, it is used in conjunction with the IP address.

Composition rule: It is composed of 0 and 1. The mask is masked by binary AND, which masks the address of the host without changing the address of the network. Therefore, the network numbers on the left are all 1, and the host number segments on the right are all 0. Take the class A address as an example, only the first segment is a network address, and only the first eight digits of its subnet mask are 1, and the remaining 24 The bits are all 0, that is: 255.0.0.0. Similarly, Class B address: 255.255.0.0 Class C address: 255.255.255.0
————————————————
 

Guess you like

Origin blog.csdn.net/yinzhen_boke_0321/article/details/104188960