Logical Addressing - IPv4 Addresses (2024)

An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a device (for example, a computer or a router) to the Internet. IPv4 addresses are unique.

Logical Addressing - IPv4Addresses

An IPv4address is a 32-bit address that uniquely and universally defines theconnection 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 addressdefines one, and only one, connection to the Internet. Two devices on theInternet can never have the same address at the same time. The IPv4 addressesare universal in the sense that the addressing system must be accepted by anyhost that wants to be connected to the Internet.

1. Address Space

Aprotocol such as IPv4 that defines addresses has an address space. An addressspace is the total number of addresses used by the protocol. If a protocol usesN bits to define an address, theaddress space is 2N because each bitcan have two different values (0 or 1) and Nbits can have 2N values.

IPv4 uses32-bit addresses, which means that the address space is 232 or 4,294,967,296 (morethan 4 billion). This means that, theoretically, if there were no restrictions,more than 4 billion devices could be connected to the Internet.

2. Notations

There aretwo prevalent notations to show an IPv4 address: binary notation and dotteddecimal notation.

a. Binary Notation

In binarynotation, the IPv4 address is displayed as 32 bits. Each octet is oftenreferred to as a byte. So it is common to hear an IPv4 address referred to as a32-bit address or a 4-byte address. The following is an example of an IPv4address in binary notation.

0111010110010101 00011101 00000010

b. Dotted-Decimal Notation

To makethe IPv4 address more compact and easier to read, Internet addresses areusually written in decimal form with a decimal point (dot) separating thebytes. The following is the dotted-decimal notation of the above address:

117.149.29.2

Figure3.1 shows an IPv4 address in both binary and dotted-decimal notation. Note thatbecause each byte (octet) is 8 bits, each number in dotted-decimal notation isa value ranging from 0 to 255

Logical Addressing - IPv4 Addresses (1)

Example 3.1

Changethe following IPv4 addresses from binary notation to dotted-decimal notation.

a)1000000100001011 00001011 11101111

b)1100000110000011 00011011 11111111

Solution

Wereplace each group of 8 bits with its equivalent decimal number and add dotsfor separation.

a)129.11.11.239

b)193.131.27.255

Example 3.2

Changethe following IPv4 addresses from dotted-decimal notation to binary notation.

a)111.56.45.78

b)221.34.7.82

Solution

Wereplace each decimal number with its binary equivalent.

a)0110111100111000 00101101 01001110

b)1101110100100010 00000111 01010010

Example 3.3

Find theerror, if any, in the following IPv4 addresses.

a)111.56.045.78

b)221.34.7.8.20

c) 75.45.301.14

d)11100010.23.14.67

Solution

a)Theremust be no leading zero (045).

b)There canbe no more than four numbers in an IPv4 address.

c) Eachnumber needs to be less than or equal to 255 (301 is outside this range).

d)A mixtureof binary notation and dotted-decimal notation is not allowed.

3. Classful Addressing

IPv4addressing, at its inception, used the concept of classes. This architecture iscalled classful addressing. In classful addressing, the address space isdivided into five classes: A, B, C, D, and E.

We canfind the class of an address when given the address in binary notation ordotted-decimal notation. If the address is given in binary notation, the firstfew bits can immediately tell us the class of the address. If the address isgiven in decimal-dotted notation, the first byte defines the class. Bothmethods are shown in Figure 3.2.

Logical Addressing - IPv4 Addresses (2)

Example 3.4

Find theclass of each address.

a)0000000100001011 00001011 11101111

b)1100000110000011 00011011 11111111

c) 14.23.120.8

d)252.5.15.111

Solution

a)The firstbit is O. This is a class A address.

b)The first2 bits are 1; the third bit is O. This is a class C address.

c) The firstbyte is 14 (between 0 and 127); the class is A.

d)The firstbyte is 252 (between 240 and 255); the class is E.

3.1 Classes and Blocks

Oneproblem with classful addressing is that each class is divided into a fixednumber of blocks with each block having a fixed size as shown in Table 3.1.

Class Aaddresses were designed for large organizations with a large number of attachedhosts or routers. Class B addresses was designed for midsize organizations withtens of thousands of attached hosts or routers. Class C addresses were designedfor small organizations with a small number of attached hosts or routers. ClassD addresses were designed for multicasting. The class E addresses were reservedfor future use. In c1assfnl addressing, a large part of the available addresseswere wasted

