104
1 04\08\2 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

Embed Size (px)

Citation preview

Page 1: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

1 04\08\2010 Unit-VI Network Layer

Unit –6

Network Layer:

Logical Addressing

Page 2: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

2 04\08\2010 Unit-VI Network Layer

• Ipv4 addressesIpv4 addresses

• Ipv6 addressesIpv6 addresses

Overview

Page 3: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

3 04\08\2010 Unit-VI Network Layer

ADDRESSINGADDRESSING

Four levels of addresses are used in an internet Four levels of addresses are used in an internet employing the TCP/IP protocols: employing the TCP/IP protocols: physical, logical, port, physical, logical, port, and specificand specific..

Page 4: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

4 04\08\2010 Unit-VI Network Layer

• A network adapter has a unique and permanent physical address.

• A Physical address is also called MAC address is a 48-bit flat address burned into the ROM of the NIC (Network Interface Card) card at the factory which is a Layer1 device of the OSI model.

• On a local area network, low-lying hardware-conscious protocols deliver data across the physical network using the adapter's physical address.

• On a basic ethernet network, for example, a computer sends messages directly onto the transmission medium.

• The network adapter of each computer listens to every transmission on the local network to determine whether a message is addressed to its own physical address.

Physical Addressing

Page 5: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

5 04\08\2010 Unit-VI Network Layer

Physical Addressing

Page 6: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

6 04\08\2010 Unit-VI Network Layer

• A Logical address also called IP address is a 32- bit address assigned to each system in a network.

• This works in Layer-3 of OSI Model.

• This would be generally the IP address.

Logical Addressing

Page 7: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

7 04\08\2010 Unit-VI Network Layer

Logical Addressing

Page 8: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

8 04\08\2010 Unit-VI Network Layer

Logical Addressing

Page 9: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

9 04\08\2010 Unit-VI Network Layer

Logical Addressing

Page 10: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

10 04\08\2010 Unit-VI Network Layer

Logical Addressing

Page 11: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

11 04\08\2010 Unit-VI Network Layer

IP Addresses

Page 12: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

12 04\08\2010 Unit-VI Network Layer

The physical addresses will change from hop to hop,

but the logical addresses usually remain the same.

Page 13: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

13 04\08\2010 Unit-VI Network Layer

Port AddressA single wire connects the network to the distant computer, but there may be many applications on that machine-a web server, an ftp server, a telnet server, etc.-waiting for somebody to connect.

So the question arises: How do you use one wire and one IP address to connect to the right application? The answer: Ports.

Port address is transport layer ID (similar to IP in Network Layer) which identify the application on the host.

A port address is a 16-bit address represented by one decimal number as shown.

Telnet Port 23

Mail (smtp, or send mail) Port 25

World Wide Web Port 80

Post Office (pop, or get mail) Port 110

News (nntp) Port 119

Page 14: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

14 04\08\2010 Unit-VI Network Layer

IPv4 ADDRESSESIPv4 ADDRESSES

Page 15: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

15 04\08\2010 Unit-VI Network Layer

IPv4 ADDRESSESIPv4 ADDRESSES

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

• Address Space Notations

• Classful Addressing

• Classless Addressing

• Network Address Translation (NAT)

Page 16: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

16 04\08\2010 Unit-VI Network Layer

• IPv4 protocol address has an address spaceIPv4 protocol address has an address space• An address is the total number of addresses used by the An address is the total number of addresses used by the

protocol. protocol. • If a protocol uses N bits to define an address the address If a protocol uses N bits to define an address the address

space is 2space is 2NN value. value.

• Notations Notations • Binary Notation and Dotted Decimal Notation• Binary Notation: 32 bits are used each octet is referred as

byte, 4 byte address• Dotted Decimal Notation: Written in Decimal point and each

byte is separated by dots.

IPv4 ADDRESSES

Page 17: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

17 04\08\2010 Unit-VI Network Layer

An IPv4 address is 32 bits long.

The IPv4 addresses are unique and universal.

The address space of IPv4 is 232 or 4,294,967,296.

• An IP address is a 32-bit sequence of 1s and 0s.• To make the IP address easier to use, the address

is usually written as four decimal numbers separated by periods.

• This way of writing the address is called the dotted decimal format.

IPv4 ADDRESSES

