-1

I'm trying to identify the classes of IPV4 IP's. I convert the first octet or block into binary and then i follow the algorithm here in the photo. My problem is when the IP starts with 7 for example then its binary is 111 and it doesn't match any of classes and another thing when i turn 47 for instance to binary (101111) then it should belong to class B but instead its class is A and i don't know why? enter image description here

  • 2
    `when the IP starts with 7` - i suppose like in 7.2.4.5 - it actually starts with 00000111 and not with 111 ... The [Wikipedia article on classful networks](https://en.wikipedia.org/wiki/Classful_network) is quite good. – fvu Jun 30 '17 at 14:14
  • 1
    The image says "32 bits" right at the top, which is divided into 4 groups with 8 bits in each. The numbers refer to the first bits in the first 8-bit group. – JJJ Jun 30 '17 at 14:18
  • @JJJ I know but ... –  Jun 30 '17 at 14:20
  • 1
    But what? 7 is 00000111 in 8-bit binary and starts with 0, just like fvu said. 47 is 00101111 and also starts with 0. – JJJ Jun 30 '17 at 14:22
  • @fvu thanks for suggestion but how do you justify those IP's which start with 47 ? does the same rule applies there too ? –  Jun 30 '17 at 14:23

1 Answers1

0

The binary number you have separated on each net doesn't mean the class definition, a class is defined by the network portion, for example the ip you mention that starts with 7 belongs to the A class:

7 = 00000111

The A class defines the first 8 bits as the network portion The B class defines the fisrt 16 bits as the network portion The C class defines the first 24 bits as the network portion

Check the following tables and let me know if you have more questions. enter image description here enter image description here

Genaro Morales
  • 206
  • 1
  • 7