Subnetting problem

Unanswered Question
Aug 11th, 2009
User Badges:

I don't know where exactly to start from. So instead, i will jump right on to the question.

Say you are being provided with 2 IP addresses, PC 1's IP address and PC 2's IP address, which are and respectively. You are required to find the subnet mask of these 2 PC's in such a way that both the PC's are in the same network.

Now my question to you is " is their any way (a decimal way) in which we can find a new subnet mask or prefix length for them. If this is all we are provided with"

PS: I know that there is a binary way in which you can find the prefix length or S.B mask, i want to know if there is any other way to find it.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
chinkevi_2 Tue, 08/11/2009 - 15:59
User Badges:

if they are live pc with those ip configured, and if they support icmp mask reply, you can do icmp ping mask request. but this icmp type is not supported or turned off by pc, and pretty much only available in unix/linux system.

otherwise, your best bet is to ask whoever provided the ip to check and give you the mask.

vishalprashar Tue, 08/11/2009 - 16:56
User Badges:

I am sorry but my question is a total hypothetical one.. I just wanted to know is there a way in which we can find out the prefix mask theoretically.. Please let me know in case you are ware of any method apart from the binary one..

Leo Laohoo Tue, 08/11/2009 - 17:08
User Badges:
  • Super Gold, 25000 points or more
  • Hall of Fame,

    The Hall of Fame designation is a lifetime achievement award based on significant overall achievements in the community. 

  • Cisco Designated VIP,

    2017 LAN, Wireless


JORGE RODRIGUEZ Tue, 08/11/2009 - 21:42
User Badges:
  • Green, 3000 points or more

As others stated you cannot tell a mask by simply looking at the ip address alone , at least if you were give a /9 or a /18 etc.. you can then know the prefix.. if this was a theory question to trick you I would probably place these ips in the class A network which falls under 1-to-126 therefore a /8 bit mask.


iyde Wed, 08/12/2009 - 12:06
User Badges:
  • Silver, 250 points or more

Well, if the requirement is to decide what subnet mask to put on the IP addresses to make them both to be in the same subnet, then the only way is a kind of "binay decimal". By this I mean that certain numbers are relatively easily remembered as matching certain masks.

You have IP addresses 17.x.x.x and 14.x.x.x and from that we can figure out how the most specific mask is.

As one person mentioned, if you use a /8 you would cover all 1.x.x.x to 127.x.x.x.

If you the go for a /9, you'd cover 1.x.x.x to 63.x.x.x; a /10 will give 1.x.x.x to 31.x.x.x etc.

From that we end up with the fact that a /11 would give 1.x.x.x to 15.x.x.x or 16.x.x.x to 31.x.x.x - which will put your two IP adresses in different subnets.

So in short, you'd have to use a /10 mask in order to put them in the same subnet.


Jon Marshall Wed, 08/12/2009 - 13:00
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN


"As one person mentioned, if you use a /8 you would cover all 1.x.x.x to 127.x.x.x."

Not sure i follow this. If you use a /8 then you can only use one class A network so and are in different networks not the same. To get them in the same network you need to use less than 8 bits not more or have i misunderstood ie.

you can't use 252, 248 or 240 because this means that falls in a different subnet than ie,

252 means subnets go up in 4 so -> falls here -> falls here

248 - -> ->

240 -> ->

224 -> +

so all we can say for sure is that the mask would have to be either

all of the above 3 subnet masks would allow and to be in the same subnet but none others as far as i can see.

Have i got this wrong ?


vishalprashar Wed, 08/12/2009 - 18:56
User Badges:

In fact John you are the only person who has got it right till yet.. I wanted to know is there any way, or is there any hard and fast rule that can be applied to this kind of problem.

I really need to know if there is any way, using the decimal numbers, in which these kind of problems can be solved.


Jon Marshall Thu, 08/13/2009 - 04:48
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN


As the others have said there is no way from just having 2 ip addresses to say what the subnet mask would be.

All i did was rule out what it couldn't be but with those 2 addresses there are still 3 possible masks ie.

and it's not possible to say which one it is.


fjcardenas-1 Thu, 08/13/2009 - 05:27
User Badges:

May be this can help:

If you see you have an ip starting in 14.X.X.X and another starting in 17.X.X.X, and you want them in the same subnet you have to figure out a range of addresses in which this addresses can fall.

Range starting in 0 to 7 - Doesn't contain the addresses.

Range starting in 0 to 15 - Contains only address starting in 14 but not the 17.

Range starting in 0 to 31 - Contains both addresses (14 and 17). So, from 0 to 31 you have 32 numbers. Subtract that number from 256 and you get 224. So 224 would be the exact mask you would need that contains addresses 14 and 17. But as John said.... masks 198 and 128 also can contain the 2 addresses.


This Discussion