Page 18: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

18 04\08\2010 Unit-VI Network Layer

Classful Addressing

Page 19: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

19 04\08\2010 Unit-VI Network Layer

Defined when IP was standardized in 1981IP addresses are 32-bit long and consist of:• a network address part – network identifier• a host address part – host number within that network

IP addresses are grouped into classes (A,B,C) depending on the size of the network identifier and the host part of the addressA fourth class (Class D) was defined later (1988) for Multicast addresses

Internet Addresses (IP Addresses)

Page 20: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

20 04\08\2010 Unit-VI Network Layer

Class A• 126 networks (0 and 127 reserved) (1 byte starts from but

MSB bit is always 0)• Assigned to very large size networks where number of

hosts 65K to16M

Class B• 16384 networks• Assigned to Intermediate size networks where number of

hosts 256 to 65K

Class C• 2097152 networks• Assigned to smaller networks where #hosts < 256

Internet Address Classes

Page 21: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

21 04\08\2010 Unit-VI Network Layer

Finding the classes in binary and dotted-decimal notationFinding the classes in binary and dotted-decimal notation

Number of blocks and block size in classful IPv4 addressingNumber of blocks and block size in classful IPv4 addressing

Page 22: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

22 04\08\2010 Unit-VI Network Layer

Every IP address has two parts: 1. Network2. Host

IP addresses are divided into classes A,B and C to define large, medium, and small networks.

The Class D address was created to enable multicasting.

IETF reserves Class E addresses for its own research.

Page 23: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

23 04\08\2010 Unit-VI Network Layer

Certain host addresses are reserved and cannot be assigned to devices on a network. An IP address that has binary 0s in all host bit positions is reserved for the network address. An IP address that has binary 1s in all host bit positions is reserved for the broadcast address.

Reserved IP ADDRESSES

Page 24: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

24 04\08\2010 Unit-VI Network Layer

Change the following IPv4 addresses from binary notation to dotted-decimal notation.

Solution

Example

Page 25: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

25 04\08\2010 Unit-VI Network Layer

Change the following IPv4 addresses from dotted-decimal notation to binary notation.

Solution

Example

Page 26: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

26 04\08\2010 Unit-VI Network Layer

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

Solution

a. There must be no leading zero (045).

b. There can be no more than four numbers.

c. Each number needs to be less than or equal to 255.

d. A mixture of binary notation and dotted-decimal notation is not allowed.

Example

Page 27: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

27 04\08\2010 Unit-VI Network Layer

Find the class of each address.

a. 00000001 00001011 00001011 11101111

b. 11000001 10000011 00011011 11111111

c. 14.23.120.8

d. 252.5.15.111

Solution

a. The first bit is 0. This is a class A address.

b. The first 2 bits are 1; the third bit is 0. This is a class C address.

c. The first byte is 14; the class is A.

d. The first byte is 252; the class is E.

Example

Page 28: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

28 04\08\2010 Unit-VI Network Layer

Netid and HostidIn classful addressing an IP address in class A,B, C is divided into netid and hostidIn class A one byte defines the netid and 3 bytes defines the host IDIn class B 2 byte defines the netid and 2 bytes defines the host IDIn class C 3 byte defines the netid and 1 bytes defines the host ID

Netid and Hostid

Page 29: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

29 04\08\2010 Unit-VI Network Layer

MaskThe mask helps to find the netid and hostidIn class A first 8 bits defines the netid; the next 24 bits hostid, hence in this first 8 are 1s. /n i.e 8 or 16 or 24 shows the mask for each class.This /n notation is called Classless Interdomain Routing (CIDR)

Mask

Default masks for classful addressingDefault masks for classful addressing

Page 30: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

30 04\08\2010 Unit-VI Network Layer

Subnets

Page 31: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

31 04\08\2010 Unit-VI Network Layer

Class A usually too big

Class C often too small

Not enough Class Bs

Inefficient utilisation of address space

Solution: Extending the network part of the address: Subnetting

In classful addressing, a large part of the available addresses were wasted.

Problems with Classes

Page 32: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

32 04\08\2010 Unit-VI Network Layer

Subnets

.

A campus network consisting of LANs for various departments

Subnetting

Page 33: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

33 04\08\2010 Unit-VI Network Layer

Subnet Mask

