[SOLVED] Subnetting Question

Terpinator

Reputable
Apr 12, 2017
84
2
4,565
Hello, I have a question on something I have run into during some studying. So far it has been explained like this:

I get a /24 and to subnet I borrow bits in the right direction. (so 11111111.11111111.11111111.00000000 --> 11111111.11111111.11111111.10000000)

Every example is always taking a /24 and making it a /26 , /27 , etc...

My question is am I able to go to the left instead? (For example take a /24 and make a /23? Or am I locked in depending on the original subnet mask/class?
 
Solution
This concept is more for splitting up public ips. For private ips you can change around your subnets freely. There are three different private ranges and each have a maximum CIDR. 192.168.0.0/16 is that entire range for example. You can't use /15 with that one. 10.0.0.0/8 is the largest block you can use.

if you bought a block of public ips you could sell portions of it. so if you purchase a block of /24 you can't go to /23 because it's more addresses than you own. you could lease lower sized blocks until you run out.

an example where it does help in private ips is if you had an extremely large organization. if you had different remote offices you could do something like 10.x.0.0/16 for each office. that would make your vpn routes...
This concept is more for splitting up public ips. For private ips you can change around your subnets freely. There are three different private ranges and each have a maximum CIDR. 192.168.0.0/16 is that entire range for example. You can't use /15 with that one. 10.0.0.0/8 is the largest block you can use.

if you bought a block of public ips you could sell portions of it. so if you purchase a block of /24 you can't go to /23 because it's more addresses than you own. you could lease lower sized blocks until you run out.

an example where it does help in private ips is if you had an extremely large organization. if you had different remote offices you could do something like 10.x.0.0/16 for each office. that would make your vpn routes easier to manage. even below that if you had hundreds of people in an office you could separate sections of your office up into subnets and make internal routing easier. your clients will be configured for /24 or so to keep layer2 minimal. this is more for forwarding packets to the right area and you won't see that much at home or a small business.
 
Last edited:
Solution

Terpinator

Reputable
Apr 12, 2017
84
2
4,565
Ok that makes sense. One follow up question. All of the text goes over really basic examples. From a conceptual standpoint would 128.0.0.0 (10000000.00000000.00000000.00000000) technically work as a subnet within a private LAN? Or are there some limitations?
 

Math Geek

Titan
Ambassador
nope, won't work.

remember you have some bits that are the network ID, then some more that are the subnetID , then the rest are the host ID. so 128.0.0.0 would only be enough bits to identify a network itself. any subnet info would have to be after that.
 
You can actually use any ip address you want on your lan. There are the ones reserved for private use but there is nothing saying you can't for example use blocks assigned to microsoft. All that happens is you would never be able to actually get to the actual IP on the internet because your local would over ride.

I know some companies that used block assigned to the military internally. Since most these are not even on the internet and even if they were you would never need to access them they are safe to use. These never leave your lan so nobody would know or care. Still there are so many private blocks there is little need to do this.

I doubt a 128.0.0.0 subnet would actually work on end devices. You start overlapping multicast and loopback ip block assignments. These are many times hard coded in devices.

Still a 128.0.0.0 subnet mask is actually used fairly commonly in a route. VPN use 2 routes 0.0.0.0 and 128.0.0.0 with as subnet mask of 128.0.0.0 to over ride the default route.

Most these larger masks are used for route summarization. This is still done to some extent to reduce the size or routing tables. This is where all the class a,b,c stuff came from but is not really used anymore. Most blocks have been broken into the minimum size accepted on the internet which is a /24. Routers have lots of memory and fast processors now days so they have little issue handling routing tables with lots of prefixes
 
  • Like
Reactions: TJ Hooker

Terpinator

Reputable
Apr 12, 2017
84
2
4,565
Ok cool. I am starting to get a much better understanding of it. Now if I make a /25 and have 2 subnets and 126 usable hosts per subnet. I get the first range is:

Net: 192.168.1.0
Range: 192.168.1.1 - 192.168.1.126
Bcast: 192.168.1.127

Now for the second subnet I run into something that wasn't explained. I calculate below:

Net: 192.168.1.128
Range: 192.168.1.129 - 192.168.1.255*) <------- This would make the broadcast for the 2nd subnet 192.168.2.0. Am I to cut the second subnet short by 1 host and end it at 192.168.1.254?
 

