IP address is composed of network address + host address so you can get the network bit + host bit = 32 bits
The concept of the same network segment :
The same network segment refers to the IP address and subnet mask, and the same net address is obtained.
Want to be in the same network segment, must do network identity is the same, that is, network address. For example, Class A address: Only the first paragraph (255.0.0.0); Class B Address: First to second paragraph (255.255.0.0); Class C Address: Tertiary segment (255.255.255.0).
That is: 1) IP address and subnet mask for "and" operation, get network address.
2) broadcast address: The network address of the host location is all set to 1, the network bit is not changed, you can get the broadcast address.
How to know how many network bits and host bits are in an IP address, then this subnet mask determines.
For example an IP address 10.158.79.53, subnet mask bit 255.255.248.0, which is the network bit, the host bit is how much? What is the number of hosts? What is the network address and broadcast address? Next, my personal idea: Because the subnet mask determines the number of network bits and host bits, of course, to see the subnet mask, into the binary system namely: 11111111.11111111.11111000.00000000,
There are 21 consecutive 1 that is the network bit 21,
host bit =32-21=11
Then the number of hosts is (2 of 11 square-2), why should reduce 2, because this string address includes a minimum address and the largest address, respectively, called the network address (also called network number) and broadcast address, the two addresses are not assigned to the host.
Also back to just that example, since to calculate the network address and broadcast address, we go to see the IP address 10.158.79.53, just now we calculate the network bit is 21, then 10.158 this we do not go to see, these two accounted for 16 network bit, do not need to turn into binary system so troublesome. Then there are 5 network bits, we focus on the calculation of the next 79 (into binary system is 1001111, we count only 7 bits, we have to ensure that 8 bits on the front of 0 that is 01001111, remember this is the key, remember less than 8 bits of the first to fill 0 to 8), So we take the front 5 that is 01001 so the total is this is the 10.158.01001xxx.xxxxxxxx, now we change the X to 0, this address is the network address (also called the network number); now we change the X to 1, this address is broadcast address , calculated as 10.158.72.0 and 10.158.79.255, the available address range is between the two.
If we know IP address and network bit, for example 10.117.205.113/27, how to calculate host bit, host number, subnet mask, network address and broadcast address?
host bit is 32-27=5
number of hosts is 2 of 5 square-2
The subnet Mask is 27 consecutive 1 followed by 0 that is 11111111.11111111.11111111.11100000 calculate a bit 255.255.255.224
Let's see if the network bit is 27, Then the IP address 10.117.205.113 inside the 10.117.205 occupies 24 network bit, there are 3 must be in 113, into the binary 1110001, a number of 7 bits to make up 8 bits 01110001, the first 3 is the network bit, then the total is not so 10.117.205.011 XXXXX, now we change the X to 0, this address is the network address (also called the network number); now we change the X to 1, this address is the broadcast address , Calculate the difference is 10.117.205.96 and 10.117.205.127, the available address range is between the two.
Examples of how to calculate subnet masks, network addresses, broadcast addresses, etc.