Subnet masks are applied to an IP address to identify the Network portion and the Host portion of the address.

A bitwise logical AND operation between the address and the subnet mask s performed in order to find the Network Address or number.

Default Subnet Masks

Class A - 255.0.0.0

• 11111111.00000000.00000000.00000000

Class B - 255.255.0.0

• 11111111.11111111.00000000.00000000

Class C - 255.255.255.0

• 11111111.11111111.11111111.00000000

Subnetting

Page 34: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

34 04\08\2010 Unit-VI Network Layer

Logical Bitwise AND Operation

Example

• 140.179.240.200It’s a Class B, so the subnet mask is:

• 255.255.0.0In Binary:

10001100.10110011.11110000.11001000

11111111.11111111.00000000.00000000

10001100.10110011.00000000.00000000

By doing this, the computer has found that Network Address is 140.179.0.0

Subnetting

Page 35: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

35 04\08\2010 Unit-VI Network Layer

Another Example:

Suppose we have the address of: 206.15.143.89?

Class C

255.255.255.0

206.15.143.0

0.0.0.89

What class is it?

What is the subnet mask?

What is the Network Address?

What is the host portion of the address?

Subnetting

Page 36: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

36 04\08\2010 Unit-VI Network Layer

You can manipulate your subnet mask in order to create more network addresses.

If you have a Class C network, how many individual host addresses can you have?

• 1 to 254

• Remember, you can’t have all “0”s and all “1”s in the host portion of the address (Reserved address).

• So we cannot use 206.25.143.0 (all “0”s) or 206.25.143.255 (all “1”s) as a host address.\

• Remember, an address of all “0”s or all “1”s cannot be used in the last octet (or host portion). All “0”s signify the Network Address and all “1”s signify the broadcast address

Subnetting

Page 37: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

37 04\08\2010 Unit-VI Network Layer

Example

We have 1 Class C Network (206.15.143.0)

And we have 254 host address (1 to 254)

But what if our LAN has 5 networks in it and each network has no more than 30 hosts on it?

Do we apply for 4 more Class C licenses, so we have one for each network?

We would be wasting 224 addresses on each network, a total of 1120 addresses

Subnetting

Page 38: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

38 04\08\2010 Unit-VI Network Layer

Subnetting is a way of taking an existing class license and breaking it down to create more Network Addresses.

This will always reduce the number of host addresses for a given network.

Subnetting makes more efficient use of the address.

Subnetting

Page 39: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

39 04\08\2010 Unit-VI Network Layer

How Does Subnetting Work?

Additional bits can be added (changed from 0 to 1) to the subnet mask to further subnet, or breakdown, a network.

When the logical AND is done by the computer, the result will give it a new Network (or Subnet) Address.

Subnetting

Page 40: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

40 04\08\2010 Unit-VI Network Layer

We ask our ISP for a Class C license.

They give us the Class C bank of 206.15.143.0

This gives us 1 Network (206.15.143.0) with the potential for 254 host addresses (206.15.143.1 to 206.15.143.254).

But we have a LAN made up of 5 Networks with the largest one serving 25 hosts.

So we need to Subnet our 1 IP address...

Subnetting

Page 41: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

41 04\08\2010 Unit-VI Network Layer

So How Does This Work?

To calculate the number of subnets (networks) and/or hosts, we need to do some math:

Use the formula 2n-2 where the n can represent either how many subnets (networks) needed OR how many hosts per subnet needed (where -2 is 000000000 and 11111111 addresses are not used).

Subnetting

Page 42: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

42 04\08\2010 Unit-VI Network Layer

So How Does This Work?

We know we need at least 5 subnets. So 23-2 will give us 6 subnet addresses (Network Addresses).

We know we need at least 25 hosts per network. 25-2 will give us 30 hosts per subnet (network).

This will work, because we can steal the first 3 bits from the host’s portion of the address to give to the network portion and still have 5 (8-3) left for the host portion:

Subnetting

Page 43: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

43 04\08\2010 Unit-VI Network Layer

Break it down:

Let’s go back to what portion is what:

We have a Class C address:NNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

With a Subnet mask of:11111111.11111111.11111111.00000000

We need to steal 3 bits from the host portion to give it to the Network portion:

NNNNNNNN.NNNNNNNN.NNNNNNNN.NNNHHHHH