Logical Addressing - IPv4 Addresses (3)

3.2 Netid and Hostid

Inclassful addressing, an IP address in class A, B, or C is divided into netidand hostid.

Theseparts are of varying lengths, depending on the class of the address. The netidis in color, the hostid is in white. Note that the concept does not apply toclasses D and E. In class A, one byte defines the netid and three bytes definethe hostid. In class B, two bytes define the netid and two bytes define thehostid. In class C, three bytes define the netid and one byte defines thehostid.

3.3 Mask

Although thelength of thenetid and hostid(in bits) ispredetermined in classful addressing, we can also use a mask(also called the default mask), a 32-bit number made of contiguous Is followedby contiguous as. The masks for classes A, B, and C are shown in Table 3.2. Theconcept does not apply to classes D and E

Logical Addressing - IPv4 Addresses (4)

The maskcan help us to find the netid and the hostid. For example, the mask for a classA address has eight 1s, which means the first 8 bits of any address in class Adefine the netid; the next 24 bits define the hostid. The last column of Table3.2 shows the mask in the form /nwhere n can be 8, 16, or 24 inclassful addressing. This notation is also called slash notation orClasslessInterdomain Routing (CIDR) notation. The notation is used in classlessaddressing,

3.4 Subnetting

If anorganization was granted a large block in class A or B, it could divide theaddresses

intoseveral contiguous groups and assign each group to smaller networks (calledsubnets). Subnetting increases the number of Is in the mask.

3.5 Supernetting

Insupernetting, an organization can combine several class C blocks to create alarger range of addresses. In other words, several networks are combined tocreate a supernetwork or a supemet. An organization can apply for a set ofclass C blocks instead of just one.

3.6 Address Depletion

The flawsin classful addressing scheme combined with the fast growth of the Internet ledto the near depletion of the available addresses. Yet the number of devices onthe Internet is much less than the 232 address space. We have run out of classA and B addresses, and a class C block is too small for most midsizeorganizations. One solution that has alleviated the problem is the idea ofclassless addressing.

4. Classless Addressing

Toovercome address depletion and give more organizations access to the Internet,classless addressing was designed and implemented. In this scheme, there are noclasses, but the addresses are still granted in blocks.

4.1 Address Blocks

Inclassless addressing, when an entity, small or large, needs to be connected tothe Internet, it is granted a block (range) of addresses. The size of the blockvaries based on the nature and size of the entity. For example, a household maybe given only two addresses; a large organization may be given thousands ofaddresses. An ISP, as the Internet service provider, may be given thousands orhundreds of thousands based on the number of customers it may serve.

Restrictionsto simplify the handling of addresses, the Internet authorities impose threerestrictions on classless address blocks:

1. Theaddresses in a block must be contiguous, one after another.

2. Thenumber of addresses in a block must be a power of 2 (I, 2, 4, 8 ...).

3. The firstaddress must be evenly divisible by the number of addresses.

Example 3.5

Figure3.3 shows a block of addresses, in both binary and dotted-decimal notation,granted to a small business that needs 16 addresses.

Logical Addressing - IPv4 Addresses (5)

We cansee that the restrictions are applied to this block. The addresses arecontiguous. The number of addresses is a power of 2 (16 = 24), and the firstaddress is divisible by 16. The first address, when converted to a decimalnumber, is 3,440,387,360, which when divided by 16 results in 215,024,210.

4.2 Mask

A betterway to define a block of addresses is to select any address in the block andthe mask. As we discussed before, a mask is a 32-bit number in which the nleftmost bits are 1s and the 32 - n rightmost bits are 0s. However, inclassless addressing the mask for a block can take any value from 0 to 32. Itis very convenient to give just the value of n preceded by a slash.

First Address: The first address in the blockcan be found by setting the 32 - n rightmost bits inthe binary notation of theaddress to 0s. The first address in the block can be found by setting therightmost 32 - n bits to 0s.

Example 3.6

A blockof addresses is granted to a small organization. We know that one of theaddresses is 205.16.37.39/28. What is the first address in the block?

Solution