Math Geek

Titan
Ambassador
exactly. the last address is the broadcast address. you always have 2 less hosts than you think you should. first one is the subnet id and last one is broadcast. formula is 2^n -2 to account for this. this is why you don't use the .128 either as a host since it is the subnet id.

first subnet is the same as well. the .0 and .127 are not used for hosts. so your 128 possible hosts is actually 126 once you account for this. so you broke 256 possible hosts into 2 subnets so you lost 2 hosts each. 2 for the subnet id's and 2 for the broadcasts.

if you count em up you'll see you have 254 hosts possible with this mask. 126 per subnet
 

Terpinator

Reputable
Apr 12, 2017
84
2
4,565
Yeah I was just saying because the host range is 126 usable addresses. But when I put it into a subnet calculator to check my work, the range was 192.168.1.129 - 192.168.1.254 which is actually only 125 hosts. So it led me to believe that if the subnet is running into the .255 at the end, it cuts off x amount of hosts and uses the .255 as the broadcast address. Unless the calculator is assuming something and just confusing me.
 
Ok cool. I am starting to get a much better understanding of it. Now if I make a /25 and have 2 subnets and 126 usable hosts per subnet. I get the first range is:

Net: 192.168.1.0
Range: 192.168.1.1 - 192.168.1.126
Bcast: 192.168.1.127

Now for the second subnet I run into something that wasn't explained. I calculate below:

Net: 192.168.1.128
Range: 192.168.1.129 - 192.168.1.255*) <------- This would make the broadcast for the 2nd subnet 192.168.2.0. Am I to cut the second subnet short by 1 host and end it at 192.168.1.254?

simple math issue there. 128-255 is 128 addresses.

this tool is nice because it lets you type the ip/cidr
https://www.ipaddressguide.com/cidr
 

Math Geek

Titan
Ambassador
that's 126 hosts. you subtract the 2 numbers and then add one back to count em up.

254-129 = 125 + 1 = 126 :)

also note you have 256 possible even though you end at 255. this is because you actually count the .0 as an option. so 255 - 0 = 255 + 1 = 256.
 

Terpinator

Reputable
Apr 12, 2017
84
2
4,565
that's 126 hosts. you subtract the 2 numbers and then add one back to count em up.

254-129 = 125 + 1 = 126 :)

also note you have 256 possible even though you end at 255. this is because you actually count the .0 as an option. so 255 - 0 = 255 + 1 = 256.

Oh wow.... That's a facepalm. I started counting from 129 and did not include it. :/

So I guess the part I haven't really seen yet is when a subnet crosses the .255 boundary. Lets say I have a subnet that starts somewhere in 192.168.1.x but runs over 192.168.1.255. Would the subnet stop short and just use 192.168.1.255 as the broadcast? Or would it would it continue into 192.168.2.x?

Or the same if the final usable host lands on .255. Does that push the broadcast address into 192.168.2.0? Or does it just cut off the final host and make .=192.168.1.255 the broadcast?

PS: Sorry if these questions seem dumb or redundant. There just seems to be little nuances with subnetting that I haven't found the answer for yet.
 
Oh wow.... That's a facepalm. I started counting from 129 and did not include it. :/

So I guess the part I haven't really seen yet is when a subnet crosses the .255 boundary. Lets say I have a subnet that starts somewhere in 192.168.1.x but runs over 192.168.1.255. Would the subnet stop short and just use 192.168.1.255 as the broadcast? Or would it would it continue into 192.168.2.x?

Or the same if the final usable host lands on .255. Does that push the broadcast address into 192.168.2.0? Or does it just cut off the final host and make .=192.168.1.255 the broadcast?

PS: Sorry if these questions seem dumb or redundant. There just seems to be little nuances with subnetting that I haven't found the answer for yet.
It's always the first and last that aren't usable for hosts. the last being the broadcast. 255 can't be the last usable host. There isn't a CIDR range that ends on .0 excluding /32.
 
Last edited:

Math Geek

Titan
Ambassador
first address is subnet id, last one is broadcast no matter how they fall. so crossing "the boundary" like you say does not change this.

i'm still learning all this myself as well. math is my thing so this is easier for me than for some but it is rather tricky at times. my eyes crossed first time i saw variable subnetting. but the basic subnetting is pretty easy now that i've seen it a number of times and practiced it.