# Are these two addresses in the same subnet?

Senior MemberMember Posts: 273 ■□□□□□□□□□
Are these two addresses in the same subnet?

192.168.0.23/22

192.168.3.250/22

?

Both are class C addresses that would by default use a subnet mask of 255.255.255.0, which is a prefix of /24. Normally when "subnetting", a larger-than-default prefix is used, simply to allow more bits for subnets (and hence less for hosts). Your class C address with a prefix /22, however, is an example of "supernetting", in which multiple class C networks are combined into a single supernet. You can read more about the math involved in my subnetting guide here but in this case, to a practiced subnetting-eye, it might become somewhat obvious they are in the same subnet (supernet technically) because stealing one network bit (e.g. using /23 instead of /24) results in double the amount of hosts.

By default 192.168.0.23/24 would be in the range 192.168.0.1 - 192.168.0.254
with a prefix of /23 it would be in the range 192.168.0.1 - 192.168.1.254
stealing another bit doubles that again, so with /22 it would be in the range, from 192.168.0.1 - 192.168.3.254 (which as you can see includes both your example addresses)
/21, from 192.168.0.1 - 192.168.7.254
/20, from 192.168.0.1 - 192.168.15.254
and so on.

IP Subnet Calculator
• Member Member Posts: 94 ■■□□□□□□□□
This is how I determine whether an IP address is acceptable given a certain subnet. I remember that an IP address is 32 bits and that the number after the forward slash represents the number of 1's (left to right) in the 32 bits. With your address that has a /22, that means it must have 10 0's (right to left) at the end to complete the 32 bits of the address. I also know that each number separated by dots in an IP address is 8 bits long. When you have 10 0's at the end that means it fills the last group of 8 binary digits and enters the third group of 8 binary numbers by two. Two binary digits can produce the numbers 0, 1, 2, & 3. Therefore the third number of your IP address can be any of those numbers and be valid for your subnet of /22.
• Registered Member Member Posts: 1,588
DoubleD wrote: »
Are these two addresses in the same subnet?

192.168.0.23/22

192.168.3.250/22

?

No.

Another way this can be asked is "Are these two addresses in the same network?"

In other words, one computer has an IP of 192.168.0.23/22 and another computer on the same network is manually assigned an address of 192.168.3.250. Can they communicate with each other? No.

192.168.0.23/22 has a network ID of 192.168.0.0
192.168.3.250/22 has a network ID 192.168.3.0

TCP/IP looks at the source and destination IP address to determine if the destination address is on the local network, or if it needs to be sent to the default gateway to be routed to a different network. In this case, the network IDs are different so the traffic would need to be routed through the default gateway.

HTH,
• Junior Member Users Awaiting Email Confirmation Posts: 23 ■□□□□□□□□□
Darril wrote: »
No.
192.168.0.23/22 has a network ID of 192.168.0.0
192.168.3.250/22 has a network ID 192.168.3.0

You are incorrect, the network address for 192.168.0.23/22 is 192.168.0.0, this is also the network address for 192.168.3.250/22.
• Registered Member Member Posts: 1,588
nbeacham wrote: »
You are incorrect, the network address for 192.168.0.23/22 is 192.168.0.0, this is also the network address for 192.168.3.250/22.

Good catch. Thanks. That's what I get for doing it in my head and not verifying it with a little math.

192.168.0.23/22 has a network ID of 192.168.0.0
192.168.3.250/22 has a network ID 192.168.0.0

/22 is using the first six bits in the third octect
0 = 0000 00xx
3 = 0000 00xx

DoubleD wrote: »
Are these two addresses in the same subnet?

192.168.0.23/22

192.168.3.250/22

?

Yes.
• Member Member Posts: 94 ■■□□□□□□□□
Darril, when you wrote what you did in your initial post, I was starting to question myself and was just about to read through subnetting again to get it straight. God knows, I wouldn't question the correctness of your posts. I don't know nearly enough to start doing that yet. Thank God someone else has the guts to do it. I feel much better now.

BTW, nice job nbeacham!
• Senior Member Member Posts: 124
A very simple way to view this (at least for me) is like this. Basically a /24 is 256 addresses (i included both subnet and broadcast addresses for this example) and every time you decrease the network id you double your range.

etc, etc...

In the same way you now know that 192.168.0.0/24 is 192.168.0.1 through 192.168.0.254 so what about the others?

Think about it like this, by using a /23 you're really just taking two back-to-back /24's and adding them together!

/24 = 192.168.0.1 - 192.168.0.254 (1 /24s)
/23 = 192.168.0.1 - 192.168.1.254 (2 /24s)
/22 = 192.168.0.1 - 192.168.3.254 (4 /24s)
/21 = 192.168.0.1 - 192.168.7.254 (8 /24s)

If you view them like this you shouldn't have to do any math to figure it out...

The same holds true when we go in the opposite direction (e.g. /24, /25, /26, etc) The only difference is now we are cutting them in half

For me thinking about them in doubles means I don't have to think about it!

HTH

While no trees were harmed in the transmission of this message, several electrons were severely inconvenienced
:cool:
• Senior Member Member Posts: 273 ■□□□□□□□□□
The way i look at it is this.
I would say that YES they are on the same subnet.
How do I know ? By looking at the end it says /22 on both. Therefore they should both be on the same sub net.
• Senior Member Member Posts: 124
DoubleD wrote: »
How do I know ? By looking at the end it says /22 on both. Therefore they should both be on the same sub net.

DoubleD that's a very incorrect way to approach this problem. For example, if I asked you if the following two addresses are in the same subnet, what would you tell me?

192.168.1.0/24
192.168.2.0/24

Are they on the same subnet? Using your logic they must be since they are both /24's...

Likewise just because these two addresses have /22's isn't enough for you to say they're on the same subnet, but why?

Because I could have 192.168.0.0/22 which will encompass 192.168.0.1 - 192.168.3.254 (which is 4 /24s)

Right?

So using your logic 192.168.4.33/22 must also be in the same subnet as the other two (192.168.0.23/22 & 192.168.3.250/22), right?

Wrong...

Read my post above on how to calculate these and it will make sense, a /22 is only 4 back-to-back /24's

So 192.168.4.0/22 is a completely different subnet encompassing the next 4 /24's which is 192.168.4.1 - 192.168.7.254

So just because they both have /22's doesn't mean they are in the same subnet...

While no trees were harmed in the transmission of this message, several electrons were severely inconvenienced
:cool:
• Senior Member Member Posts: 4,024
DoubleD wrote: »
The way i look at it is this.
I would say that YES they are on the same subnet.
How do I know ? By looking at the end it says /22 on both. Therefore they should both be on the same sub net.