Thebinary representation of the given address is 11001101 00010000 00100101 00100I 11. If we set 32 - 28 rightmost bits to 0, we get 11001101 0001000001001010010000 or 205.16.37.32.

Last Address: The last address in the blockcan be found by setting the 32 - n rightmost bits inthe binary notation of theaddress to Is. The last address in the block can be found by setting therightmost 32 - n bits to Is.

Example 3.7

Find thelast address for the block in Example 3.6.

Solution

Thebinary representation of the given address is 11001101000100000010010100100111. If we set 32 - 28 rightmost bits to 1, we get11001101 00010000 001001010010 1111 or 205.16.37.47.

Number of Addresses: Thenumber of addresses in the block is the difference between the lastand firstaddress. It can easily be found using the formula 232- n.

Example 3.8

Find thenumber of addresses in Example 3.6.

Solution

The valueof n is 28, which means that number of addresses is 232- 28 or 16.

Example 3.9

Anotherway to find the first address, the last address, and the number of addresses isto represent the mask as a 32-bit binary (or 8-digit hexadecimal) number. Thisis particularly useful when we are writing a program to find these pieces ofinformation. In Example 19.5 the /28 can be represented as 11111111 1111111111111111 11110000 (twenty-eight 1s and four 0s).

Find

a. Thefirst address

b. Thelast address

c. Thenumber of addresses

Solution

a. Thefirst address can be found by ANDing the given addresses with the mask. ANDinghere is done bit by bit. The result of ANDing 2 bits is 1 if both bits are Is;the result is 0 otherwise.

Address:11001101 00010000 00100101 00100111

Mask:11111111 11111111 11111111 11110000

Firstaddress: 11001101 00010000 00100101 00100000

b. Thelast address can be found by ORing the given addresses with the complement ofthe mask. ORing here is done bit by bit. The result of ORing 2 bits is 0 ifboth bits are 0s; the result is 1 otherwise. The complement of a number isfound by changing each 1 to 0 and each 0 to 1.

Address:11001101 00010000 00100101 00100111

Maskcomplement: 00000000 00000000 00000000 00001111

Lastaddress: 11001101 00010000 00100101 00101111

c. Thenumber of addresses can be found by complementing the mask, interpreting it asa decimal number, and adding 1 to it.

Maskcomplement: 000000000 00000000 00000000 00001111

Number ofaddresses: 15 + 1 =16

4.3 Network Addresses

A veryimportant concept in IP addressing is the network address. When an organization

is givena block of addresses, the organization is free to allocate the addresses to thedevices that need to be connected to the Internet. The first address in theclass, however, is normally (not always) treated as a special address. Thefirst address is called the network address and defines the organizationnetwork. It defines the organization itself to the rest of the world.

Logical Addressing - IPv4 Addresses (6)

Theorganization network is connected to the Internet via a router. The router hastwo addresses. One belongs to the granted block; the other belongs to thenetwork that is at the other side of the router. We call the second addressx.y.z.t/n because we do not know anything about the network it is connected toat the other side. All messages destined for addresses in the organizationblock (205.16.37.32 to 205.16.37.47) are sent, directly or indirectly, tox.y.z.t/n. We say directly or indirectly because we do not know the structure ofthe network to which the other side of the router is connected. The firstaddress in a block is normally not assigned to any device; it is used as thenetwork address that represents the organization to the rest of the world.

4.4 Hierarchy

IPaddresses, like other addresses or identifiers we encounter these days, havelevels of hierarchy. For example, a telephone network in North America hasthree levels of hierarchy. The leftmost three digits define the area code, thenext three digits define the exchange, the last four digits define theconnection of the local loop to the central office. Figure 3.5 shows thestructure of a hierarchical telephone number

Logical Addressing - IPv4 Addresses (7)

Two-Level Hierarchy: No Subnetting

An IPaddress can define only two levels of hierarchy when not subnetted. The nleftmost bits of the address x.y.z.tJn define the network (organizationnetwork); the 32 – n rightmost bits define the particular host (computer orrouter) to the network. The two common terms are prefix and suffix. The part ofthe address that defines the network is called the prefix; the part thatdefines the host is called the suffix. Figure 3.6 shows the hierarchicalstructure of an IPv4 address.

