The subnet mask is used for this purpose. It indicates how much of the address is for network, and the remaining part is for the hosts.
To seprate an ip address from the network address we use subnet mask that can seprate the ip address from the network address
The host portion specifies the particular network interface's address. The network portion specifies the network address.
Network Portion Host Portion
The host portion of an IP address of all zeros indicates that you are referring to 'this network'. For example, the address 145.5.0.0 means the network 145.5
A submask is designed to separate the network id portion of an IP address from the host or client portion. This helps a router determine whether the packet needs to be forwarded to another network.
When we express an IPv4 network address, we add a prefix length to the network address. The prefix length is the number of bits in the address that gives us the network portion. For example, in 172.16.4.0 /24, the /24 is the prefix length - it tells us that the first 24 bits are the network address. This leaves the remaining 8 bits, the last octet, as the host portion.
Since a subnet mask is used to separate the network id from the host id, any 1 bits indicate the network portion and the 0 bits indicate host portion. As an example, in the subnet mask: 255.255.0.0 This indicates the first two octets are used for the network, and the last two octets (ipV4) are used for host portion of an address.
Seeing as the IP address of 128.107.10.11 is a class B network, the host portion is 10.11
Subnet mask
subnet masks
Because this is the way you can easily and quickly isolate the network portion from the host portion of the address to just get the network id, which would be using for routing purposes.
When you set up a sub network you decide upon the subnet mask and this determines the network address (all zeros in the subnet portion of the address) and the broadcast address (all ones in the subnet portion of the address). When you assign the host addresses in your subnet, then you use the addresses between the network address and the broadcast address.