Skip to main content

IPV4, Class and Subnetting.

 

IPV4, Class and Subnetting.

 

IPV4 which stands for Internet protocol version 4 consists of 32 bits. It is written in four octets (1 octet consists of eight bits) –

xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx -----these digits are in binary either 1 or 0 and if written in decimal looks something like this – 10.25.58.65 

The maximum value of 1 octet is 255 that is derived from- lets suppose if an octet is all 1s like 11111111 ---- the decimal value of this equals to 255.

Lets get into few important points:

 

IPV4 class ----

Classes

1st Octet Range

Default Subnet Mask

Finding Formula

A

0-127 (#127 is a loop IP)

255.0.0.0

00000000(0) -011111111(127)

(0 constant in the range)

B

128-191

255.255.0.0

10000000(128) – 10111111(191) (10 constant )

C

192 -223

255.255.255.0

11000000(192) – 11011111(223)  (110 constant in the range)

 

 

 

 

D

224-239

For Multicasting

11100000- 11101111

(1110- constant)

E

240-255

For Research and Future use

 

 

Just so you know, IP are divided into private and public, and they are broadly relevant to only class A, B and C as D and E are used for multicasting and future purposes respectively.

The table below is used for Private I.P Addresses

Class A

10.x.x.x

10.0.0.0-10.255.255.255

Class B

172.16.x.x – 172.31.x.x

172.16.0.0 – 172.31.255.255

Class C

192.168.x.x

192.168.0.0 – 192.168.255.255

 

 

Lets get few things clear first:

 

·       Every IP address has network portion and the host portion. So, here lets suppose I have an IP address 192.168.5.1 /24 – comparing this to IPV4 class table we know right away --- it falls under C class and its subnet mask is   

255.

255.

255.

0

              Which can be viewed as 

11111111.

11111111.

11111111.

00000000

 Which is essentially    

N.

N.

N.

H

 Meaning 1 bits can be considered as X and can be perceived as the network bits denoted by N in the box. And 0 bits considered as Y and represent the host bits denoted by H in the box.  

 

·       CIDR – I remember by pronouncing it cider just like apple cider , it stands for Classless Inter -Domain Routing my friends.  Lets look at the example below ---

192.168.20.5 /28    ------ the number after the / is called the CIDR and it represents the number of ‘ON” bits in the IP, meaning the number of 1’s –

So, do this way --- you know an IP is 4 octets(meaning 8 digits) separated by a dot after each octet.  So when you see CIDR notations just fill in the 1 digit starting from first,,,, so, In the above case ------ 11111111.11111111.11111111.11110000  -------------------here 3 x 8 = 24 so I filled with 1 digits first 3 octets right away and filled 4 more in the last octets just to make sure I add up to the CIDR notation of 28. 

Also, I am sure you noticed it referencing from the IP class it belongs to Class C and which has a default Subnet mask of 255.255.255.0  but with the CIDR notation of 28 the default mask is

Lets find the decimal value of 11110000 which is 240.  So the subnet mask of  192.168.20.5 /28 is 255.255.255.240

·       A subnet mask my friends is an address of 32 bits and helps as I mentioned above to identify between a network address and a host address.

 

Lets Understand Subnetting by looking at the following table, question may be asked where you have to fill in the IP for all the headings:

 

Target IP

157.168.191.166/26

Fill in the IP for the remaining .

 

 

 

Network IP

 

 

First Host IP

 

 

Last Host IP

 

 

Broadcast IP

 

 

Next Subnet IP

 

 

 

Network IP is the first IP , broadcast IP is the last IP and host IPs are in the middle.

1

254

1

Network IP                      Host IPs                          Broadcast IP

 

Network IP is calculated by doing the logical ‘AND’ operation of the bits and the subnet mask bits’, so lets find the network IP of 157.168.191.166/26

 

                  157.168.191.166

     157.168.191. 10100110

Subnet Mask – 11111111.11111111.11111111.11000000

    10100110

x  11000000

……………………………..

    10000000   ==== 128

Network IP – 157.168.191.128

 

And, subnet mask for above IP is 255.255.255.192 (decimal of 11000000 – since it has a CIDR of 26)

 

       Block Size = 2= 26 = 2x2x2x2x2x2 = 64

       Valid Host =  2y -2 = 64 – 2 = 62

       Possible Subnets = 2x = 22 = 2x2 = 4

       Broadcast IP is the last IP –

      So, if network IP is 157.168.191.128,  1st host is the immediate IP after network IP  --- so it is 157.168.191.129 , and there are 62 valid host --- so last host is  157.168.191.190 (28+62)   and  Next subnet is  128+64(block size) = 192 so 157.168.191.192 and broadcast is the last IP before other network ID begins  and therefore in this case is  157.168.191.191.

 

In this example, four subnets are created so we can do the same starting for another network which is  157168.191.192.

 

 

Thank you my friends,

Hope this helps – if you have any questions, leave me comments and I will ty to get back to you !

 

Cheers !


Comments

Popular posts from this blog

Python Sample Questions and Answers for Beginners.

  Phython Sample Questions:   1.      In Python, a variable must be declared before it is assigned a value: a.      True b.      False c.      Non Applicable     2.     In Python, a variable may be assigned a value of one type, and then later assigned a value of a different type: a.True b.False 3.     Consider the following sequence of statements: n = 300 m = n Following execution of these statements, Python has created how many objects and how many references? a.      Two objects, two references b.      Two objects, one reference c.      One object, one reference d.      One object, two references 4.     What Python built-in function returns the unique number assigned to an object: a.      ref() b.      id() c.      refnum() d.      identity() 5.     Which of the following are valid Python variable names: a.      home_address b.      return c.      route66 d.      ver1.3 e.      Age f.        4square 6.     Which of the fol

C and Assembly Questions and Answers 101

  Assembly and C Questions 101: 1. How long will it take for a 128kB file to go across at 1Mbps? 2. DMA full form? 3. Register : Register is the fastest memory in a computer which holds information. True or False 4. A 32-bit processor means it can perform operations on 32-bit data; therefore, the size of registers is 32 bits and ALU also performs 32-bit operations. A 64-bit CPU performs the operation in 64-bit data; therefore, it contains 64-bit register and 64-bit ALU.  True or False 5. Which of the following is a control signal? a.       Read Signal b.      Write Signal c.       Interrupt d.      Bus Request e.       Bus Grant f.       I/O Read and Write g.      All of the above 6. There are two types of CPU technology CISC and RISC. What is the full form of CISC and RISC? 7. The characteristics of 8086 are called reduced instruction set computers (RISC)? True or False 8. What are the two types of CPU architecture? 9. Von Neumann uses the data bus