#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    37
    Rep Power
    3

    Netid and hostid of any given IP address?


    Hello,
    I am trying to understand how to figure out the Netid and Hostid of any given IP address (manually that is without using CMD).

    I know that it has a lot to do with the class that the IP address belongs to. For example, if leftmost bit of the first octet starts with a 0, it belongs to class A.

    That is where I get stuck, once I determine what class an IP address belongs to, I am unable to identify which portion of the address is dedicated to the network and the host.


    Thank in advance for any help.
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    To do it by hand you need to know the table:
    http://en.wikipedia.org/wiki/Classful_network

    It's not necessary to memorize the entire table, because it's not hard to figure it out on the fly and there are plenty of patterns. When you need to remember is how to identify the class of the address and the size of each class.

    So if you have an address that starts with 110 you need to recognize that it's a class C address and a class C address has 24 bits in the network part of the address (including the 110). Since all addresses have 32 bits, the last 8 bits of the address must be the host part.

    Wikipedia also has multiple examples like this one:
    Code:
    Class C
    192.  0.  0.  0 = 11000000.00000000.00000000.00000000
    223.255.255.255 = 11011111.11111111.11111111.11111111
                      110nnnnn.nnnnnnnn.nnnnnnnn.HHHHHHHH
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    37
    Rep Power
    3
    So, for example if the IP address was 140.10.33.17.

    That would mean the IP address belongs to the B class since the leftmost octet starts with 10, and Class B addresses have 16 host and network bits, right?

    So....class C always has 24 network bits, class B addresses always have 16 network bits, and class A always has 8 network bits? and the remaining bits are dedicated to the host?


    I appreciate your help I think I get it now!

IMN logo majestic logo threadwatch logo seochat tools logo