Determining if two IP adresses are on same subnet - is it leading or trailing 0s get dropped from IP address?

前端 未结 3 799
你的背包
你的背包 2021-01-01 07:59

I understand if two IP addresses are AND\'d with a subnet mask if the result is the same then they are on the same network. If the result is different then they are on diffe

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-01 08:39

    Despite the fact that it's a rather odd question, I'll try answering your specific query:

    The number '1' in that second octet is really a number 1, and therefore it's '001', not '100'.

    That said, your example should have worked, so I suspect there's something wrong with your implementation. You should not need to worry about padding or anything. These are numbers, and bitwise-AND should "just work".

    You might want to provide more detail about what is going wrong.

提交回复
热议问题