In this lesson, you will learn about logical addressing scheme of networking layer, this layer deals with ipadderessing and has a class based and class addressing scheme. You will also learn concept of sub netting and super netting.

An IPv4 address is 32 bit address that uniquely and universally defines the connection of a device.

Unique means no two devices can have same address at the same time on Internet.

An address space is the total number of Addresses used by IPv4 protocol. If N bit address is used, the total addresses in the address space will be 2N.

232 = 42, 94,967,296

Notations

Binary Notation: 10101101. 10101000. 01010111.11001000

Decimal Notation: 117.23.42.223

Each of the octet range 0 to 255.

In classful addressing, the address space is divided in to 5 classes: A, B, C, D, and E.

Binary Notation starting bits of first octet will tell the class.

 Class First Octet Second octet Third octet Fourth octet A 0 Any Any Any B 10 Any Any Any C 110 Any Any Any D 1110 Any Any any E 1111 Any Any any

In decimal notation, range of first octet tells the class to which the address belongs.

 Class First Octet Second octet Third octet Fourth octet A 0 -127 B 128 – 191 C 192 – 223 D 224 – 239 E 240 – 255

Classes and Blocks

Each of the class is divided into fixed number of blocks and each block has a fixed size.

 Class Number of Blocks Block Size Application A 128 16,777,216 Unicast B 16384 65536 Unicast C 2,097,152 256 Unicast D 1 268,435,456 Multicast E 1 268,435,456 Reserved

There is flaw with this classful addressing. Class A is used by large organization with large number of hosts and routers, but it’s too big for any organization. Class B for mid size organization, but this also too big for organization leading to waste of ipaddress.

Class C is too small for organizations.

``````
``````

In classful logical addressing, the address is divided into two parts – Netid and hosted

For example, Class A address, the first byte is network id and the rest 3 bytes are Hostid.

 Class Binary Dotted-Decimal CIDR A 11111111. 00000000.00000000.00000000 255.0.0.0 /8 B 11111111. 11111111. 00000000.00000000 255.255.0.0 /16 C 11111111.11111111.11111111.00000000 255.255.255.0 /24

Default mask help us find the Netid and hosted of an ipaddress.

The class in the form /n is called CIDR (Classless Inter Domain Routing) which is used for Classless logical addressing.

Subnetting

Classful logical addressing is obsolete now. An organization would get large number of class A or Class B address and then these address would be subnetted means assign in logical groups to small networks called Subnets.

Supernetting

Large number of addresses of class A and B were depleted. To create a larger network, organizations combined class C address into one group called Supernets and process is known as Supernetting.

``````
``````

Due to depletion of addresses, Classless Logical Addressing was introduced to connect more organizations to the Internet.

In classless logical addressing, size of the address block depends on size and nature of the entity. For example, ISP may get thousands of address; home user may get 2 addresses. To manage ipaddress, three restrictions were imposed

1. Address in a block must be contagious
2. Number of address in the block must be power of 2.
3. The first address must be evenly divisible by the number of addresses.
• 203.100.23.32 – first
• 203.100.23.47 – last

Condition 1: address must be contagious .It is contagious.

Condition 2: The number of addresses is 24 = 16.

Condition 3: first address when converted to decimal is divisible by 16.

3,412,334,368/16 = 213270898

How to convert ipaddress to decimal equivalent?

129. 15. 14. 17

2563 x 129 + 2562 x 15 + 2561 x 14 + 2560 x 17

= 16777216 x 129 + 65536 x 15 + 256 x 14

= 216420864 + 983040 + 3584 + 17

= 217407505

In IPv4 addressing, a block of addresses can be defined as x.y.z.t/n,

In which x.y.z.t defines one of the addresses and the /n defines the mask.

An ipaddress has network address of which we need to find the first and last address for two reasons – first address is address of routing or hub device and last address gives the total size of a block of addresses.

``````
First address in the block can be found by setting rightmost 32-n bits to 0s. The last address in the block can be found by setting rightmost bit to 1s.
``````

Solution:

1100 1101. 0001 0000. 00100101. 0010 0101

32 – 28 = 4 bit

1100 1101. 0001 0000. 00100101. 0010 0000

1100 1101. 0001 0000. 00100101. 0010 0101

32 – 28 = 4 bit

1100 1101. 0001 0000. 00100101. 0010 1111 = 205.16.37.47/28

The number of address in the block can be found by using formula, 232-n.

IInd Method

11111111. 11111111.11111111. 11110000

1100 1101. 00010000.00100101. 00100101

—————————————————————-

11001101 00010000 00100101 00100000 -> 205.16.27.32

The last address can be found by ORing any address in the block by complement of the mask.

00000000. 00000000. 00000000.00001111

1100 1101.00010000.00100101. 00100101

—————————————————————-

11001101. 00010000. 00100101. 00101111 -> 205.16.27.47/28

When an organization is given group of network addresses, then it is free to assign the address to any number of devices that want to connect to internet.

The first address is network address and used in the router and identifies the network in Internet

Two level hierarchy: no sub netting

Each ipaddress in the block has two level hierarchy structure, the leftmost, n bit defines the Network and rightmost 32-n bits defines the host.

Three level hierarchy: subnetting