Subnetting

Page 44: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

44 04\08\2010 Unit-VI Network Layer

Break it down:

NNNNNNNN.NNNNNNNN.NNNNNNNN.NNNHHHHH

This will change our subnet mask to the following:

11111111.11111111.11111111.11100000

Above is how the computer will see our new subnet mask, but we need to express it in decimal form as well:

255.255.255.224 128+64+32=224

Subnetting

Page 45: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

45 04\08\2010 Unit-VI Network Layer

What address is what?

Which of our 254 addresses will be a Subnet (or Network) address and which will be our host addresses?

Because we are using the first 3 bits for our subnet mask, we can configure them into eight different ways (binary form):

Subnetting

Page 46: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

46 04\08\2010 Unit-VI Network Layer

What address is what?

Which of our 254 addresses will be a Subnet (or Network) address and which will be our host addresses?

Because we are using the first 3 bits for our subnet mask, we can configure them into eight different ways (binary form):

000 001010 011100 101110 111

Subnetting

Page 47: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

47 04\08\2010 Unit-VI Network Layer

What address is what?

We cannot use all “0”s or all “1”s000 001010 011100 101110 111

•We are left with 6 useable network numbers.

Subnetting

Page 48: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

48 04\08\2010 Unit-VI Network Layer

Network (Subnet) Addresses

Remember our values:

128 64 32 16 8 4 2 1 Equals

Now our 3 bit configurations:

0 0 1 H H H H H 32

0 1 0 H H H H H 64

0 1 1 H H H H H 96

1 0 0 H H H H H 128

1 0 1 H H H H H 160

1 1 0 H H H H H 192

Subnetting

Page 49: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

49 04\08\2010 Unit-VI Network Layer

Network (Subnet) Addresses

0 0 1 h h h h h 32

0 1 0 h h h h h 64

0 1 1 h h h h h 96

1 0 0 h h h h h 128

1 0 1 h h h h h 160

1 1 0 h h h h h 192

Each of these numbers becomes the Network Address of their subnet...

Subnetting

Page 50: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

50 04\08\2010 Unit-VI Network Layer

Network (Subnet) Addresses

206.15.143.32

206.15.143.64

206.15.143.96

206.15.143.128

206.15.143.160

206.15.143.192

Subnetting

Page 51: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

51 04\08\2010 Unit-VI Network Layer

host Addresses

The device assigned the first address will receive the first number AFTER the network address shown before.

206.15.143.33 or 32+1

0 0 1 0 0 0 0 1

And the last address in the Network will look like this:

206.15.143.62

0 0 1 1 1 1 1 0

*Remember, we cannot use all “1”s, that is the broadcast address (206.15.143.63)

Subnetting

Page 52: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

52 04\08\2010 Unit-VI Network Layer

Host Addresses

The next network will start at 206.15.143.64

The first IP address on this subnet network will receive:

206.15.143.65

0 1 0 0 0 0 0 1

And the last address in the Network will receive: 206.15.143.94

0 1 0 1 1 1 1 0

*Remember, the broadcast address (206.15.143.95)

Subnetting

Page 53: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

53 04\08\2010 Unit-VI Network Layer

Can you figure out the rest?

Network: Host Range

206.15.143.32 206.15.143.32 to 206.15.143.62

206.15.143.64 206.15.143.65 to 206.15.143.94

206.15.143.96 206.15.143.97 to 206.15.143.126

206.15.143.128 206.15.143.129 to 206.15.143.158

206.15.143.160 206.15.143.161 to 206.15.143.190

206.15.143.192 206.15.143.193 to 206.15.143.222

Subnetting

Page 54: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

54 04\08\2010 Unit-VI Network Layer

How the computer finds the Network Address:

200.15.143.89 An address on the subnet225.225.225.224 The new subnet mask

When the computer does the Logical Bitwise AND Operation it will come up with the following Network Address (or Subnet Address):

11001000.00001111.10001111.01011001= 200.15.143.8911111111.11111111.11111111.11100000 = 255.255.255.22411001000.00001111.10001111.01000000 = 200.15.143.64

This address falls on our 2nd Subnet (Network)

Subnetting

Page 55: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

55 04\08\2010 Unit-VI Network Layer

Classless Addressing

Page 56: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

