IPv4 ADDRESSES-
An IPv4addressis a 32-bitaddress that uniquely and universally defines the connection
of a device (for example, a computer or a router) to the Internet. IPv4 addresses are unique. They are unique in the sense that each address defines
one, and only one, connection to the Internet. Two devices on the Internet can never
have the same address at the same time. We will see later that, by using some strategies,
an address may be assigned to a device for a time period and then taken away and
assigned to another device.
Address Space -
A protocol such as IPv4 that defines addresses has an address space. An address space
is the total number of addresses used by the protocol. Ifa protocol uses N bits to define
an address, the address space is 2N because each bit can have two different values (0 or 1)
and N bits can have 2N values.
IPv4 uses 32-bit addresses, which means that the address space is 232 or
4,294,967,296 (more than 4 billion). This means that, theoretically, if there were no
restrictions, more than 4 billion devices could be connected to the Internet. We will see
shortly that the actual number is much less because of the restrictions imposed on the
addresses.
Notations -
There are two prevalent notations to show an IPv4 address: binary notation and dotted
decimal notation.
Binary Notation -
In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often referred
to as a byte. So it is common to hear an IPv4 address referred to as a 32-bit address or a
4-byte address.
The following is an example of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
Dotted-Decimal Notation-
To make the IPv4 address more compact and easier to read, Internet addresses are usually written in decimal form with a decimal point (dot) separating the bytes. The following is the
dotted~decimal notation of the above address:
117.149.29.2
Classful Addressing-
IPv4 addressing, at its inception, used the concept of classes. This architecture is called
classful addressing. Although this scheme is becoming obsolete, we briefly discuss it
here to show the rationale behind classless addressing.
In classful addressing, the address space is divided into five classes: A, B, C, D,
and E. Each class occupies some part of the address space.
We can find the class of an address when given the address in binary notation
or dotted-decimal notation. If the address is given in binary notation, the first few
bits can immediately tell us the class of the address. If the address is given in
decimal-dotted notation, the first byte defines the class. Both methods are shown in
Figure 19.2
Netid and Hostid -
In classful addressing, an IP address in class A, B, or C is divided into netid and hostid.
These parts are of varying lengths, depending on the class of the address. Figure 19.2
shows some netid and hostid bytes. The netid is in color, the hostid is in white. Note that
the concept does not apply to classes D and E.
In class A, one byte defines the netid and three bytes define the hostid. In class B,
two bytes define the netid and two bytes define the hostid. In class C, three bytes define
the netid and one byte defines the hostid.
Mask-
Although the length of the netid and hostid (in bits) is predetermined in classful addressing, we can also use a mask (also called the default mask), a 32-bit number made of contiguous Is followed by contiguous as. The masks for classes A, B, and C are shown
in Table 19.2. The concept does not apply to classes D and E.
The mask can help us to find the netid and the hostid. For example, the mask for a
class A address has eight 1s, which means the first 8 bits of any address in class A
define the
netid; the next 24 bits define the hostid.
The last column ofTable 19.2 shows the mask in the form In where n can be 8, 16,
or 24 in classful addressing. This notation is also called slash notation or Classless
Interdomain Routing (CIDR) notation. The notation is used in classless addressing,
which we will discuss later. We introduce it here because it can also be applied to class
ful addressing. We will show later that classful addressing is a special case of classless
addressing.
Mask -
A better way to define a block of addresses is to select any address in the block and the
mask. As we discussed before, a mask is a 32-bit number in which the n leftmost bits
are Is and the 32- n rightmost bits are Os. However, in classless addressing the mask
for a block can take any value from 0 to 32. It is very convenient to give just the value
of n preceded by a slash (CIDR notation).
The address and the In notation completely define the whole block (the first
address, the last address, and the number of addresses).
First Address -The first address in the block can be found by setting the 32- n right
most bits in the binary notation of the address to Os.
The first address in the block can be found by setting the rightmost 32- n bits to Os.
Last Address -The last address in the block can be found by setting the 32- n right
most bits in the binary notation of the address to Is.
The last address in the block can be found by setting the rightmost32- n bits to Is.
Number of Addresses- The number of addresses in the block is the difference between
the last and first address. It can easily be found using the formula 2 32-n .
Comments
Post a Comment