Large block of addresses are broken in subnet with small blocks of addresses and own subnet masks. The organization has a different address to receive information from the Internet and router routes the message to each subnet and receive from subnets.

For example,

17.12.40.0/26 address is given with 64 addresses. Organization has 3 branches and each want 32, 16 and 16 addresses respectively.

25 = 32, 24 = 16

• Mask for the first subnet be n1, then 232-n1 implies that n1 = 27 because 32 – 27 = 5 bits.

First address of Subnet1 is can be found using any address 17.12.40.29/27

00010001. 00001100. 00101000. 00011011 set right most 5 bit to 0s.

00010001. 00001100. 00101000. 00000000 -> 17.12.40.0/27

• Mask for the second subnet be n2, then 232-n2 implies that n2 = 28 because 32 – 28 = 4 bits.

First address of Subnet2 is can be found using any address 17.12.40. 46/28

00010001. 00001100. 00101000. 00101110 set right most 4 bit to 0s.

00010001. 00001100. 00101000. 00100000 -> 17.12.40.32/28

• Mask for the Third subnet be n3, then 232-n3 implies that n3 = 28 because 32 – 28 = 4 bits.

First address of Subnet3 is can be found using any address 17.12.40. 53/28

00010001. 00001100. 00101000. 00110101 set right most 4 bit to 0s.

00010001. 00001100. 00101000. 00110000 -> 17.12.40.48/28

More levels of hierarchy

The structure of classless addressing does not prevent more hierarchy. For example, the International ISPs get lot of ipaddresses which is divided among the National ISPs. The national ISP then divide the ipaddress into Regional ISPs and Regional ISP gives the ipaddress to the organization and which divides the group of ipaddress further.

The address allocation is responsibility of ICANN (Internet Corporation for Assigned Names and Addresses). It assigns large block of ipaddresses to ISPs and ISP divided these blocks into smaller sub-blocks and give it to Local ISP, and so on.

This is called address aggregation; many blocks of addresses aggregated into one block.

Suppose an address 190.100.0.0/16 has 65535 addresses, must be distributed amount customers.

1st group wants 64 customers and each want 256 addresses.

2nd group wants 16 customers and each customer want 128 addresses.

Solution:

190.100.0.0 to 190.100.63.0 covers 64 customer. Now each customer has 256 hosts then address must have 8 bits for 256 hosts.

190.100.0.0/24 to 190.100.63.0/24 covers 256 host for each customer.

Similarly,

190.100.64.0 to 190.100.127.128 covers 128 customer. Each customer has 128 hosts then address must have 7 bits for 128 hosts.

190.100.64.0/25 to 190.100.127.128/25 cover 128 hosts each.

NAT enables one user to have large number of addresses internally and one address or a small set of address externally.

The Internet Authorities have reserved 3 set of addresses for private networks which any one can use.

 Range Total 10.0.0.0 to 10.255.255.255 224 172.16.0.0 to 172.31.255.255 220 192.168.0.0 to 192.168.255.255 216

The site must have single connection to the global Internet through a router that runs the NAT software.

192.168.10.3

192.168.10.2

192.168.10.1

The rest of the Internet only sees the NAT global address which is 200.15.100.12 but the private address is hidden.

All packets intended for Internet goes through the router which change the source address with the NAT global address. Similarly, incoming packet goes through the router in which destination address is changed to private addresses.

Translation table

The problem of sending packet with source address is solved by changing the source address at router. But routing to correct destination inside a private network from Internet is different problem.

This is done using a translation table.

In this scheme, the translation table has two columns, private address and external address. When a packet is sent to external address, the router change the source address and also make a note of private address in the translation table of the source along with external address. When a response from the same destination is received, it is used as for identifying the private address of the destination in side NAT.

In the scheme above, the communication is always initiated by private network. The NAT is used by the ISP for running many server programs, because the private network of organizations cannot run programs that need internet access.

For example, email server, etc.

In this scheme, the NAT router uses four global addresses. So four private network hosts can communicate with the same external host because each address pair defines one connection.

192.168.100.1 -> 200.15.100.20 -> 200.33.23.22

192.168.100.2 -> 200.15.100.21 -> 200.33.23.22

There is few drawbacks with connections, first no more than 4 connection is allowed and second, a private network host cannot access two server programs at the same time.

Using both ipaddress and port number

To allow many-to-many connections, we need more information in the translation table.

If the translation table also has information for about transport layer then we have not problem creating more connections.

 Private Address Private Port External Address External Ports Transport protocol 192.168.100.1 1400 200.12.100.22 80 TCP 192.168.100.2 1401 200.12.100.23 80 TCP … … … … …

When a response is received then a combination of source address and the destination port number decide the Host address of the destination private network.

The internal port number must be unique.

NAT and ISP

Suppose the ISP has 1000 addresses, but it has 10000 customers. To server 10000 customer it provide them with the private address and use NAT to translate the addresses using one of the 1000 addresses.

Bibliography

Andrew S. Tanenbaum, David Wetherall. n.d. Computer Networks. Pearson, 23-Jul-2013.

Behrouz A. Forouzan, Sophia Chung Fegan. n.d. Data Communications and Networking, Fourth Edition. mcgraw hill education.

The post Network Layer – Logical Addressing appeared first on NotesForMSc.

This post first appeared on Notesformsc, please read the originial post: here