subnetting and supernetting: what is it and how does it work.

Discussion in 'Network Infrastructure' started by Tinus1959, Dec 9, 2008.

  1. Tinus1959

    Tinus1959 Gigabyte Poster

    1,539
    42
    106
    Hi there,

    As promised here the thread on subnetting and supernetting. I will do this in a number of posts, because the subject is to big for a single post. I'll have to do this in the spare time I have during work and at home, but with the wife having a broken ankle that spare time is limited. I would like to ask you not to start a big discussion on the posts in this thread untill I am finished. Off course, if something is unclear, feel free to ask.

    Have fun!

    Martien
     
    Certifications: See my signature
    WIP: MCSD, MCAD, CCNA, CCNP
  2. Tinus1959

    Tinus1959 Gigabyte Poster

    1,539
    42
    106
    In this first post I would like to show you what an IP-address is. An IP-address is a 32 bit, software coded address for a network device, unique for a network. This is opposite to for instance an ethernet address, which is mostly hard coded, that is in the chips on the networkcard.
    It is unique for the network: as long as you are not on the internet, you could use any IP address you would like. Even if you are connected to the internet, you could use an address internally that could be used by other users as well. The free ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (I'll explain this in a later post) are examples of ip-addresses which are use over and over again.
    An IP address is 32 bits. The way we most of the time see IP-addresses in the form w.x.y.z is just a form, a notation. It is not crusual for an IP address. The address 207.46.192.254 is connected to www.microsoft.com, but if you would transform this into a decimal form, your browser would not have any problems with it. The decimal form is 3475947774 so try this: http://3475947774 and press enter. You will end up on the homepage of microsoft. (at least in internet explorer. Did not check firefox). Your browser does not care how the address is given. In fact the computer itself works with only binairy number and that is how the number is interpreted. For the browsers sake you could also give the number in binairy, hexadecimal, octal or what ever, as long as it is clear for the browser what type of 'coding' you use. It recognizes that you work in 'dotted decimal' because you entered that form.

    OK, we now know what an IP address is, we could make a list of all IP addresses, starting with the very first (0.0.0.0) up to the very last (255.255.255.255). The list would contain more than 4 billion addresses.

    Now first we go explore classfull addressing. The smart guys back in the early 70's did not give out the IP addresses at random. They made groups of addresses, so called classes. Lets look at a smaller list of binairy numbers to get the feeling of what happens.
    0000
    0001
    0010
    0011
    0100
    0101
    0110
    0111
    1000
    1001
    1010
    1011
    1100
    1101
    1110
    1111

    Notice that the red block and the blue block are exactly the same. The only difference is that the red block has a leading 0 and the blue block has a leading 1.
    So just looking at the first bit give you the information if you are in the first half or in the second half of the complete block.
    This same devicion is made in the IP addresses. It is simply split in two halves, the first part having the first bit a 0, the second half starts with a 1. The first half is called the A-class, the second is split again.
    Here is the second half after the second split.

    1000
    1001
    1010
    1011
    1100
    1101
    1110
    1111

    You see that now the second bit is the decider? So first bit a 1 and second bit a 0: that's a B class address.
    Split the remainder again. 110 is a C Class.
    Split again 1110 is a D Class and last: 1111 is a E Class.

    So A class takes 50% off the addresses, B class takes 25%, C class takes 12.5% and D and E class take 6.25% each.

    That's it for the first post. Have to get back to work.
    More to come.
     
    Certifications: See my signature
    WIP: MCSD, MCAD, CCNA, CCNP
  3. Tinus1959

    Tinus1959 Gigabyte Poster

    1,539
    42
    106
    So now we know how to determine in what class an address is. What does this tell us? It works a bit like most telephone systems. Big cities have a small area code, middle range cities have a slitely longer area code and small towns have an even longer area code. I'll take the Dutch system as an example. Our 'big' cities have a 3 digit code, so in theory we could address 1000 cities with this (000 - 999). Because all (normal) telephone numbers are 10 digits, we have 7 left for the clients (hosts). The somewhat smaller cities have 4 digits so in theory we could address 10,000 places with this (but the first 1000 are allready given away, so it is less) and we have 6 digits left for the clients.
    For the small town we use 5 digits for the area code and also 5 for the clients.

    It works the same with IP. The A class is for big spenders, the B class is for midrange and the C class is for small companies.
    Now for a mnemonic:
    A class: 1 bit for class ID, 1 octet for network ID.
    B class: 2 bits for class ID, 2 octets for network ID.
    C class: 3 bits for class ID, 3 octets for network ID.

    This brings us a big step closer to the point we want to be, because now we can do some calculations!

    In total we have 32 bits and we know howmany we have spend on network ID, so we can calculate howmany is left for the clients.
    A class: 8 bits for the network.
    From these 8 bits is 1 used as class ID, so we have 7 bits left for the real network.
    That gives us 2^7 = 128 networks (I know, some are not valid, but we will come to that later).
    We have 32 - 8 = 24 bits for the clients which gives us a total number of more than 16 million clients per network.

    B class: 16 bits for the network.
    From these 16 bits are 2 used as class ID, so we have 14 bits left for the real network.
    That gives us 2^14 = roughly 16,000 networks.
    We have 32 - 16 = 16 bits for the clients which gives us a total number of more than over 64,000 clients per network.

    C class: 24 bits for the network.
    From these 24 bits are 3 used as class ID, so we have 21 bits left for the real network.
    That gives us 2^21 = roughly 2 million networks.
    We have 32 - 24 = 8 bits for the clients which gives us a total number of more than over 256 addresses per network.

    Intermezzo
    In oktober 1992 technicians realized that the vast number of IP-addresses was getting depleted. They had to find ways to save addresses. A number of possibilities where opted. Some proposals made it, others did not. We all know (or at least heard of) CIDR, NAT and IPv6. There was however a very unusual proposal in where some parts of the C Class would be subclassed again to give an F class, G class, H class and K class. For more details on this proposal see http://www.rfc-editor.org/rfc/rfc1375.txt


    In a telephone number, the separator between the area code and the client number is sometimes a small dash. The same works for IP-addresses.
    To indicate what part of the address was the network part and what part was the host part they invented the sub net mask. This can be seen as a digital dash in an IP-address. The sub net mask is a number containing a number of 1s, followed by a number of 0s. The number of 1s is the number of bits used for the network ID. The number of 0s is the number of bits used for the host part.
    So an A class has a SNM 255.0.0.0,
    B class has a SNM of 255.255.0.0
    and a C class has a SNM of 255.255.255.0.

    We still have a problem, but I will address that tomorrow.
     
    Certifications: See my signature
    WIP: MCSD, MCAD, CCNA, CCNP
  4. Tinus1959

    Tinus1959 Gigabyte Poster

    1,539
    42
    106
    So far we have seen what classes are and how to determine which class we are in with a specific IP-address. In classfull addressing we encounter a (big) problem however. You had to choose between those three classes, A B or C. There was no other option. So you had 256 addresses, or 65536 addresses or 16777216 addresses. What if I only needed 800 addresses? I could opt for a B class network and trow away 64736 addresses or I could opt to take 4 C class networks and connect those together. They realized that trowing away 64000+ addresses was not an option. So they thought of a way to devide that big B class network into smaller networks. How did they do that?
    Well, a C class has 8 bits for the clients and a B class has 16 bits for the clients. What happens when we go in between those two numbers. Let us say we split the difference and take 12 bits for the clients. This means that we have 20 bits for the network ID. The way to distinquish the client part and the network part was the sub net mask. There is our solution: by putting the last 12 bits of the SNM to 0 and the first 20 to 1 we set the 'digital dash' right in between B and C class. The first 16 bits of the SNM are no problem, they are all 1, so 255 in decimal. 16 bits down, 4 more to go. Okay, here they are: 1111. But what now? an octet has 8 bits. What is the status of the other four? Well, the other four belong to the host part and therefor are set to 0. Our octet looks like 11110000. In decimal this is 240. The SNM will be 255.255.240.0. We can only split something in smaller parts what was bigger to start with, so you encounter this in a A class or B class network.

    Intermezzo
    It is not possible to have this SNM in a C class network unless you combine 16 (in this case) proper choosen C class networks to one bigger network. This is called supernetting and will be discussed later.


    Okay, how many networks do we have and howmany hosts?
    Well, this depends on what we started with. If we started with an A class network, 8 bits are allready given away. We have 20 bits in the SNM so we have 12 bits to play with (in this example) and 2^12 = 4096. So we can create 4096 networks. We have 12 bits for the hosts, so we also have 2^12 = 4096 addresses.

    If we would have a B class network to start with 16 bits would have been accounted for, so we only had 4 for our (sub)networks, so 2 ^ 4 = 16 networks with each 4096 addresses.

    Wooo, Hold on a second: In every book they say -2 what is that for? Well, there are two special addresses in every network. That is the address all 0 and the address all 1. All 0 is the address for that specific network, all 1 is the broadcast address. Many books (and trainers) claim the broadcast address is the 255 address, but that is simply not true. In a B class network it would be 255.255 and in our little example it would be 15.255 (the first one).

    To help us poor people to read the SNM a bit easier they found an other notation for the SNM. Tey simply tell you howmany 1s there are in the SNM. This is written as 172.20.16.0/20.

    Supernetting tomorrow.
     
    Certifications: See my signature
    WIP: MCSD, MCAD, CCNA, CCNP
  5. Tinus1959

    Tinus1959 Gigabyte Poster

    1,539
    42
    106
    Hello again,

    Supernetting today. What is supernetting? In short: the opposite of subnetting. That is: in subnetting you move the digital dash to the right, with supernetting you move it to the left. In fact you combine a number of well choosen networks to one bigger network. Well choosen is the keyword here. The restriction is that you can only supernet a number of networks if you hold the COMPLETE range. Let me explain:
    lets say I have the networks 172.22.16.0, 172.22.17.0, 172.22.18.0 and 172.22.19.0. Lets convert those thirth octets to binairy:
    00010000 (16)
    00010001 (17)
    00010010 (18 )
    00010011 (19)

    from this small list it is clear that the first 6 bits of those addresses are the same: 000100xx. So we could lay our 'dash' after the 6th bit. The SNM than becomes 255.255.252.0.
    We may not use a bigger range like 255.255.248.0 because we would than also take the networks 20, 21, 22 and 23, and those may be not ours.
    An other example: Lets say we own networks 12, 13, 14, 15, 16, 17, 18 and 19 of the same B class.
    We now have in binairy:
    00001100 (12)
    00001101 (13)
    00001110 (14)
    00001111 (15)
    00010000 (16)
    00010001 (17)
    00010010 (18 )
    00010011 (19)
    We see that the first 3 bits are the same in all of those cases, but we may NOT use 224 as a SNM octet, because that would also combine the networks 0 to 11 (write them down in binairy and check this) and the networks 20 to 31 (check this to). In all those number the three first bits are the same, but those networks are not ours. What to do?
    Well, we own the complete group 12, 13, 14 and 15 (00, 01, 10 and 11 for the last two bits) so we can combine those and we own 16, 17, 18 and 19, which is also a complete group, so we can combine those.
    We reduced 8 networks in to 2 networks. To 'connect' these two networks we need a router. Supernetting is often seen in routing tables.
    I am aware that the consept of supernetting might be a bit hard to grasp, but I think you get the idea.

    Tomorrow I will clean up some loose ends, but this is basically the story. Fell free to ask questions and make remarks.
     
    Certifications: See my signature
    WIP: MCSD, MCAD, CCNA, CCNP
  6. Tinus1959

    Tinus1959 Gigabyte Poster

    1,539
    42
    106
    The loose ends I was talking about yesterday. They themself have nothing to do with the phenomenon of subnetting, but are interresting to know.
    There are some 'special' networks:
    0.0.0.0 This network is not used. If you look in the IP Address sapce list it says it is reserved. 0.0.0.0 is used to address all networks more or less. You will find it mentioned in the local routing table of your machine. For windows you can see that table with "route print" in a CMD shell. BTW the IP list can be found here: http://www.iana.org/assignments/ipv4-address-space/
    10.0.0.0 This network is known as a class A private address space. This means everone can use it without problems. The same story is true for class B (172.16.0.0 - 172.31.0.0) and for class C (192.168.0.0 - 192.168.255.0).
    169.254.0.0 This network is assigned to APIPA (Automatic Private IP Addressing). This range is used for DHCP clients which are not able to locate a DHCP server. This address is used in trouble shooting. It you see an address in this range you know there might be a DHCP issue.
    127.0.0.0 This class A network is dedicated to the local host. It can be used to check if your TCP/IP stack is loaded correctly. Most of the time the address used is 127.0.0.1, but in fact every address in that range will give the same result. What a waste; 16 million addresses just for testing...
    D class (224.0.0.0 - 239.0.0.0) is used for multicasting.
    E class (240.0.0.0 - 255.0.0.0) is reserved for "future use" and "experimental" depending on the book you are reading. According to IANA it is future use.
    255.255.255.255 Universal broadcast address.

    That's it folks.
     
    Certifications: See my signature
    WIP: MCSD, MCAD, CCNA, CCNP
  7. Tinus1959

    Tinus1959 Gigabyte Poster

    1,539
    42
    106
    Ok, not exactly X-mas, but better (a bit) late than never.

    Example 1.
    You need to host 4037 hosts in a single network. What would be the subnetmask?
    Answer:
    You have 4037 hosts. You also have to take the network address and the broadcast address, so that is a total of 4039. The standard way of calculating is finding out howmany bits do I need to account for that number of addresses/ The easiest way is to convert 4039 to binairy. (In windows exams you may need a calculator, in CISCO exams you may not). Anyway, 4039 is 1111 1100 0111. This is 12 bits. Therefor the last 12 bits in the subnetmask have to be set to zero. The subnetmask is then 255.255.240.0.

    Example 2.
    You need to host 10000 hosts in you subnet. You need to take in account an anual growth of 10% for the first 3 years. What class do you need and what is the subnetmask. Howmany of these networks can you create?
    Answer:
    Ok: Here we go. After 1 year you will have 11000 hosts. After two year you will have 12100 hosts. After three year you will have 13310 hosts. Add two addresses for network ID and broadcast gives you 13312 addresses in total.
    Convert to bin gives 11 0100 0000 0000 or 14 bits. The subnetmask is therefor 255.255.192.0 This could be a subnetted B class network or a subnetted A class network.
    In case of a B class: the standard subnetmask is 255.255.0.0. We now have 255.255.192.0 so we have just two bits for our subnetworks. that is a total of 4 networks of 16190 hosts each.
    In case of a A class: the standard subnetmask is 255.0.0.0. We now have 255.255.192.0 so we have ten bits for our subnetworks. that is a total of 1024 networks of 16190 hosts each.

    Example 3.
    You own a B class network and need to create 10 networks with 5000 hosts each.
    Answer:
    This is not possible in the standard way. For 10 networks I need 4 bits out of the 16 I have to play with. With 3 bits I can only create 8 networks and I need more, so 4 bits. That leaves me 12 bits for the hosts, but with 12 bits I have only 4096 addresses including the network ID and broadcast address.

    It might be possible to create 64 networks of 1022 hosts each and than combine them by routers. This wil not be part of the normal exams (maybe CCNP, but I even doubt that). An other option would be to use ten networks of 4094, than subnet three of the still remaining six networks not used and subnet them to 1022 networks and than combine them to the bigger networks to get your goal. This subject, VLSM, is also not in the scope of the normal exams.

    Example 4.
    You know you are the administrator of the first network and your broadcast address is 137.172.15.255. What could you make from this fact?
    Answer:
    Well, I know that the broadcast address is the last address in my network. That means that the next address is the network ID of the second network: 137.172.16.0
    137 is definately an B class address (137 = 10001001) so the thirth octet is for 'playing'. 16 = 00010000, so the first four bits are for the network. that makes the subnetmask 255.255.240.0. That means 12 bits for the hosts, so 4094 host addresses and 16 networks max.
     
    Certifications: See my signature
    WIP: MCSD, MCAD, CCNA, CCNP
  8. osiris

    osiris Bit Poster

    20
    0
    12
    I learned about Subnetting earning my CCNA the best explanation of it I found was Chapter 3 of the Sybex CCNA Book - anyone should be able to get a pdf of it
     
    Certifications: CompTIA A+ Net+ CCNA MCP 70-270 70-290
    WIP: 70-291 to make MCSA
  9. alebleicker

    alebleicker Bit Poster

    13
    0
    21
    sorry, wrong post
     
    Last edited: Jul 17, 2010
    Certifications: A+,N+,70-270,70-290
    WIP: MCSA

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.