|
-
Sep 21st, 2009, 01:46 PM
#1
Subnetting
Most of the places I have worked at have had the bog standard class C subnet (subnet mask 255.255.255.0) so you just have one subnet with up to 254 hosts, e.g 192.168.20.1 - 192.168.20.254.
However, somewhere I went to today had the following subnet mask (which is still class C apparently) : 255.255.254.0
Now I'm no expert at subnetting etc but I am keen to learn so I have been trying to find out for myself what advantage this gives you over a 255.255.255.0 subnet mask. So I did a bit of reading up just now on how subnet mask's work and I'm still a bit puzzled.
Apparently when you convert a subnet mask down to binary then all of the bits that are set (ie have a 1 in them) represent the network part of the subnet, and the bits that are not set (ie are 0) represent the host part.
So in as 255 converts to 11111111 in binary then that means 255.255.255.0 has all of the first 3 octets set to 1s (network) and the last octet is for the host, which is fine and makes sense.
e.g
Code:
255 255 255 0
11111111 11111111 11111111 00000000
However, when I converted 255.255.254.0 to binary (maybe I did it wrong), it gives me this:
Code:
255 255 254 0
11111111 11111111 11111110 00000000
and as that last bit in the 254 part that is set to 0 is only capable of representing a 1 (as opposed to 2, 4, 8, 16, 32 etc) then does that mean that this subnet mask can only have 2 subnets in it or what? I dont quite understand what its telling me... I know they have at least two subnets running at the moment (192.168.10.X and 192.168.11.X) but are they the only possible subnets they could have? I doubt that but from looking at the bits I would have thought they couldnt even have those ones that they have got... so I obviously am missing something 
Can anyone explain at all? 
Thanks
Chris
Last edited by chris128; Sep 21st, 2009 at 01:53 PM.
-
Sep 21st, 2009, 02:17 PM
#2
Re: Subnetting
The subnet 255.255.254.0 applied to the class C address 192-223 is invalid.
The first 3 bytes of class C address represent the network:
nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh
This means that highest bit order that the subnet portion may occupy is bit 8 of the last byte:
nnnnnnnn.nnnnnnnn.nnnnnnnn.shhhhhhh
This will give two subnets, in the case of 192.168.10.x
Subnet 1: 192.168.10.128
Subnet 2: 192.168.10.0
Each subnet would have a total of (2^6)-1 = (126) hosts:
Subnet 1: 192.168.10.129 - 192.168.10.254
Subnet 2: 192:168.10.1 - 192.168.10.126
The subnet 255.255.254.0 can only ever apply to a class B network. In that instance it would be as follows:
nnnnnnnn.nnnnnnnn.sssssssh.hhhhhhhh
The machine will simply interpret 192.168.10.x and 192.168.x as two addresses in different networks and ignore the subnet bit. The network admin who looks after that network is clearly needs to read up on networking
Last edited by visualAd; Sep 21st, 2009 at 02:23 PM.
-
Sep 21st, 2009, 02:40 PM
#3
Re: Subnetting
Thanks for the reply Can you just clarify a few things for me?
1. What does the s stand for in your examples? Im guessing n is for network and h is for host.
2. So the network must be class B then, but I still dont understand how the subnet mask works. Whats the difference between having 255.255.0.0 and 255.255.254.0 if both are class B? I assume the latter gives you less usable addresses but why would you want to do that and not just have more available addresses by using 255.255.0.0 instead?
3. Could you give me an example of which addresses are actually available with that subnet mask (255.255.254.0) and if possible explain how you worked it out? As you can see from my original post, I can work out the binary representation of the subnet but then I dont understand how that actually applies to which addresses you can have in each octet. From my workings out I would have thought as the least significant bit is the only bit not set by the subnet mask then that only gives them 1 address in that octet that can be used for the host, but then that seems pointless and cant be right.
4. I dont understand the point of having two subnets that are both in the same range (ie 192.168.10.X) but just occupy different parts of the scope. I mean what advantage do you have if you've got 2 subnets, one that does 192.168.10.1 - 126 and one that does 126 - 254 when compared to just having one subnet that does 1 - 254 ? I cant see why you would ever want to have the management overhead of having 2 instead of just the 1 as you are getting the exact same amount of usable host addresses out of either option arent you?
The network admin who looks after that network is clearly needs to read up on networking
I guess it seems like that but he is actually pretty good and knows his stuff. He has transformed the terrible network there into something usable and well managed with fibre links, layer 3 managed switches, and all sorts. They had all sorts of problems before he got there but now the network runs really fast and with no problems (no he hasnt just stuck fibre in everywhere ), so he cant be that daft.
EDIT: Just found this: http://www.subnet-calculator.com/cidr.php and if I put that subnet mask into there and an IP of 192.168.10.0 then it does indeed give me the only available subnets 192.168.10.X and 192.168.11.X so I guess I was kind of right with my initial thought that they could only have two subnets, one with a 0 at the end and one with a 1 at the end but I'm still quite confused. How does using this CIDR format rather than using classes (class A, B, C etc) actually make a difference to what addresses you can use? Surely the subnet mask means the same thing to the device that is trying to communicate across the network no matter what kind of format you think you are working in...
Last edited by chris128; Sep 21st, 2009 at 03:56 PM.
-
Sep 21st, 2009, 03:56 PM
#4
Re: Subnetting
 Originally Posted by chris128
