Ip address restriction

Discussion in 'Kernel Questions' started by Harsh Shah, Dec 3, 2019 at 5:27 AM.

  1. Harsh Shah

    Harsh Shah New Member

    Hi
    I want to know that Is it possible that maximum number of hosts in a network, can restrict class of ip address that can be used for network ?
    I have tried to get the answer for it but didn't get proper answer.
    Can anyone please help me ?
    Thanks in advance.
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I admit I do not understand the above question.
    So just some random thoughts here. The maximum number of hosts is restricted by the number of IP-addresses in the subnet. One of the addresses is used by the network address, one is broadcast address and usually one address is for the gateway. So subscract 3 from the number of IP-addresses. The Class A, B, C networks are I believe deprecated nowadays, but C class network is 255 IP-addresses and so allows 252 hosts.
    More info:
    https://en.wikipedia.org/wiki/Subnetwork
    http://www.subnet-calculator.com/
     
  3. nhybgtvfr

    nhybgtvfr Active Member

    number of possible hosts/ip's is controlled by the netmask

    eg 192.168.0.0 mask 255.255.0.0 allows 65536 addresses, including the network address and broadcast address, so 65534 possible host IPs'
    192.168.40.0 mask 255.255.255.0 (192.168.40.0/24) allows 256 addresses, including network and broadcast, so 254 possible host ip's.

    Basic rules:
    1. The total number of IP addresses in a subnet is a power of two. So that's: 1, 2, 4, 8, 16, ... etc.
    2. The first IP address in a subnet is a multiple (0, 1, 2, 3 ...) of the number of IP addresses in the subnet.
    3. 'x' in netmask '255.255.255.x' is 256 - number of IP addresses in the subnet.
    4. In slash-notation, the netmask is '/y', where y = 32 - n, and 2ⁿ is the number of addresses in the subnet.
    So if we want 4 addresses in our subnet, the first address in this subnet is either 0 or 4 or 8 or 12 or ... etc.
    And 'x' in netmask '255.255.255.x' is: 256 - 4 = 252. So the netmask is: '255.255.255.252'.
    4 = 2², so n = 2 and y is 32 - 2 = 30. The slash-notation netmask is therefore: '/30'.

    Note: You can't actually use IP addresses a.b.c.0 or a.b.c.255

    Netmasks
    Size
    Netmask /
    1 255.255.255.255 /32
    2 255.255.255.254 /31
    4 255.255.255.252 /30
    8 255.255.255.248 /29
    16 255.255.255.240 /28
    32 255.255.255.224 /27
    64 255.255.255.192 /26
    128 255.255.255.128 /25
    256 255.255.255.0 /24
     

Share This Page