logo elektroda
logo elektroda
X
logo elektroda

How is the number of networks, hosts and network type determined over IP?

shel82 65264 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 8215459
    shel82
    Level 18  
    Hello, can someone describe with a simple and understandable example how, knowing the IP address and the mask, you can count the number of useful networks, hosts and what type of address is it?
  • ADVERTISEMENT
  • #2 8215870
    bogiebog
    Level 43  
    You don't need IP, just a mask.
    E.g. 255.255.255.240

    you convert each number from the mask to a binary form
    255 = 1111 1111
    240 = 1111,0000

    S - number of ones for 255.255.255.240 S = 28
    H - number of zeros, for 255.255.255.240 H = 4

    Number of networks = 2 ** S.
    Number of hosts = 2 ** H in each network (almost -2 per broadcast address and network address)
  • ADVERTISEMENT
  • #3 8216173
    shel82
    Level 18  
    Hmm, I still do not understand, because having this address: 192.168.50.0/27 in the example I have 8 networks and 32 hosts given in the answer ...?

    Meaning yours mask 27 = 255.255.255.224 = 1111 1111.1111 1111.1111 1111.1110 0000 so I have 27 networks and 5 hosts?
  • ADVERTISEMENT
  • #4 8216220
    bogiebog
    Level 43  
    > Reasoning your way
    you don't understand our way

    2 ** S is two to the power of S.
    2 ** 27 = 134,217,728
    2 ** 5 = 32
  • #5 8221094
    shel82
    Level 18  
    bogiebog wrote:

    2 ** S is two to the power of S.
    2 ** 27 = 134,217,728
    2 ** 5 = 32


    I was misled by your notation - it's probably easier and more legible to write 2 ^ S ...
    Continuing with the mask example:
    255.255.255.224 = 1111 1111.1111 1111.1111 1111.111 0 0000
    has 27 ones, which is 2 ^ S = 2 ^ 27 = 134,217,728 , but the answers I have 8 networks - why this number?
    the number of zeros is 5, so S ^ H = 2 ^ 5 = 32 and I agree with that.
  • ADVERTISEMENT
  • #6 8221130
    bogiebog
    Level 43  
    > 27 ones settle down, i.e. 2 ^ S = 2 ^ 27 = 134 217 728, but I have 8 nets for the answers - where does this number come from?

    Maybe someone is just considering the last octet, i.e. 1110 0000,
    Then the number of 1s is 3 and the number of nets 2 ** 3 = 8
  • #7 8223767
    shel82
    Level 18  
    Our leader said that for 192.168.50.0/27, that is, looking only at the mask itself 255.255.255.224 = 11111111.11111111.11111111.11100000 the correct answer is 6 networks and 30 hosts, and I already got lost, maybe someone will explain it to me?
  • #10 8223820
    bogiebog
    Level 43  
    > 6 networks and 30 hosts are the correct answer
    he seems to subtract 2 (broadcast address and network address) from the number of networks (8) - and he gets 6 - which is a bug.
  • #11 8225228
    shel82
    Level 18  
    I looked a lot and considered an exemplary mask, eg.
    255.255.255.224 = 11111111.11111111.11111111.11100000
    considering only the last term (224 = 11100000) and here I do not know why only this term is considered?

    Through trials in the given calculator and then calculations, it turns out that the number of ones tells us about the number of hosts, according to the previous formula:
    2 ^ 3 = 8,
    and the number of zeros with the number of networks:
    2 ^ 5 = 32
    and I'll stick to it.

    The following question is how to find out by such an address (e.g. 192.168.17.111/28) whether it is a HOST, NETWORK, PUBLIC, GROUP address?
  • #12 8225284
    bogiebog
    Level 43  
    > 192.168.17.111/28

    network address = 192.168.17.111 AND netmask
    192.168.17.b (0110 1111) and 255.255.255.b (1111 0000) = 192.168.17.b (0110 0000) = 192.168.17.96

    broadcast address = netaddress + all ones for host bits

    192.168.17.b (0110 0000) + b (1111) = 192.168.17.b (0110 1111) = 192.168.17.111

    the rest of the addresses are host addresses.

    b (xxxx) the number xxxx written in binary
  • #13 8225374
    carlos_oc
    Level 11  
    In the example you gave at the beginning of the post, the address 192.168.50.0/27 actually points to 8 networks with 32 hosts in each of them. The three 1's in the last octet point to these 8 networks (2 ^ 3 = 8 - this is the number of combinations you can make with 3 bits available). The network addresses will look like this in this case:

    192.168.50.0 (hosts 192.168.50.1 to 192.168.50.31 where 192.168.50.31 is broadcast)
    192.168.50.32 (hosts 192.168.50.33 to 192.168.50.63 where 192.168.50.63 is broadcast)
    192.168.50.64 (hosts 192.168.50.65 to 192.168.50.95 where 192.168.50.95 is broadcast)
    192.168.50.96 (hosts 192.168.50.97 to 192.168.50.127 where 192.168.50.127 is broadcast)
    192.168.50.128 (hosts 192.168.50.129 to 192.168.50.159 where 192.168.50.159 is broadcast)
    192.168.50.160 (hosts 192.168.50.161 to 192.168.50.191 where 192.168.50.191 is broadcast)
    192.168.50.192 (hosts 192.168.50.193 to 192.168.50.223 where 192.168.50.223 is broadcast)
    192.168.50.224 (hosts 192.168.50.225 to 192.168.50.255 where 192.168.50.255 is broadcast)
  • #14 15148048
    konradsonic
    Level 9  
    carlos_oc wrote:
    In the example you gave at the beginning of the post, the address 192.168.50.0/27 actually points to 8 networks with 32 hosts in each of them. The three 1's in the last octet point to these 8 networks (2 ^ 3 = 8 - this is the number of combinations you can make with 3 bits available). The network addresses will look like this in this case:

    192.168.50.0 (hosts 192.168.50.1 to 192.168.50.31 where 192.168.50.31 is broadcast)
    192.168.50.32 (hosts 192.168.50.33 to 192.168.50.63 where 192.168.50.63 is broadcast)
    192.168.50.64 (hosts 192.168.50.65 to 192.168.50.95 where 192.168.50.95 is broadcast)
    192.168.50.96 (hosts 192.168.50.97 to 192.168.50.127 where 192.168.50.127 is broadcast)
    192.168.50.128 (hosts 192.168.50.129 to 192.168.50.159 where 192.168.50.159 is broadcast)
    192.168.50.160 (hosts 192.168.50.161 to 192.168.50.191 where 192.168.50.191 is broadcast)
    192.168.50.192 (hosts 192.168.50.193 to 192.168.50.223 where 192.168.50.223 is broadcast)
    192.168.50.224 (hosts 192.168.50.225 to 192.168.50.255 where 192.168.50.255 is broadcast)


    Why does my colleague describe hosts and not subnets? There are no separate subnets here. If the subnets increase, the number of hosts in them decreases proportionally. What a colleague wrote here a bit incomprehensible for me. There can be 8 subnets, so the 3 octet does not change while keeping the number of hosts taken into account

    1.network address
    2 host min
    3. host max
    4.broadcast address

    And we have to stay in 30

    http://42.pl/netcalc/?a1=192.168.50.161&a2=192.168.50.190

Topic summary

The discussion revolves around calculating the number of networks and hosts based on an IP address and subnet mask. A user inquires about how to derive the number of usable networks and hosts from an IP address (e.g., 192.168.50.0/27) and its corresponding mask (255.255.255.224). Responses clarify that the subnet mask can be converted to binary to count the number of ones (S) and zeros (H). The formula for networks is 2^S, while for hosts, it is 2^H - 2 (to account for the network and broadcast addresses). The confusion arises from different interpretations of the subnetting process, particularly regarding the number of networks and hosts derived from the last octet of the mask. Ultimately, it is established that for a /27 mask, there are 8 subnets and 30 usable hosts per subnet.
Summary generated by the language model.
ADVERTISEMENT