All about IPv4 Addresses

Rishu Kumar
3 min readSep 25, 2024

--

Before we deep dive into IPv4 Addresses, let us first know what really IP addresses are and what it means? IP stands for “Internet Protocol”. An IP address is a unique address that is used to identify a node/host in a network or we can say on internet. IP address helps the internet to distinguish between different routers, computers. They are logical addresses.

Photo by 2H Media on Unsplash

IP Addresses have two sections :-

  1. Network Identifier (Net ID) : X-bits
  2. Host Identifier (Host ID) : Y- bits

Size of IP address field = X + Y bits

  1. Network Identifier
  • Unique n/w identifier(X-bits) [Range: 0 to (2^x -1)]
  • Assigned to each connected network.
  • Managed by IANA (Internet assigned numbers authority)
  • Total number of networks(worldwide) can be 2^x.

2. Host Identifier

  • Unique host identifier (y-bits) per network. [Range: 0 to (2^y-1)]
  • Assigned to each connected host in the network.

Two IP versions :-

  1. IPv4
  • IPv4 Address(32 bits)
  • 4 bytes (X + Y = 32)

2. IPv6

  • IPv6 Address(128 bits)
  • 16 bytes (X + Y = 128)

IPv4 Address

  • Size of IPv4 address field is 32 bits.
  • Two representation of IPv4 address :-
  1. Binary Representation (32 bits)

eg. 01011101….01

2. Dotted decimal Representation

  • 4 octet, separated by period(.)
  • P.Q.R.S
  • Range value of every octet is 0 to 255.

Now moving towards IPv4 addresses, there are two special addresses. The first one is Network Addresses and the other one is Broadcast Addresses.

Network Addresses can’t be an IP address of any host in the n/w. They are only used to represent a n/w.

Similarly Broadcast Address can’t be an IP address of any host in the n/w. They are used to broadcast a packet to all hosts belongs to a network. Net ID field = As assigned and Host ID field = All one bits.

So, we learned about the special IP addresses now, what about the IP address of a host? So for a host, Net ID field (X-bits) = As assigned to network, and Host ID field (Y-bits) = Any thing(Except all zero and all one bits).

We know, host have Y-bits assigned to them. So number of hosts per network will be 2^y -2 . We are subtracting 2 because of all zero and all one leads to special IP addresses.

Now, lets talk about Network mask, It is also of 32 bits but don’t confuse it with IP addresses. Network masks are just binary strings in which Net ID field = All one bits and Host ID field = All zero bits. It is a binary string to produce network address of an IP address. We should also keep in mind that all hosts belongs to same n/w must have same n/w address.

Lets talk about categories of of IPv4 address, they are of 2 type :

  1. Classful IPv4 Address(Static Assignment) : N/w ID field size defined implicitly.
  2. Classless IPv4 Address(Dynamic Assignment) : Need to define NetID filed size explicitly.

Classful IPv4 addresses are of 5 types :

  1. Class A
  2. Class B
  3. Class C
  4. Class D
  5. Class E
  6. Class A IPv4 Address :
  • IP address = 0………. (starts with 0 bit)
  • Network ID: 8-bits
  • Host ID: 24-bits
  • IP range: 0.0.0.0 to 127.255.255.255
  • N/w mask : 255.0.0.0

2. Class B IPv4 Address :

  • IP address = 10……….(starts with 10 bits)
  • N/w ID : 16 bits
  • Host ID: 16 bits
  • IP address range : 128.0.0.0 to 191.255.255.255
  • N/w mask : 255.255.0.0

3. Class C IPv4 Address :

  • IP address = 110………(starts with 110 bits)
  • N/w ID : 24 bits
  • Host ID : 8 bits
  • IP address range : 192.0.0.0 to 223.255.255.255
  • N/w mask : 255.255.255.0

4. Class D IPv4 Address :

  • IP address = 1110………… (starts with 1110 bits)
  • IP address range : 224.0.0.0 to 239.255.255.255
  • used for multicasting.
  • Class D IPv4 address can’t be a host address.
  • It is used as “group ID” by IGMP.

5. Class E IPv4 Address :

  • IP address = 1111………(Starts with 1111 bits)
  • IP address range : 240.0.0.0 to 255.255.255.255
  • Reserve for future use.

That’s it guys. I hope you found this blog useful.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Rishu Kumar
Rishu Kumar

Written by Rishu Kumar

Exploring the digital realm, one line of code at a time.

No responses yet

Write a response