56 04\08\2010 Unit-VI Network Layer

Classfull Addressing: drawbacks

Classful Addressing + Subnetting

• at least one route per class is advertised in routing updates

Number of networks is doubling faster than once per year

Memory is not growing that fast

Only a few routers can keep the current number of routes

Classless Addressing

Page 57: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

57 04\08\2010 Unit-VI Network Layer

Overview: (Classful) IPv4 Addressing Limits

Provides IP scheme with limitations:

• Class A – 126 networks: 16,777,214 hosts each

• Class B – 65,000 networks: 65,534 hosts each

• Class C – 2 million networks: 254 hosts each

While available addresses were running

out, only 3% of assigned addresses

were actually being used!

• Subnet zero, broadcast addresses,

pool of unused addresses at

Class A and B sites, etc.

Classless Addressing

Page 58: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

58 04\08\2010 Unit-VI Network Layer

Introduced by CIDR - Classless Inter Domain Routing

Networks are grouped (aggregated) into blocks

Blocks of networks are advertised

New way of thinking:

• There are no network numbers, but just address space prefixes

• There are no subnet masks, just prefix lengths

Classless addresses notation

10.181.215.32 /27

10.181.215.32 with mask 255.255.255.224

Binary representation of mask: 11111111.11111111.11111111.11100000

Classless Addressing

Page 59: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

59 04\08\2010 Unit-VI Network Layer

Hosts

. . .

8

16

32

64

128

256

. . .

4096

8192

16384

32768

65535

. . .

Prefix

. . .

/29

/28

/27

/26

/25

/24

. . .

/20

/19

/18

/17

/16

. . .

Classful

. . .

1 C

. . .

16 C’s

32 C’s

64 C’s

128 C’s

1 B

. . .

Subnet Mask

. . .

255.255.255.248

255.255.255.240

255.255.255.224

255.255.255.192

255.255.255.128

255.255.255.0

. . .

255.255.240.0

255.255.224.0

255.255.192.0

255.255.128.0

255.255.0.0

. . .

Classless Address Notation

Page 60: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

60 04\08\2010 Unit-VI Network Layer

Rules:

1. The address in a block must be contiguous.

2.The number of address in a block must be a power of 2 (1, 2, 4, 8, . . .)

3.The first address must be evenly divisible by the number of address .

Classless Addressing

Page 61: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

61 04\08\2010 Unit-VI Network Layer

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

The addresses are contiguous. The number of addresses is a power of 2 (16 = 24), and the first address is divisible by 16. The first address, when converted to a decimal number, is 3,440,387,360, which when divided by 16 results in 215,024,210.

Example

Page 62: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

62 04\08\2010 Unit-VI Network Layer

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.

The first address in the block can be found by setting the rightmost 32 − n bits to 0s.

The last address in the block can be found by setting the rightmost 32 − n bits to 1s.

The number of addresses in the block can be found by using the formula 232−n.

Classless Addressing

Mask: In 32 bit in which n leftmost bits are 1s and the 23-n rightmost bits are 0s

Page 63: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

63 04\08\2010 Unit-VI Network Layer

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

Solution: The binary representation of the given address is

11001101 00010000 00100101 0010011111001101 00010000 00100101 00100111

If we set 32−28 rightmost bits to 0, we get

11001101 00010000 00100101 0010000 11001101 00010000 00100101 0010000

or 205.16.37.32. 205.16.37.32.

Example

Page 64: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

64 04\08\2010 Unit-VI Network Layer

Find the last address for the block 205.16.37.39/28.205.16.37.39/28.

Solution: The binary representation of the given address is

11001101 00010000 00100101 00100111

If we set 32 − 28 rightmost bits to 1, we get

11001101 00010000 00100101 00101111

or

205.16.37.47

Find the number of addresses in Example 19.6.

The value of n is 28, which means that numberof addresses is 2 32−28 or 16.

Example

Page 65: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

65 04\08\2010 Unit-VI Network Layer

Another way to find the first address, the last address, and the number of addresses is to represent the mask as a 32-bit binary (or 8-digit hexadecimal) number. This is particularly useful when we are writing a program to find these pieces of information. In Example 19.5 the /28 can be represented as

11111111 11111111 11111111 11110000

(twenty-eight 1s and four 0s).

