Options

Can anyone help clear up some subnet confusion.

dtweaponxdtweaponx Registered Users Posts: 3 ■■□□□□□□□□
Hello,

Given the following:
ip address 128.107.0.1/30

How do they get the mask to be .252?
255.255.255.252

My questions is when /30 or /24 or anything after the slash, how do you calculate subnet mask? I for some odd reason just can't get it.

Comments

  • Options
    Neil86Neil86 Member Posts: 182 ■■■■□□□□□□
    It corresponds to the positional value of the bits.

    Example: 128.107.0.1 /30

    The /30 means there are 30 bits to identify the (N)ETWORK. The remaining two identify the (H)OSTS.

    NNNNNNNN.NNNNNNNN.NNNNNNNN.NNNNNNHH

    If we look at the octets a little closer, each bit has a value based on its position.

    Bit: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8
    Value: 128 - 64 - 32 - 16 - 8 - 4 - 2 - 1 (<-- same values for each octet)

    If you add the values, in each octet, where the bit is for the network, that is how you get 252, or 248, 255, or 192, etc.

    A /30 mask means 255.255.255.252 because the first 3 octets have 8 bits each, and every one of them are part of the network. The last octet has the first 6 bits part of the network.

    So, to get 252 in the last octet, you MUST have the 128 bit, the 64 bit, the 32 bit, the 16 bit, the 8 bit, and the 4 bit all part of the network, because when you add them up, it equal 252. There is no other way to get 252 out of those values.

    The only possible values in a mask are 128, 192, 224, 240, 248, 252, 254, 255. If you look at those numbers closely and compare them to the bit values, you'll see a pattern.

    It takes practice and time to get it. You'll hit that "Aha!" moment. Start with practicing in the last octet, then move on the the 3rd and 2nd octet.

    Hope my explanation helps and wasn't confusing.
  • Options
    jvrlopezjvrlopez Member Posts: 913 ■■■■□□□□□□
    I always focus in on the middle of the octet, for example, /28 is a block size of 16 addresses, which gives you 14 usable (the network ID and broadcast are not available) and either work up or down from there by doubling (when you go back to the left) or by dividing in half (when you go further right). So for example, a /30 is 2 down from /28, which I know to be a block size of 16...so dividing that in half is 8 (/29)...and again is 4 (/30)...so a block size of 4, which is 2 usable IPs and 1 each for network ID and broadcast.

    Going to the left, I know that a block size of 16 (/28 ) doubled is 32, so /27 is 30 hosts usable, with 1 each reserved for network ID and broadcast.

    This is how I wrapped my head around subnetting. It works on all octets and classes.
    And so you touch this limit, something happens and you suddenly can go a little bit further. With your mind power, your determination, your instinct, and the experience as well, you can fly very high. ~Ayrton Senna
Sign In or Register to comment.