Logical Addressing - IPv4 Addresses (8)

Theprefix is common to all addresses in the network; the suffix changes from onedevice to another. Each address in the block can be considered as a two-levelhierarchical structure: the leftmost n bits (prefix) define the network; therightmost 32 - n bits define the host.

Note thatapplying the mask of the network, /26 to any of the addresses gives us thenetwork address 17.12.14.0/26. We leave this proof to the reader. We can saythat through subnetting, we have three levels of hierarchy. Note that in ourexample, the subnet prefix length can differ for the subnets as shown in Figure3.8.

Logical Addressing - IPv4 Addresses (9)

More Levels of Hierarchy

Thestructure of classless addressing does not restrict the number of hierarchicallevels. An organization can divide the granted block of addresses intosubblocks. Each subblock can in turn be divided into smaller subblocks. And soon. One example of this is seen in the ISPs. A national ISP can divide agranted large block into smaller blocks and assign each of them to a regionalISP. A regional ISP can divide the block received from the national ISP intosmaller blocks and assign each one to a local ISP. A local ISP can divide theblock received from the

regionalISP into smaller blocks and assign each one to a different organization.Finally, an organization can divide the received block and make several subnetsout of it.

5. Address Allocation

The nextissue in classless addressing is address allocation. The ultimateresponsibility of address allocation is given to a global authority called theInternet Corporation for Assigned Names and Addresses (ICANN). However, ICANNdoes not normally allocate addresses to individual organizations. It assigns alarge block of addresses to an ISP. Each ISP, in turn, divides its assignedblock into smaller subblocks and grants the subblocks to its customers. Inother words, an ISP receives one large block to be distributed to its Internetusers. This is called address aggregation: many blocks of addresses areaggregated in one block and granted to one ISP.

Example 3.10

An ISP isgranted a block of addresses starting with 190.100.0.0/16 (65,536 addresses).The ISP needs to distribute these addresses to three groups of customers asfollows:

a)The first group has 64 customers; each needs 256addresses.

b) Thesecond group has 128 customers; each needs 128 addresses.

c)The third group has 128 customers; each needs 64addresses.

Designthe subblocks and find out how many addresses are still available after theseallocations.

Solution

Figure 3.9 shows the situation.

Logical Addressing - IPv4 Addresses (10)

1. Group1

For thisgroup, each customer needs 256 addresses. This means that 8 (log2256) bits areneeded to define each host. The prefix length is then 32 - 8 =24. The addressesare

1stCustomer: 190.100.0.0/24 100.0.255/24

2ndCustomer: 190.100.1.0/24190 190.100.1.255/24

64thCustomer: 190.100.63.0/24 190.100.63.255/24

Total =64X 256 =16,384

2. Group2

For thisgroup, each customer needs 128 addresses. This means that 7 (10g2 128) bits areneeded to define each host. The prefix length is then 32 - 7 =25. The addressesare

3. Group3

For thisgroup, each customer needs 64 addresses. This means that 6 (log2 64) bits areneeded to each host. The prefix length is then 32 - 6 =26. The addresses are

1stCustomer: 190.100.128.0/26 190.100.128.63/26

2ndCustomer: 190.100.128.64/26 190.100.128.127/26

128thCustomer: 190.100.159.192/26 190.100.159.255/26

Total =128X 64 =8192

Number ofgranted addresses to the ISP: 65,536

Number ofallocated addresses by the ISP: 40,960

Number ofavailable addresses: 24,576

  • Prev Page
  • Next Page

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail

Computer Networks : Network Layer : Logical Addressing - IPv4 Addresses |

Logical Addressing - IPv4 Addresses (2024)

References

Top Articles
Latest Posts
Article information

Author: Tish Haag

Last Updated:

Views: 6287

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Tish Haag

Birthday: 1999-11-18

Address: 30256 Tara Expressway, Kutchburgh, VT 92892-0078

Phone: +4215847628708

Job: Internal Consulting Engineer

Hobby: Roller skating, Roller skating, Kayaking, Flying, Graffiti, Ghost hunting, scrapbook

Introduction: My name is Tish Haag, I am a excited, delightful, curious, beautiful, agreeable, enchanting, fancy person who loves writing and wants to share my knowledge and understanding with you.