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 184.108.40.206 and 220.127.116.11 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.
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.
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..
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.
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.
"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
18.104.22.168/8 and 22.214.171.124/8 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
126.96.36.199 falls in a different subnet than 188.8.131.52 ie,
252 means subnets go up in 4 so
184.108.40.206/6 -> 220.127.116.11 falls here
18.104.22.168/6 -> 22.214.171.124 falls here
126.96.36.199/5 -> 188.8.131.52
184.108.40.206/5 -> 220.127.116.11
0.0.0.0/4 -> 18.104.22.168
22.214.171.124/4 -> 126.96.36.199
0.0.0.0/3 -> 188.8.131.52 + 184.108.40.206
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 220.127.116.11 and 18.104.22.168 to be in the same subnet but none others as far as i can see.
Have i got this wrong ?
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.
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.
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.