1. What does the s stand for in your examples? Im guessing n is for network and h is for host.
n = network
s = subnet(work)
h = host
2. So the network must be class B then, but I still dont understand how the subnet mask works. Whats the difference between having 255.255.0.0 and 255.255.254.0 if both are class B? I assume the latter gives you less usable addresses but why would you want to do that and not just have more available addresses by using 255.255.0.0 instead?
It is important to make the distinction between a network and a subnet. The IPv4 addressing system has 4 classes of network. These are identified by the number of high order bits set to 1 in the first byte of the address:
0nnnnnnn = Class A (1 - 127)
10nnnnnn = Class B (128 - 191)
110nnnnn = Class C (192 - 223)
1110nnnn = Class D (224 - 254)
By reading the first 4 bis of an address the network portion of the address can be quickly identified. I.e. class A, first byte, class C, first 3 bytes. The routers that form the Internet backbones care little for the subnet mask and will use these prefixes to quickly identify and route packets to the correct location.
Subnets allow you to further break down the address and set aside more bits for the network portion of the address. A class A metwork for example will allow you to have (2^24)-1 hosts (anyone silly enough to put that many hosts on a single Ethernet network with no routers deserves what's coming to them).
For this reason, it is often desirable to have many networks connected by routers. Instead of purchasing many Class A, B or C address ranges and to avoid the phenomenal waste, the subnet allows host bits in an address to be reserved for networks. ISPs for example often have class A network addresses but may assign ranges in subnets of 255.255.255.248 to small businesses and ranges in subnets of 255.255.0.0 for very large businesses.
 Originally Posted by chris128
3. Could you give me an example of which addresses are actually available with that subnet mask (255.255.254.0) and if possible explain how you worked it out? As you can see from my original post, I can work out the binary representation of the subnet but then I dont understand how that actually applies to which addresses you can have in each octet. From my workings out I would have thought as the least significant bit is the only bit not set by the subnet mask then that only gives them 1 address in that octet that can be used for the host, but then that seems pointless and cant be right.
The subnet mask 255.255.254.0 can also be expressed as x.x.x.x/23 as the network portion occupies 23 bits of the total address. As the name suggests, when you bitwise AND the mask with an address, you are left with the sub-network portion of the address. When you bitwise NAND the address, you are left with the network portion.
Code:
255 . 255 . 254 . 0
11111111.11111111.11111110.00000000 185 . 207 . 18 . 0
AND 10111001.11001111.00010010.00000000 (network address)
185 . 207 . 19 . 132
10111001.11001111.00010011.10000100
255 . 255 . 254 . 0
11111111.11111111.11111110.00000000 0 . 0 . 1 . 132
NAND 00000000.00000000.00000001.10000100 (host address)
185 . 207 . 19 . 132
10111001.11001111.00010011.10000100
The number of possible subnets for the mask 255.255.255.254 in a Class B address can be calculated as the number of permutations the "s" portion of the address can assume. In this case there are seven bits (each can assume one of two values):
nnnnnnnn.nnnnnnnn.sssssssh.hhhhhhhh : 2^7 = 128
The number of possible hosts is calculates by finding the total permutations of the host bits:
nnnnnnnn.nnnnnnnn.sssssssh.hhhhhhhh : 2^9 = 510 (excludes network and broadcast addresses)
So to demonstrate the ranges:
Code:
255 . 255 . 254 . 0
11111111.11111111.11111110.00000000 (subnet mask)
185 . 207 . 18 . 0
10111001.11001111.00010010.00000000 (network address - all host bits 0)
185 . 207 . 18 . 1
10111001.11001111.00010010.00000001 (start of host range)
185 . 207 . 19 . 254
10111001.11001111.00010011.11111110 (end of host range)
185 . 207 . 19 . 255
10111001.11001111.00010001.11111110 (broadcast address - all host bits 1)
 Originally Posted by chris128
4. I dont understand the point of having two subnets that are both in the same range (ie 192.168.10.X) but just occupy different parts of the scope. I mean what advantage do you have if you've got 2 subnets, one that does 192.168.10.1 - 126 and one that does 126 - 254 when compared to just having one subnet that does 1 - 254 ? I cant see why you would ever want to have the management overhead of having 2 instead of just the 1 as you are getting the exact same amount of usable host addresses out of either option arent you?
The IP protocol forms and important part of the seven layer OSI model and the TCP/IP stack. It is responsible ensuring the efficient delivery of data between two points; think of it like a postal network.
The host part of IP addresses identify the house number, the subnet identifies the city and the class identifies the country. Each part of the address is used at different levels to send the data in the correct direction; if I am a postal worker in the UK and I see a letter addressed to a location in the US, then I simply forward it on to a US postal office who might know where to send it next. The same is true for IP addresses, routers are the postal worker who work to certain rules (routing protocols). Routers form the boundary between two networks / subnets and allow you to break a network down logically; it also allows you to tailor your security policies more easily by effectively isolating traffic from each network while allowing them to share a common route to the Internet.
Without the use of subnets, it would be a bit like trying to deliver a letter in a country that has no town, city or road names, only house numbers from 1 to 50,000000 (good luck ) There is good reason for having two subnets, one might be a LAN and the other might be a DMZ network which has no communication with the internal LAN.
 Originally Posted by chris128
I guess it seems like that but he is actually pretty good and knows his stuff. He has transformed the terrible network there into something usable and well managed with fibre links, layer 3 managed switches, and all sorts. They had all sorts of problems before he got there but now the network runs really fast and with no problems (no he hasnt just stuck fibre in everywhere  ), so he cant be that daft.
I still wouldn't consider myself knowledgeable enough to run a network any larger than my home network. I also wouldn't consider myself stupid enough to even contemplate the idea; so I congratulate your network admin on a job well done.
Last edited by visualAd; Sep 21st, 2009 at 04:13 PM.
-
Sep 21st, 2009, 03:57 PM
#5
Re: Subnetting
Just about to read your reply but just to let you know, I edited my post just as you posted that. Here's what I added:
EDIT: Just found this: http://www.subnet-calculator.com/cidr.php and if I put that subnet mask into there and an IP of 192.168.10.0 then it does indeed give me the only available subnets 192.168.10.X and 192.168.11.X so I guess I was kind of right with my initial thought that they could only have two subnets, one with a 0 at the end and one with a 1 at the end but I'm still quite confused. How does using this CIDR format rather than using classes (class A, B, C etc) actually make a difference to what addresses you can use? Surely the subnet mask means the same thing to the device that is trying to communicate across the network no matter what kind of format you think you are working in...
PS, should the third octet in this example be 16?
Code:
185 . 207 . 18 . 1
10111001.11001111.00010000.00000001 (start of host range)
I thought it went 1, 2, 4, 8, 16, 32, 64, 128
I guess I've done it the wrong way round but even so, I didnt think it was possible to get 18 from just setting 1 bit?
Last edited by chris128; Sep 21st, 2009 at 04:04 PM.
-
Sep 21st, 2009, 04:05 PM
#6
Re: Subnetting
You need the subnet tool:
http://www.subnet-calculator.com/
CIDR: Classless inter domain routing is designed to enable you to express a range of addresses using IP/MASK notation for purposes of access control and routing.
-
Sep 21st, 2009, 04:10 PM
#7
Re: Subnetting
 Originally Posted by visualAd
You need the subnet tool:
http://www.subnet-calculator.com/
CIDR: Classless inter domain routing is designed to enable you to express a range of addresses using IP/MASK notation for purposes of access control and routing.
Yeah but what I'm saying is that on that classful version it wont let me provide 255.255.254.0 with a 192.168.10.X range, where as on the CIDR version it does and it matches what they have got in place (192.168.10 and 192.168.11) but just saying it uses CIDR doesnt change the way it actually works does it?
-
Sep 21st, 2009, 04:12 PM
#8
Re: Subnetting
 Originally Posted by chris128
Just about to read your reply but just to let you know, I edited my post just as you posted that. Here's what I added:
PS, should the third octet in this example be 16?
I thought it went 1, 2, 4, 8, 16, 32, 64, 128
I guess I've done it the wrong way round but even so, I didnt think it was possible to get 18 from just setting 1 bit?
I'll correct that: the binary should read: 00010010
-
Sep 21st, 2009, 04:15 PM
#9
Re: Subnetting
 Originally Posted by chris128
Yeah but what I'm saying is that on that classful version it wont let me provide 255.255.254.0 with a 192.168.10.X range, where as on the CIDR version it does and it matches what they have got in place (192.168.10 and 192.168.11) but just saying it uses CIDR doesnt change the way it actually works does it?
I might be wrong, but I a do not think that you can set IP addresses based on a CIDR range. The reason the subnet mask is not available is because it is not a valid class C subnet mask.
-
Sep 21st, 2009, 04:16 PM
#10
Re: Subnetting
I just found this as well:
CIDR Notation
CIDR specifies an IP address range using a combination of an IP address and its associated network mask. CIDR notation uses the following format - xxx.xxx.xxx.xxx/n
xxx.xxx.xxx.xxx/n
where n is the number of (leftmost) '1' bits in the mask.
For example, 192.168.12.0/23 applies the network mask 255.255.254.0 to the 192.168 network, starting at 192.168.12.0. This notation represents the address range 192.168.12.0 - 192.168.13.255. Compared to traditional class-based networking, 192.168.12.0/23 represents an aggregation of the two Class C subnets 192.168.12.0 and 192.168.13.0 each having a subnet mask of 255.255.255.0. In other words, 192.168.12.0/23 = 192.168.12.0/24 + 192.168.13.0/24
Even more confused now.. I get the first part but the example and the explanation afterwards confuses me because thats saying that using this CIDR notation does actually change the way things work but it cant do if its just a 'notation'... I mean I did an IPCONFIG on my PC when I was there and it showed the subnet mask as 255.255.254.0 so that must accomplish the same thing, but then I dont get how they can have 192.168.12.0 - 13.255 when the place I went to had 192.168.10.0 - 11.255 by the look of things
Last edited by chris128; Sep 21st, 2009 at 04:19 PM.
-
Sep 21st, 2009, 04:19 PM
#11
Re: Subnetting
Its the same concept as working out a subnet.
-
Sep 21st, 2009, 04:21 PM
#12
Re: Subnetting
but I thought you said applying that 255.255.254.0 subnet mask to a 192.168 subnet would not work properly and would mean that devices just treated 192.168.10.x and 192.168.x.x as being on different networks
How CIDR Works
CIDR implementations require certain support be embedded within the network routing protocols. When first implemented on the Internet, the core routing protocols like BGP (Border Gateway Protocol) and OSPF (Open Shortest Path First) were updated to support CIDR
That suggests to me that you have to actually choose to use CIDR on your network and that it then operates differently to if you had just used regular subnet classes?
Last edited by chris128; Sep 21st, 2009 at 04:26 PM.
-
Sep 21st, 2009, 04:34 PM
#13
Re: Subnetting
Code:
11000000.10101000.0000101||0.00000000 (192.168.10.0)
11111111.11111111.1111111||0.00000000
11000000.10101000.0000101||1.11111111 (192.168.11.255)
11111111.11111111.1111111||0.00000000
I've tried to show the cut off point. They a considered to be in the same CIDR range given by the mask 255.255.254.0; again, I am not sure that windows would treat these as two different networks or one network, easiest way is to test
Last edited by visualAd; Sep 21st, 2009 at 04:35 PM.
Reason: Wroong way - getting tired.
-
Sep 21st, 2009, 04:49 PM
#14
Re: Subnetting
So could the first part of that third octet be anything as the subnet mask covers all of those bits apart from the very last one?
e.g 192.168.27.0 - 192.168.28.255
or even
192.168.245.0 - 192.168.246.255
?
-
Sep 21st, 2009, 05:07 PM
#15
Re: Subnetting
Yes, pretty much. The boundary is bit 23; and each host address range spans two class C networks.
-
Sep 21st, 2009, 05:12 PM
#16
Re: Subnetting
Right, it spans two class C networks but the actual subnet itself would be a class B network right (so when the network admin said it was class C he wasnt really completely wrong)? and it would be written as 192.168.10.0 /23 rather than saying 192.168.10.0 /24 and 192.168.11.0 /24
I found this just now as well, for anyone else who is trying to learn the same thing as me: https://cisco.hosted.jivesoftware.co...%20Forever.pdf
Its in a bit of an annoyingly childish format but at least it keeps it simple.
Last edited by chris128; Sep 21st, 2009 at 05:24 PM.
-
Nov 6th, 2010, 08:01 AM
#17
Re: Subnetting
While looking for something else I stumbled upon this old thread, and decided to reply.
The most important point is that today's networks are classless (the C in CIDR), but most networking professionals understand that when you say Class A, B, or C, you mean /8, /16, or /24. There are certain instances that a default mask will be provided as a starting point based on the old classful rules. An example of that is when you configure the IP address on windows.
The best practice today is to make a statement such as, "My network is 192.168.10.0 /23".
Here is 192.168.10.0 /22 (NOTE 22) subnetted, which means that 192.168.8.0 /22 is the super-net of all of the following:
Code:
Network Net Broadcast CIDR Mask UsableHosts
192.168.8.0 192.168.9.255 23 255.255.254.0 510
192.168.10.0 192.168.10.255 24 255.255.255.0 254
192.168.11.0 192.168.11.127 25 255.255.255.128 126
192.168.11.128 192.168.11.191 26 255.255.255.192 62
192.168.11.192 192.168.11.223 27 255.255.255.224 30
192.168.11.224 192.168.11.239 28 255.255.255.240 14
192.168.11.240 192.168.11.247 29 255.255.255.248 6
192.168.11.248 192.168.11.251 30 255.255.255.252 2
192.168.11.252 192.168.11.255 30 255.255.255.252 2
You should also note that 192.168.8.0 /22 is the base network.
Going back to the original, 192.168.10.0 /23...
The network number is 192.168.10.0. The IPv4 directed broadcast is 192.168.11.255. The usable hosts are
192.168.10.1 - 192.168.11.254. If you split it into 4 equal parts(subnet it) it looks like this:
Code:
Network Net Broadcast CIDR Mask UsableHosts
192.168.10.0 192.168.10.127 25 255.255.255.128 126
192.168.10.128 192.168.10.255 25 255.255.255.128 126
192.168.11.0 192.168.11.127 25 255.255.255.128 126
192.168.11.128 192.168.11.255 25 255.255.255.128 126
Last edited by dbasnett; Nov 6th, 2010 at 08:13 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|