0 as the last octet in an IP - Networking

This is a discussion on 0 as the last octet in an IP - Networking ; Is 0 valid as the last octet in an IP address? For instance: 192.168.1.0 Thanks, PaulH...

+ Reply to Thread
Results 1 to 7 of 7

Thread: 0 as the last octet in an IP

  1. 0 as the last octet in an IP

    Is 0 valid as the last octet in an IP address?

    For instance: 192.168.1.0

    Thanks,
    PaulH


  2. Re: 0 as the last octet in an IP

    PaulH wrote:

    > Is 0 valid as the last octet in an IP address?
    >
    > For instance: 192.168.1.0


    That depends on the subnet mask. For an IP address to be valid it must
    not be the broadcast address of the subnet and the address bitwise
    and-ed with the subnet mask must be non-zero. That is, for 192.168.1.0
    to be a valid address the third octet of the subnet mask must be less
    than 255.

    --
    Olof Lagerkvist
    ICQ: 724451
    Web: http://here.is/olof

  3. Re: 0 as the last octet in an IP

    So, the address would be valid if the netmask were 255.255.254.0, but
    not if it were 255.255.255.0?
    Why exactly is that? I know, for instance, 192.168.1.255 is reserved
    as the broadcast address for that subnet. But, what is 192.168.1.0
    reserved for?

    Thanks,
    PaulH

    On Apr 12, 3:43 pm, Olof Lagerkvist wrote:
    > PaulH wrote:
    > > Is 0 valid as the last octet in an IP address?

    >
    > > For instance: 192.168.1.0

    >
    > That depends on the subnet mask. For an IP address to be valid it must
    > not be the broadcast address of the subnet and the address bitwise
    > and-ed with the subnet mask must be non-zero. That is, for 192.168.1.0
    > to be a valid address the third octet of the subnet mask must be less
    > than 255.
    >
    > --
    > Olof Lagerkvist
    > ICQ: 724451
    > Web:http://here.is/olof




  4. Re: 0 as the last octet in an IP

    PaulH wrote:

    > So, the address would be valid if the netmask were 255.255.254.0, but
    > not if it were 255.255.255.0?
    > Why exactly is that?



    Because 192.168.1.0 & 255.255.255.0 = 0.0.0.0 (invalid, because it is
    zero) and 192.168.1.0 & 255.255.254.0 = 0.0.1.0 (valid, non-zero and not
    broadcast).

    > I know, for instance, 192.168.1.255 is reserved
    > as the broadcast address for that subnet. But, what is 192.168.1.0
    > reserved for?



    That is reserved as the network address.

    --
    Olof Lagerkvist
    ICQ: 724451
    Web: http://here.is/olof

  5. Re: 0 as the last octet in an IP

    If you're doing a bitwise 'and' there, I'm afraid I don't understand.
    If you 'and' 255.255.255.0 and 192.168.1.0, you would get 192.168.1.0,
    not 0.0.0.0.

    11111111.11111111.11111111.00000000 255.255.255.0
    & 11000000.10101000.00000001.00000000 192.168.1.0
    ---------------------------------------------------
    11000000.10101000.00000001.00000000 192.168.1.0

    I know the broadcast address is used to send to everybody on the
    subnet, but what is the 'network address' used for?

    Thanks,
    PaulH

    On Apr 13, 4:37 am, Olof Lagerkvist wrote:
    > PaulH wrote:
    > > So, the address would be valid if the netmask were 255.255.254.0, but
    > > not if it were 255.255.255.0?
    > > Why exactly is that?

    >
    > Because 192.168.1.0 & 255.255.255.0 = 0.0.0.0 (invalid, because it is
    > zero) and 192.168.1.0 & 255.255.254.0 = 0.0.1.0 (valid, non-zero and not
    > broadcast).
    >
    > > I know, for instance, 192.168.1.255 is reserved
    > > as the broadcast address for that subnet. But, what is 192.168.1.0
    > > reserved for?

    >
    > That is reserved as the network address.
    >
    > --
    > Olof Lagerkvist
    > ICQ: 724451
    > Web:http://here.is/olof




  6. Re: 0 as the last octet in an IP

    PaulH wrote:

    > If you're doing a bitwise 'and' there, I'm afraid I don't understand.
    > If you 'and' 255.255.255.0 and 192.168.1.0, you would get 192.168.1.0,
    > not 0.0.0.0.
    >
    > 11111111.11111111.11111111.00000000 255.255.255.0
    > & 11000000.10101000.00000001.00000000 192.168.1.0
    > ---------------------------------------------------
    > 11000000.10101000.00000001.00000000 192.168.1.0



    Yes you are right I did not think before I posted that...

    > I know the broadcast address is used to send to everybody on the
    > subnet, but what is the 'network address' used for?



    Any of the addresses on the subnet (even the broadcast address) bitwise
    and-ed with the subnet mask get the same network address, that is all
    bits zeroed out when and-ing with the subnet mask is 0 for the network
    address. This way two computers can do a quick calculation to find out
    if the are on the same network, that is their network address is the same.

    As you see the subnet mask here does not zero out any bits, that is the
    address checked is the same as the network address.

    11111111.11111111.11111111.00000000 255.255.255.0
    & 11000000.10101000.00000001.00000000 192.168.1.0
    ---------------------------------------------------
    11000000.10101000.00000001.00000000 192.168.1.0

    But take any valid address, say 192.168.1.8:

    11111111.11111111.11111111.00000000 255.255.255.0
    & 11000000.10101000.00000001.00001000 192.168.1.8
    ---------------------------------------------------
    11000000.10101000.00000001.00000000 192.168.1.0

    ....or 192.168.1.9

    11111111.11111111.11111111.00000000 255.255.255.0
    & 11000000.10101000.00000001.00001001 192.168.1.9
    ---------------------------------------------------
    11000000.10101000.00000001.00000000 192.168.1.0

    ....as you see, all of them get the same network address 192.168.1.0 so
    they are on the same subnet.

    But when the subnet mask is 255.255.254.0 the address 192.168.1.0 is not
    equal to the network address:

    11111111.11111111.11111110.00000000 255.255.254.0
    & 11000000.10101000.00000001.00000000 192.168.1.0
    ---------------------------------------------------
    11000000.10101000.00000000.00000000 192.168.0.0

    ....so therefore it is a valid address in that case.

    > Thanks,
    > PaulH
    >
    > On Apr 13, 4:37 am, Olof Lagerkvist wrote:
    >
    >>PaulH wrote:
    >>
    >>>So, the address would be valid if the netmask were 255.255.254.0, but
    >>>not if it were 255.255.255.0?
    >>>Why exactly is that?

    >>
    >>Because 192.168.1.0 & 255.255.255.0 = 0.0.0.0 (invalid, because it is
    >>zero) and 192.168.1.0 & 255.255.254.0 = 0.0.1.0 (valid, non-zero and not
    >>broadcast).
    >>
    >>
    >>>I know, for instance, 192.168.1.255 is reserved
    >>>as the broadcast address for that subnet. But, what is 192.168.1.0
    >>>reserved for?

    >>
    >>That is reserved as the network address.
    >>
    >>--
    >>Olof Lagerkvist
    >>ICQ: 724451
    >>Web:http://here.is/olof

    >
    >
    >



    --
    Olof Lagerkvist
    ICQ: 724451
    Web: http://here.is/olof

  7. Re: 0 as the last octet in an IP

    PaulH wrote:
    > Is 0 valid as the last octet in an IP address?
    >
    > For instance: 192.168.1.0
    >
    > Thanks,
    > PaulH
    >

    192.168.1.0 can be a valid host IP address _IF_ the subnet mask is at
    255.255.254.0 (or wider). With a default Class-C subnet mask
    (255.255.255.0), 192.168.1.0 would be the subnet address and
    192.168.1.255 would be the subnet broadcast.

    192 168 1 0
    11000000 10101000 00000001 [00000000] (brackets denote host portion)
    11111111 11111111 11111111 [00000000]
    255 255 255 0

    If perform a bitwise AND ([1 & 1 = 1], [0 & anything = 0] between the
    mask below and the IP address above, you'll see that the result is
    192.168.1.0. In fact, regardless of what the value of the last octet is,
    the bitwise AND result will be 192.168.1.0. By definition, any part of
    the address over a 1 in the mask is part of the subnet portion of the
    address and any part over a 0 in the mask defines the host. All 0's in
    the host portion of the address (regardless of the number of host bits)
    is the subnet address. All 1's in the host portion of the address is the
    broadcast address. If you change the mask to 255.255.254.0, you end up
    with one more host bit. In that case the network will be 192.168.0.0 and
    will include all of the IP addresses between 192.168.0.1 and
    192.168.1.254. 192.168.0.0 is the network address and 192.168.1.255 is
    the broadcast.

    192 168 1 0
    11000000 10101000 0000000[1 00000000] (brackets denote host portion)
    11111111 11111111 1111111[0 00000000]
    255 255 254 0

    Now, with the subnet mask extended by one bit, you can see that NOT all
    of the bits in the host portion of the IP address are zeros (the
    leftmost bit is a 1), so this is a valid host address.

    192 168 0 255
    11000000 10101000 0000000[0 11111111] (brackets denote host portion)
    11111111 11111111 1111111[0 00000000]
    255 255 254 0

    And in the IP address above, not all of the host bits are 1, so this is
    a valid host address, not a subnet broadcast. Does that make sense?

    ....kurt

+ Reply to Thread