IP address subnet mask gateway

Class A, Class B, and Class C IP addresses distinguish the
IP address (actually this is IPV4) is a 32-bit binary number composed of four eight-bit fields. Each IP address consists of two parts: one is the network identification, and the other is the host identification.
The first 8 bits of a class A address are the network identifier. The last 24 bits are the host ID and the
first 16 bits are the network ID. The last 16 bits are the host ID and the
first 24 bits are the network ID. The last 8 bits are the host ID
type a address: the first 8 bits of the class A address are the network ID, and the last 24 bits are the host ID. The range is from 0-127, 0 is reserved and represents all ip addresses, and 127 is also a reserved address and is used for testing loopback. Therefore, the range of a type address is actually from 1-126. For example: 10.0.0.1, the first segment is the network number (this is the network identification), and the remaining three numbers (referring to the host identification) are the numbers of the local computer. Converted to binary system, a type a ip address consists of a 1-byte network address and a 3-byte host address. The highest bit of the network address must be "0", and the address range is from 0.0.0.1 to 126.0.0.0. There are 126 Class A networks available, and each network can accommodate more than 100 million hosts (the number of hosts to the power of 2 to the 24th power). Use subnet mask to distinguish: 255.0.0.0.
Class b address: range from 128 to 191, such as 172.168.1.1, the first and second numbers are network numbers, and the remaining 2 numbers are local computer numbers . Converted to binary system, a type b ip address consists of 2 bytes of network address and 2 bytes of host address. The highest bit of the network address must be "10", and the address range is from 128.0.0.0 to 191.255 .255.255. There are 16,382 B-type networks available, and each network can accommodate more than 60,000 hosts. Use the subnet mask to distinguish: 255.255.0.0
Class c address: range from 192-223, such as 192.168.1.1, the first, second, and third segment numbers are network numbers, and the remaining last segment number is the number of the local computer. Converted to binary system, a type 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". The range is from 192.0.0.0 to 223.255.255.255. There are more than 2.09 million class c networks, each of which can accommodate 254 hosts. Use the subnet mask to distinguish: 255.255.255.0

Subnet
mask The definition of subnet mask (subnet mask) is also called network mask, address mask, subnet mask is to use several bits of the host address as the network address to divide the network into several subnets. It is One is used to indicate which bits of an IP address identify the subnet where the host is located, and which bits identify the bit mask of the host. The subnet mask cannot exist alone, it must be used in conjunction with the IP address.
Subnet mask, network and host addresses only two parts of a role, is to divide an IP address into
the calculation
because the number of bits in the subnet mask decide the number of possible number of subnets and hosts per subnet. Before defining the subnet mask, you must figure out the number of subnets and hosts originally used.
Method 1: Use the number of subnets to calculate:
  1. First, convert the number of subnets from a decimal number to a binary number;
  2. Next, The number of bits of the binary number obtained by the statistics is set to N;
  3. Finally, first find the subnet mask of the address category corresponding to this IP address. Then set all the first N bits of the host address part of the calculated subnet mask (that is, the "host number") to 1, so that the subnet mask of the IP address division subnet can be obtained.
  For example : Class B IP address 167.194.0.0 needs to be divided into 28 subnets:
  1)(28)10=(11100)2;
  2) The number of binary digits is 5, so N=5;
  3) This IP address is Class B address, and the subnet mask of the class B address is 255.255.0.0, and the host address of the class B address is the last 2 digits (ie 0-255.1-254). So set all the first 5 bits of the host address in the subnet mask 255.255.0.0 to 1, you can get 255.255.248.0, and this set of values ​​is the subnet mask of the class B IP address 167.194.0.0 divided into 28 subnets
Gateway definition
To achieve communication between these two networks, it must pass through a gateway. If the host in network A finds that the destination host of the data packet is not in the local network, it forwards the data packet to its own gateway, which then forwards it to the gateway of network B, and the gateway of network B forwards it to a certain network in network B. Host
Insert picture description here

Gateway DNS server DHCP definition https://blog.csdn.net/zhaisharap/article/details/102719392

Guess you like

Origin blog.csdn.net/m0_52425873/article/details/112547424