0

Sorry if I'm using the wrong terminology. What I'm trying to ask is if it is safe to assume that IP addresses are from the same network if they differ only in the last octet?

  • 1
    Separating IP addresses into dotted-decimal octets is purely for ease of reading. Many people are lazy and break networks on octet boundaries, but the octets really have nothing to do with where the network boundaries really are. You must look at the mask or mask length to determine that. – Ron Maupin Jan 24 '17 at 18:33
  • 1
    What does "from the same network" mean to you? What is it precisely that you are asking us to tell you if it's safe to assume? – David Schwartz Jan 24 '17 at 19:09
  • There is no safe way to assume anything from groupings of IP addresses. The internet is classless and with ipv4 depletion, address spaces have been carved up and delegated many times. Even geo-ip databases are never entirely accurate from the moment they are published. One can only make assumptions using authentication. – Aaron Jan 24 '17 at 19:32
6

TLDR: You can't safely make that assumption. Use a subnetting tool like http://subnetmask.info to quickly check it out

A "network" is a combination of the IP address and the subnet mask. The subnet mask defines the "size" of the network. A rather commonly found network/mask size is 24-bits (255.255.255.0), in which case your thought would be correct and the first 3 octets determine the network while the last octet is the host.

I, on the other hand, frequently use different sized networks at my employment: One of my DMZ nets is 22-bit (255.255.252.0) in this case any of the 1022 address from 192.201.32.1-192.201.35.254 are all in the same network (note that the 3rd octet changes).

Another network for site-to-site VPN end points runs in a 28-bit (255.255.255.240) network; only the 14 address from 192.201.122.1-192.201.122.14 are in the same network. But 192.201.122.17 (same 3rd octet, in fact, only 2 numbers away) is not in that network.

0

Most of the time and it depends.

"Same network" is a term you have to define.

Look into subnetting and how a subnet can be in different ranges.

https://www.aelius.com/njh/subnet_sheet.html

You could f.ex easily have two VLANS (two different "networks") that are mapped to two /26 ranges in the same /24 subnet, which would immediately invalidate you hyphothesis.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.