Find

a. The first address

b. The last address

c. The number of addresses.

Example

Page 66: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

66 04\08\2010 Unit-VI Network Layer

Solution

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

Example

Page 67: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

67 04\08\2010 Unit-VI Network Layer

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

Example

Page 68: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

68 04\08\2010 Unit-VI Network Layer

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

Example

Page 69: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

69 04\08\2010 Unit-VI Network Layer

1. The first address in a block is normally not assigned to any device; it is used as the network address that represents the organization to the rest of the world.

2. The router has 2 addresses one belongs to the granted block the other belongs to the network that is at other side of the router.

Network Addresses

Network Addresses

Page 70: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

70 04\08\2010 Unit-VI Network Layer

Hierarchy in a telephone network in North America

IP addresses have levels of hierarchy.

In North America telephone network has 3 levels of hierarchy.

1st level defines the area code,2nd level exchange and the last level defines the connection of the local loop.

Hierarchy

Page 71: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

71 04\08\2010 Unit-VI Network Layer

Two levels of hierarchy in an IPv4 address

1. Each address in the block can be considered as a two-level hierarchical structure:

2. The leftmost n bits (prefix) define the network;

3. The rightmost 32 − n bits define the host, and is called as suffix.

Hierarchy

Page 72: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

72 04\08\2010 Unit-VI Network Layer

Three-level hierarchy in an IPv4 address

1. An organization that is granted a block of addresses may create clusters of networks called subnets and divide the addresses between the different networks.

2. The rest of the world considers the organization as one entity; however internally has several subnets.

3. All messages are sent to the router, router routes to subnets.

Hierarchy

Page 73: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

73 04\08\2010 Unit-VI Network Layer

Suppose an organization is given the block 17.12.14.0/26, which contains 64 addressees. The organization has three offices and needs to divide the addresses into three subblocks of 32, 16, and16 addresses. Find the new masks.

Soln:

1.Mask for the first subnet is n1, then232-n1 must be 32 i.e n1=27

2.Mask for the second subnet is n2, then232-n2 must be 16 i.e n2=28

3.Mask for the third subnet is n3, then232-n3 must be 16 i.e n3=28

We can find the subnet addresses from one of addresses in the subnet

In subnet 1 the addresses 17.12.14.29/27 can give us the subnet address if the mask is of /27

Host: 00010001 00001100 00001110 00011101

Mask: 27

Subnet: 00010001 00001100 00001110 0000000 =>17.12.14.0

Example

Page 74: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

74 04\08\2010 Unit-VI Network Layer

In subnet 2 the addresses 17.12.14.45/28 can give us the subnet address if the mask is of /28

Host: 00010001 00001100 00001110 00101101

Mask: 28

Subnet: 00010001 00001100 00001110 0010000 => 17.12.14.32

In subnet 3 the addresses 17.12.14.50/28 can give us the subnet address if the mask is of /28

Host: 00010001 00001100 00001110 00110010

Mask: 28

Subnet: 00010001 00001100 00001110 0011000 =>17.12.14.48

Example

Page 75: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

75 04\08\2010 Unit-VI Network Layer

Configuration and addresses in a subnetted network

Page 76: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

76 04\08\2010 Unit-VI Network Layer

• Global Authority called Internet Corporation for Assigned Names and Addresses(ICANN).

• ICANN allocates addresses to ISP, ISP grants addresses to its customers.

Addresses Allocation

Addresses Allocation

Page 77: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

77 04\08\2010 Unit-VI Network Layer

An ISP is granted 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 as follows:

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

2.The second group has 128 customers; each needs 128 addresses.

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

Design the subblocks and find out how many addresses are still available after these allocations.

Example

Page 78: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

78 04\08\2010 Unit-VI Network Layer

Group 1: In this group, each customer needs 256 addresses. That is 8 (log2 256) bits are needed to define each host. The prefix length is then 32 − 8 = 24. The addresses are

Group 2: In this group, each customer needs 128 addresses. This means that 7 (log2 128) bits are needed to define each host. The prefix length is then 32 − 7 = 25. The addresses are

Example

Page 79: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

79 04\08\2010 Unit-VI Network Layer

Group 3

For this group, each customer needs 64 addresses. This means that 6 (log264) bits are needed to each host. The

prefix length is then 32 − 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536

