Options

IP vs. CIDR

jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
Hi,

I was just asked a question on a practice exam (Net +) that I answered incorrectly.

The question was:

Consider the following IP address:

157.175.12.10/22

How many bits will be used for the host portion of this address?

I assumed it was a class B network and that the default massk ws 16. So of the four choices I was given I answered 6 (22-6=16). That's the default mask for a class B network.

How am I supposed to tell the difference between a classfull IP and a classless (CIDR) IP?

Thanks in advance.


Comments

  • Options
    samurai86samurai86 Member Posts: 104 ■■□□□□□□□□
    I think the answer it is 10 bits for the host portion. It is a class B address, but the address is likely broken up to create more networks. A /22 CIDR notation = subnet 255.255.252.0

    In binary this equals 11111111.11111111.11111100.00000000

    If I recall correctly a 1 = network bit a 0 = a host bit

    If I am wrong someone please correct me.
    Bachelor's of Applied Science in Technology Management - Information Security Assurance (St. Petersburg College)
    Masters of Science in Digital Forensics (University of Central Florida)
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    Thank you!

    So the best way to determine if it's a CIDR is to convert the IP into binary, and count the host 0's from right to left. That's so simple!

    What was confusing me was the mask of /22, and how the difference between it and /16 is 6. That's where I was making my mistake.

    Thanks a ton samurai86. icon_surprised.gif
  • Options
    samurai86samurai86 Member Posts: 104 ■■□□□□□□□□
    Well I converted the CIDR to the subnet, (not IP) then I converted the subnet value to binary. But to keep it simple there are 4 octets, each containing 8 value holders for a binary 1 or 0. (mathematically 32 potential values of a 0 or a 1) So if you have a /24 CIDR then the left over portion are your host bits, in this case that would be 8 host bits.

    For example - /8 = 255.0.0.0 = 11111111.00000000.00000000.000000 (24 host bits)
    /16 = 255.255.0.0 = 11111111.11111111.00000000.00000000 (16 host bits)
    /30 = 255.255.255.252 = 11111111.11111111.11111111.11111100 (2 host bits)

    Hope this helps!
    Bachelor's of Applied Science in Technology Management - Information Security Assurance (St. Petersburg College)
    Masters of Science in Digital Forensics (University of Central Florida)
  • Options
    EdTheLadEdTheLad Member Posts: 2,111 ■■■■□□□□□□
    Simple way
    x.x.x.x/y ; y is the network bits
    Max bits in an address is 32, therefore 32-y = host bits
    No need to waste your time writing out binary.
    Networking, sometimes i love it, mostly i hate it.Its all about the $$$$
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    EdTheLad wrote: »
    Simple way
    x.x.x.x/y ; y is the network bits
    Max bits in an address is 32, therefore 32-y = host bits
    No need to waste your time writing out binary.

    Yes, that's what I tried to do in the first place. Except,

    157.175.12.10/22

    I minused the default mask from the altered mask, assuming it was a non-subnetted network. So I did 22 - 16 = 6. That was one of the answers, of course. :)

    Now I know to minus the altered mask from 32, which would have given me 10. The correct answer. So thank you to both of you.

    This has been frustrating to me, and it has delayed my studies for quite a few days. Now I can get on with it, and perhaps meet my planned test date. So again, thank you to both.

    By the way, I just scored 95% for the practice test on the first domain. That's what your few keystrokes did for another. Amazing!
  • Options
    elderkaielderkai Member Posts: 279
    For the record, when you're messing with anything other than /8, /16/ 24, it's classless. icon_razz.gif
  • Options
    GngoghGngogh Member Posts: 165 ■■■□□□□□□□
    10 bits left... 22+10 = 32.
  • Options
    GngoghGngogh Member Posts: 165 ■■■□□□□□□□
    there is no default when you subnet
  • Options
    DarrilDarril Member Posts: 1,588
    Another way of looking at this is that whenever you have CIDR notation /xx, treat it like a classless IP.

    The IP has 32 bits.
    The/22 indicates that 22 bits are used for the network ID.
    32-22 = 10 bits left for the host ID.
  • Options
    TheNewITGuyTheNewITGuy Member Posts: 169 ■■■■□□□□□□
    Gngogh wrote: »
    there is no default when you subnet

    subnetting is the process of going from the default and breaking it down into more networks and less hosts - if he was looking to subnet a /16 network into say a /22 then the default would play a role.

    In this case with a /22 he's correct in saying he's borrowed 6 bits for the network but now has 10 bits left over for hosts.
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    OK. I hope you guys are still with me.

    I understand, thanks to you, how to figure out the host bits of a subnetted (CIDR) IP address, but now I find myself on the flip-side. I'm being asked to figure out the base network ID.

    The example given is 196.11.200.71 /18. I know it's subnetted, because /18 is not one of the defaults. I know it's class C because of the first octet, and because the mask is greater than /16.

    The correct answer on this practice exam is 196.11.192.0. I'm sorry, but I've written this IP out into binary, reread what has been posted above, and I can't for the life of me figure out how the 192 (3rd octet) is being calculated. I understand the 4th octect of 0 though.


    I understand the mask of 192. What I don't understand is that the difference between 200and 192 is 8. I can't find a place for that 8. /18 + 8 = 26. That's above a class C default mask. The difference is 2...I just don't get this! icon_study.gif



    I must have missed more fundamental stuff, and your help is greatly appreciated. It's important to understand the process of calculation, because the real test will use different examples for the same type of problem.
  • Options
    TechGuru80TechGuru80 Member Posts: 1,539 ■■■■■■□□□□
    Ok so what is the increment?

    We know that 2 extra bits are being used for the network in the third octet, leaving 6 (8-2) for the increment. So: 0, 64, 128, 192 are all network addresses.
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    Amazing. I wrote out the mask and weights chart, but assigned 2 bits to Mask 128/Weight 128. That means that the second bit assignment was 4 in my head. That's why things weren't making sense...or at least, that was the error that was distracting me.

    I saw that the increment was 64, but I didn't know I could move from zero in 64 segments to reach and verify 192 (even though 192 is the mask above the 64 weights in the chart).

    And because the mask is between 16 and 24, I can assume that it's a Class B IP address.

    Something just clicked in your post, and a light went off in my head. Thanks a lot! icon_biggrin.gif
  • Options
    TheNewITGuyTheNewITGuy Member Posts: 169 ■■■■□□□□□□
    Its going to be a little different for a Class C address (/24) super-netted (not subnetted) to a /18 - super net is when we go backward and subnet is when we go forward ie: subnet makes more networks and supernets make more hosts

    so a 196.11.200.71/18 without knowing the answer you cant reverse engineer it.

    quickest way is to just write it out real quick

    196.11.200.71
    255.255.192.0

    192 in binary is 11000000


    200 in binary is 11001000

    you do a quick AND against them 11000000 = 192
    196.11.192.0 is your network address
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    Its going to be a little different for a Class C address (/24) super-netted (not subnetted) to a /18 - super net is when we go backward and subnet is when we go forward ie: subnet makes more networks and supernets make more hosts

    so a 196.11.200.71/18 without knowing the answer you cant reverse engineer it.

    quickest way is to just write it out real quick

    196.11.200.71
    255.255.192.0

    192 in binary is 11000000


    200 in binary is 11001000

    you do a quick AND against them 11000000 = 192
    196.11.192.0 is your network address


    This is a little advanced for me. What do you mean, "do a quick AND against them..." Can you explain a little more?
  • Options
    EdTheLadEdTheLad Member Posts: 2,111 ■■■■□□□□□□
    Its going to be a little different for a Class C address (/24) super-netted (not subnetted) to a /18 - super net is when we go backward and subnet is when we go forward ie: subnet makes more networks and supernets make more hosts

    Gosh that would confuse me! Supernetting is used when talking about summarization not subnetting. Summarization is moving the bit boundary of the mask to the left so you can advertise groups of networks, you don't look at this as advertising more hosts. Supernetting is the same as summarization except its moving the mask more left of the major network boundary.

    For example:

    150.1.0.0/17 is a summary, 150 is a class B address so has a major network boundary /16
    150.1.0.0/16 is also a summary
    150.0.0.0/8 is a supernet
    quickest way is to just write it out real quick

    196.11.200.71
    255.255.192.0

    192 in binary is 11000000


    200 in binary is 11001000

    you do a quick AND against them 11000000 = 192
    196.11.192.0 is your network address

    196.11.200.71 255.255.192.0

    The quickest way to do this is to look at the mask 192, 256-192 = 64 , which means blocks are 64.

    64=64=64=192
    192.11.192.0 is the network without any binary playing.
    Networking, sometimes i love it, mostly i hate it.Its all about the $$$$
  • Options
    DarrilDarril Member Posts: 1,588
    So the question is "What is the network ID of 196.11.200.71/18

    In classes, I teach it with these steps.
    1) Convert IP to binary
    196 = 1100 0100
    11 = 0000 1011
    200 = 1100 1000
    71 = 0100 0111

    1100 0100 . 0000 1011 . 1100 1000 . 0100 0111

    2) Convert subnet mask to binary (/18 = 18 "1" bits in mask)
    18 = 1111 1111 . 1111 1111 . 1100 0000 . 0000 0000

    3) ID line between network ID and host ID (Network ID is where subnet mask bits are "1")
    1100 0100 . 0000 1011 . 1100 1000 . 0100 0111 (IP)
    1111 1111 . 1111 1111 . 1100 0000 . 0000 0000 (mask)

    Network ID Host ID
    1100 0100 . 0000 1011 . 1100 1000 . 0100 0111

    1100 0100 . 0000 1011 . 1100 0000 . 0000 0000 (Network ID has trailing zeros)
    0000 0000 . 0000 0000 . 0000 1000 . 0100 0111 (Host ID has leading zeros)

    4) Convert Network ID to decimal
    1100 0100 = 196
    0000 1011 = 11
    1100 0000 = 192
    0000 0000 = 0

    196.11.192.0

    5) Convert subnet mask to decimal
    1111 1111 = 255
    1111 1111 = 255
    11
    00 0000 = 192
    0000 0000 = 0

    255.255.192.0

    There are multiple shortcuts you can take to get to the end result but I've found that by teaching them the long way a few times, people typically discover the shortcuts on their own. The shortcuts then make a lot more sense and stick with them for much longer.

    Hope this helps.
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    EdTheLad and Darril,

    Can I ask where you are getting 256? I understand how to figure this out now, except for the fact that I thought the highest value of any octet is 255.

    If I can understand where you're getting 256 from, I think I'll be good to go.

    Thanks!
  • Options
    EdTheLadEdTheLad Member Posts: 2,111 ■■■■□□□□□□
    The octet range of values is 0-255, that's a total of 256 values including 0, i.e. 2^8 =256
    Networking, sometimes i love it, mostly i hate it.Its all about the $$$$
  • Options
    DarrilDarril Member Posts: 1,588
    Yes, as EdTheLad says, the full range of values with eight bits (0 to 255) is 256. I don't think I used 256 in my explanation but his explanation is completely valid.
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    Oooohhh!

    I forgot that zero is a value. Stupid me. Thanks for reminding me.

    Every one that has posted in this thread has been helpful. I've printed it, and I'm going over it.

    Thanks to everyone again.
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    For the love of God! How many times am I going to answer this question incorrectly, and how many times do I have to reread this post?!!!

    Off to read RFC 940, 950, and this 500 page TCP/IP book I just bought. icon_rolleyes.gif
  • Options
    jamarchitectjamarchitect Member Posts: 51 ■■□□□□□□□□
    Ahh. Got it. CBT either didn't mention Bitwise AND or I spaced out, and didn't hear it.
  • Options
    Snow.brosSnow.bros Member Posts: 832 ■■■■□□□□□□
    EdTheLad and Darril,

    Can I ask where you are getting 256? I understand how to figure this out now, except for the fact that I thought the highest value of any octet is 255.

    If I can understand where you're getting 256 from, I think I'll be good to go.

    Thanks!

    Just to add, i am going to dwell from what the guys are advising, an octet contains 256 values (0-255) so this means we not going to use all the values for each host if for examples we have a class C address(192.168.1.0/24) obviously with the subnet of 255.255.255.0 (256 host) right, we are going to have only 254 host this means that in an octet 0 from 0-255 (192.168.1.0)represent the network (its the network ID) and 255 is the broadcast address for the entire network.

    So in a network of: 192.168.1.0/24

    192.168.1.0 - identifies the network, this address cannot be given to an individual as it represent the entire network.
    192.168.1.255 - is the broadcast address for the the entire network. this is where we are going to send a broadcast packet to every member on the network if need be.

    So both these addresses cannot be assigned to any member or host on the network hence we have 254 host only.
Sign In or Register to comment.