How many number of IP addresses are available?

In summary, according to the author, there are 2,130,706,178 different IPv4 addresses available for computers on the Internet.
  • #1
Phys12
351
42

Homework Statement


Counting Internet Addresses In the Internet, which is made up of interconnected physical networks of computers, each computer (or more precisely, each network connection of a computer) is assigned an Internet address. In Version 4 of the Internet Protocol (IPv4), now in use, an address is a string of 32 bits. It begins with a network number (netid ). The netid is followed by a host number (hostid ), which identifies a computer as a member of a particular network. Three forms of addresses are used, with different numbers of bits used for netids and hostids. Class A addresses, used for the largest networks, consist of 0, followed by a 7-bit netid and a 24-bit hostid. Class B addresses, used for medium-sized networks, consist of 10, followed by a 14-bit netid and a 16-bit hostid. Class C addresses, used for the smallest networks, consist of 110, followed by a 21-bit netid and an 8-bit hostid. There are several restrictions on addresses because of special uses: 1111111 is not available as the netid of a Class A network, and the hostids consisting of all 0s and all 1s are not available for use in any network. A computer on the Internet has either a Class A, a Class B, or a Class C address. (Besides Class A, B, and C addresses, there are also Class D addresses, reserved for use in multicasting when multiple computers are addressed at a single time, consisting of 1110 followed by 28 bits, and Class E addresses, reserved for future use, consisting of 11110 followed by 27 bits. Neither Class D nor Class E addresses are assigned as the IPv4 address of a computer on the Internet.)

How many different IPv4 addresses are available for computers on the Internet?

Homework Equations


The Sum Rule: P1 + P2 + ... Pn
The Product Rule: P1 * P2 * ...Pn

The Attempt at a Solution


Considering that a person can either have a class A IP address or a class B IP address or a class C IP address, the number of IP addresses will be (number of class A IP addresses + number of class B IP addresses + number of class C IP addresses).

Total number of class A IP addresses = total number of possible addresses - total number of forbidden IP addresses. Since the netid is of 7 bits (the first bit is fixed) and the hostid of 24, total number of possible addresses = 2^7 * 2^24. Now, the number of forbidden addresses will be: (1*2^24 + 2^7*2) Why? Because there are two ways of having a forbidden IP addresses: you can either have the netid consist of all 1s or you can have the hostid of either all ones or all zeros. That's why in the first case, I picked the netid 1111111 and then I have 2^24 possibilities for the hostid. In the second case, there can be any netid (total ways of getting one is 2^7), and only 2 host IDs (all 0s or all 1s) and hence, (1*2^24 + 2^27*2) possiblities giving a final result of (2^7 * 2^24) - (1*2^24 + 2^7*2) = 2130706176. However, the answer is: 2130706178. Now, I understand the reasoning given in the book:

Let x be the number of available addresses for computers on the Internet, and let xA, xB, and xC denote the number of Class A, Class B, and Class C addresses available, respectively. By the sum rule, x = xA + xB + xC.

To find xA, note that there are 27 − 1 = 127 Class A netids, recalling that the netid 1111111 is unavailable. For each netid, there are 224 − 2 = 16,777,214 hostids, recalling that the hostids consisting of all 0s and all 1s are unavailable. Consequently, xA = 127 · 16,777,214 = 2,130,706,178.

But I fail to understand where my reasoning is going wrong. I'm getting two less possibilities than the book.
 
Physics news on Phys.org
  • #2
You subtract 0111111 11111111 11111111 11111111 and 0111111 00000000 00000000 00000000 twice as they have both a forbidden netid and forbidden hostid. Your two classes of forbidden addresses are not disjunct.
 
  • Like
Likes Phys12
  • #3
mfb said:
You subtract 0111111 11111111 11111111 11111111 and 0111111 00000000 00000000 00000000 twice as they have both a forbidden netid and forbidden hostid. Your two classes of forbidden addresses are not disjunct.
Got it, thank you!
 

1. How many IP addresses are there in total?

There are approximately 4.3 billion IP addresses available in total.

2. How many IPv4 addresses are available?

There are 2^32 (4,294,967,296) IPv4 addresses available.

3. How many IPv6 addresses are available?

There are 2^128 (approximately 340 undecillion) IPv6 addresses available.

4. Are all IP addresses unique?

Yes, each IP address is unique and serves as a unique identifier for devices connected to a network.

5. How many IP addresses can a single device have?

A single device can have multiple IP addresses, but typically only one is assigned for communication purposes. The maximum number of IP addresses a device can have is determined by the network's subnet mask.

Similar threads

  • Computing and Technology
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
3K
  • Computing and Technology
Replies
10
Views
2K
  • General Math
Replies
2
Views
2K
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Computing and Technology
Replies
1
Views
2K
  • Sticky
  • Programming and Computer Science
Replies
13
Views
4K
  • Calculus and Beyond Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
Back
Top