Number of allocated addresses by the ISP: 40,960

Number of available addresses: 24,576

Example

Page 80: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

80 04\08\2010 Unit-VI Network Layer

An example of address allocation and distribution by an ISP Example

Page 81: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

81 04\08\2010 Unit-VI Network Layer

Network Addresses Translation (NAT)

Page 82: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

82 04\08\2010 Unit-VI Network Layer

Private vs Public IP Addresses• Whatever connects directly into Internet must have public (globally

unique) IP address

• There is a shortage of public IPv4 address

• So Private IP addresses can be used within a private network

• Three address ranges are reserved for private usage• 10.0.0.0/8• 172.16.0.0/16 to 172.31.0.0/16• 192.168.0.0/24 to 192.168.255.0/24

• A private IP is mapped to a Public IP, when the machine has to access the Internet

Network Addresses Translation (NAT)

Page 83: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

83 04\08\2010 Unit-VI Network Layer

NATNAT (Network Address Translation) Maps Private IPs to Public IPs

It is required because of shortage of IPv4 Address

NattingNetwork Addresses Translation (NAT)

Page 84: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

84 04\08\2010 Unit-VI Network Layer

Static NAT : Maps unique Private IP to unique Public IP

Dynamic NAT : Maps Multiple Private IP to a Pool of Public IPs (Port Address Translation : Maps a Public IP and Port Number to a service in Private IP)

NattingNetwork Addresses Translation (NAT)

Page 85: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

85 04\08\2010 Unit-VI Network Layer

Addresses for private networks

Network Addresses Translation (NAT)

Page 86: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

86 04\08\2010 Unit-VI Network Layer

A NAT implementation

Network Addresses Translation (NAT)

Page 87: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

87 04\08\2010 Unit-VI Network Layer

Addresses in Translation

Network Addresses Translation (NAT)

• Outgoing packets go through the NAT router replaces the Outgoing packets go through the NAT router replaces the source addresssource address in the packet with the global NAT address. in the packet with the global NAT address.

• All incoming packet All incoming packet destination destination address are replaced by address are replaced by privateprivate address. address.

Page 88: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

88 04\08\2010 Unit-VI Network Layer

Network Addresses Translation (NAT)

• When the router translates the source address of the outgoing packet it When the router translates the source address of the outgoing packet it also makes note of the destination address.also makes note of the destination address.

• When response comes back from destination address it checks for its When response comes back from destination address it checks for its source address from translation tablesource address from translation table

Page 89: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

89 04\08\2010 Unit-VI Network Layer

Five-column translation table

Network Addresses Translation (NAT)

Page 90: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

90 04\08\2010 Unit-VI Network Layer

An ISP and NAT

NAT and ISP• An ISP that serves dial up customers can use NAT to conserve addresses.An ISP that serves dial up customers can use NAT to conserve addresses.• Suppose ISP has 1000 addresses but has 100,000 customers. Each of the Suppose ISP has 1000 addresses but has 100,000 customers. Each of the

customer is assigned a private network address. The ISP translates each customer is assigned a private network address. The ISP translates each addresses in outgoing packet to one of the 1000 global address.addresses in outgoing packet to one of the 1000 global address.

Page 91: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

91 04\08\2010 Unit-VI Network Layer

IPv6 ADDRESSESIPv6 ADDRESSES

Page 92: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

92 04\08\2010 Unit-VI Network Layer

IPv6 ADDRESSESIPv6 ADDRESSES

Despite all short-term solutions, address depletion is Despite all short-term solutions, address depletion is still a long-term problem for the Internet. This and still a long-term problem for the Internet. This and other problems in the IP protocol itself have been the other problems in the IP protocol itself have been the motivation for IPv6. motivation for IPv6.

StructureAddress Space

Page 93: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

93 04\08\2010 Unit-VI Network Layer

Structure:

•IPv6 address consists of 16 bytes or 128 bits long and specified in hexadecimal colon notation.

•128 bits are divided into 8 sections, each 2 bytes in length.

•2 bytes in hex notation requires 4 hex digits.

IPv6 Addresses

IPv6 address in binary and hexadecimal colon notation

Page 94: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

94 04\08\2010 Unit-VI Network Layer

AbbreviationAbbreviation

