Skip to main content

IPv4 Address Calculation for beginners

Internet Protocol version 4 (IPv4)

  • 32 bit address
    • Example : 11000000 10101000 01100100 00000001
  • Divided into 4 groups
  • So each group contains 8 bits.
  • To separate groups we use PERIODS
    • Example : 11000000 . 10101000 . 01100100 . 00000001
  • The format of IP address is dotted decimals
    • We have to convert those binary bits in numbers (decimals).
    • Example : 192 . 168 . 100 . 1
Starting number of each group must be 00000000 (0)
Ending number of each group must be 11111111 (255).

1

Classes of IP Address



How to Find Class of an IP Address?

2
Class Range Size Hosts
A 1 – 126 Large 16,777,214
B 128 – 191 Medium 65,534
C 192 – 223 Small 254
D 224 – 239 Reserved
E 240 – 254 Reserved
The Class D IP address is reserved for Multicast.

The IP address starting 0, 127, 255 are also reserved. The IP address starting with 127 is reserved for loopback address.

Parts of IP Address

The IP address does contain 2 parts. One is Network Part and another is Host Part.

3

But Network part and Host part will be vary with each class.

4

Class A has 8 bits of Network Part and 24 bits of Host Part.
Class B has 16 bits of Network Part and 16 bits of Host Part.
Class C has 24 bits of Network Part and 8 bits of Host Part.

When a design a network, The Network part of all IP address must be command and host part must be unique.

7

What is Subnet Mask?



Subnet Mask is used by networking devices to find out the network and host bits of IP address.
The Subnet Mask is contiguous. First Network bits and then Host bits.
For Subnet Mask: Network bits are 1’s and Host bits are 0’s

Example:

5 

Number of hosts:



We have a formula to find out the number of hosts in each class. And the formula is  2n – 2.
And the value of n is  number of hosts bits.
Class A 224 – 2 16,777,214
Class B 216 – 2 65,534
Class C 28 – 2 254


Reserved Address is Every Network.

In Every Network there are 2 address are reserved and that’s why we minus 2 from finding number of host addresses. One is used for Routing and we call it as Network Address and another one is used for local broadcast and we call it as Broadcast Address.

For Network Address, the network part are same as the network part IP address but the host bits of IP were 0.

8
For Broadcast Address, the network part are same as the network part IP address but the host bits of IP were 1.

9

Exercise 1

In this exercise we can find out subnet mask, network broadcast address, valid ip range of the network, and number of host on the network of Class C IP address.

IP Address – 192.168.100.14

The Above IP address belong to Class C.

Then the subnet mask is 255.255.255.0.

Ok. The first 3 groups of this IP address (not subnet mask) is host bits and the last group is host part.

Then Network Address must be : 192.168.100.0
Because all bits in the last group were 0’s : 192.168.100. 00000000
The Broadcast Address must be : 192.168.100.255
Because all bits in the last group were 1’s : 192.168.100. 11111111

The Network IP range must be from 192.168.100.1 to 192.168.100.254
Number of Host : 28 – 2 = 254.
Exercise 2

In this second exercise we can find out subnet mask, network broadcast address, valid ip range of the network, and number of host on the network of class B address.

IP Address – 172.16.100.55

The Above IP address belong to Class B.

Then the subnet mask is 255.255.0.0.

Ok. The first 3 groups of this IP address (not subnet mask) is host bits and the last group is host part.

Then Network Address must be : 172.16.0.0
Because all bits in the last group were 0’s : 172.16. 00000000 . 00000000
The Broadcast Address must be : 172.16.255.255
Because all bits in the last group were 1’s : 172.16. 11111111 . 11111111

The Network IP range must be from 172.16.0.1 to 172.16.255.254
Number of Host : 216 – 2 = 65534.

Exercise 2

In this second exercise we can find out subnet mask, network broadcast address, valid ip range of the network, and number of host on the network of class A address.

IP Address – 10.56.42.5

The Above IP address belong to Class A.

Then the subnet mask is 255.0.0.0.

Ok. The first 3 groups of this IP address (not subnet mask) is host bits and the last group is host part.

Then Network Address must be : 10.0.0.0
Because all bits in the last group were 0’s : 10. 00000000 . 00000000 . 00000000
The Broadcast Address must be : 10.255.255.255
Because all bits in the last group were 1’s : 10. 11111111 . 11111111 . 11111111

The Network IP range must be from 10.0.0.1 to 10.255.255.254
Number of Host : 28 – 2 = 16,777,254.
The End

Comments

  1. There is an error in last excercise.

    "Number of Host : 28 – 2 = 16,777,254. "

    Anyways thanks for nice tutorial it helped me a lot. :)

    ReplyDelete
  2. A very enlightening and descriptive guide for the beginners, it surely was a little bit hard but I really understood a lot from this post.

    ReplyDelete

Post a Comment

Popular posts from this blog

Cisco Packet Tracer Multi User Connection

Multiuser communication allows multiple point-to-point (peer) connections between multiple instances of Packet Tracer. By allowing communication between Packet Tracer instances, a new door has been opened to a fun, interactive, social, collaborative, and competitive learning environment. Instructors will now be able to create a variety of activities for students to learn in groups that will facilitate greater social interaction between students. Students will benefit from this environment by working together to solve problems and share ideas. Both students and teachers should take full advantage that Multiuser will offer in their learning environment. Technical Information Communicates between instances using PTMP. PTMP is TCP based. By default, uses TCP port 38000, is customizable, and each new instances on the same PC will use the next available port. On by default. UPnP will attempt to establish port forwarding to facilitate home networks. All network co...

Access Control List (ACL) Simlet

An administrator is trying to ping and telnet from Switch to Router with the results shown below: For this question we only need to use the show running-config command to answer all the questions below: Router>enable Router#show running-config   Question 1 Which will fix the issue and allow ONLY ping to work while keeping telnet disabled? A. Correctly assign an IP address to interface fa0/1 B. Change the ip access-group command on fa0/0 from “in” to “out” C. Remove access-group 106 in from interface fa0/0 and add access-group 115 in. D. Remove access-group 102 out from interface s0/0/0 and add access-group 114 in E. Remove access-group 106 in from interface fa0/0 and add access-group 104 in Answer : E Explanation: The question was not about FTP so skip line #1 and line #2. The line #3 denies telnet traffic and line #4 permits icmp-echo traffic. L...

Host A pings interface S0/0 on router 3. What is the TTL value for that ping?

Refer to the exhibit. Host A pings interface S0/0 on router 3. What is the TTL value for that ping? A. 252 B. 253 C. 254 D. 255 Answer : B Explanation: The TTL or Time-To-Live gives you an indication of the number of routers between the source and destination. The TTL is used to prevent an IP packet from looping inside an IP network and causing a network meltdown. The initial TTL packet value for an IP packet is 255 and then it is decremented by 1 each time it encounters a router. When this value reaches 0, the packet is discarded by a router. The TTL value is contained in each IP packet including ICMP packets. The TTL value given by the ping command is in fact the TTL value of an echo_response packet. By default, Windows will decrease the TTL by 128 and Ubuntu Linux by 192. The above the exact topology of this questions. I used 10.0.0.1 for Host A’s IP address and 12.0.0.2 for R3 S0/0’s IP address. All router has been config...