•IP address in hexadecimal format is very long and contains many digits are zero.

•The leading zeros of a section are omitted.

IPv6 Addresses

Abbreviated IPv6 addresses

Page 95: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

95 04\08\2010 Unit-VI Network Layer

Expand the address 0:15::1:12:1213 to its original.

Solution

We first need to align the left side of the double colon to the left of the original pattern and the right side of the double colon to the right of the original pattern to find how many 0s we need to replace the double colon.

This means that the original address is.

Example

Page 96: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

96 04\08\2010 Unit-VI Network Layer

Type prefixes for IPv6 addresses

IPv6 Addresses

Page 97: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

97 04\08\2010 Unit-VI Network Layer

Type prefixes for IPv6 addresses (continued)

IPv6 Addresses

Page 98: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

98 04\08\2010 Unit-VI Network Layer

Prefixes for provider-based unicast address

IPv6 Addresses

• Type Identifier: Type Identifier: 3 bit field , defines the address as a provider 3 bit field , defines the address as a provider based addressbased address

• Registry Identifier: Registry Identifier: 5 bit field indicates the agency that has 5 bit field indicates the agency that has registered . INTERNIC center for North America: RIPNIC registered . INTERNIC center for North America: RIPNIC center for European registration APNIC Asian and Pacific center for European registration APNIC Asian and Pacific countriescountries

• Provider Identifier: Provider Identifier: Internet Provider (ISP) 16 bitInternet Provider (ISP) 16 bit

Page 99: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

99 04\08\2010 Unit-VI Network Layer

Prefixes for provider-based unicast address

IPv6 Addresses

• Subscriber Identifier: Subscriber Identifier: 24 bit length is used to identify 24 bit length is used to identify subscriber (Organization)subscriber (Organization)

• Subnet Identifier: Subnet Identifier: Each organization has many subnets and Each organization has many subnets and 32 bit is used for identification32 bit is used for identification

• Node Identifier: Node Identifier: 48 bit is used to identify node connected to 48 bit is used to identify node connected to a subnet.a subnet.

Page 100: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

100 04\08\2010 Unit-VI Network Layer

Multicast address in IPv6IPv6 Addresses

• used to define a group of hosts instead of just oneused to define a group of hosts instead of just one• Flag iFlag is used define group of address as either permanent or s used define group of address as either permanent or

transient.transient.• Scope:Scope:

Anycast AddressesAnycast Addresses

Page 101: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

101 04\08\2010 Unit-VI Network Layer

Reserved addresses in IPv6IPv6 Addresses

• UnspecifiedUnspecified is used when host does not know its own is used when host does not know its own address and sends an inquiry to find its address.address and sends an inquiry to find its address.

• Loopback Loopback is used by a host to test itself without going into is used by a host to test itself without going into the network.the network.

Page 102: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

102 04\08\2010 Unit-VI Network Layer

IPv6 Addresses

• CompatibleCompatible is used during the transition from IPv4 to IPv6. is used during the transition from IPv4 to IPv6. Node using IPv6 want to send a message to another node Node using IPv6 want to send a message to another node using IPv6, but message needs to pass through a part of using IPv6, but message needs to pass through a part of network that still operates in IPv4.network that still operates in IPv4.

• Mapped Mapped address is used when node has migrated to Ipv6 address is used when node has migrated to Ipv6 wants to send a packet to a node still using IPv4wants to send a packet to a node still using IPv4

Page 103: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

103 04\08\2010 Unit-VI Network Layer

Local addresses in IPv6

IPv6 Addresses

Page 104: 1 04\08\2010 Unit-VI Network Layer Unit –6 Network Layer: Logical Addressing

104 04\08\2010 Unit-VI Network Layer

IPv6 Addresses

A large number of consecutive IP address are available starting at 198.16.0.0. Suppose that four organizations, A, B, C, and D, request 4000, 2000, 4000, and 8000 addresses, respectively, and in that order. For each of these, give the first IP address assigned, the last IP address assigned, and the mask in the w.x.y.z/s notation.

To start with, all the requests are rounded up to a power of two. The starting address, ending address, and mask are as follows: A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20

B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21

C: 198.16.32.0 – 198.16.47.255 written as 198.16.32.0/20

D: 198.16.64.0 – 198.16.95.255 written as 198.16.64.0/19