contentscsnotes.upm.edu.my/kelasmaya/web.nsf/0269bceb436307ce... · contents • introduction •...

25
1 CHAPTER 12 : IPV4 1 Contents • Introduction Function of Network Layers IPv4 Notation – Binary Notation – Dotted Decimal Notation IP 4 Add i IPv4 Addressing – Classful Addressing – Classless Addressing 2

Upload: tranminh

Post on 08-Apr-2018

226 views

Category:

Documents


4 download

TRANSCRIPT

1

CHAPTER 12 : IPV41

Contents

• Introduction

• Function of Network Layers

• IPv4 Notation– Binary Notation

– Dotted Decimal Notation

IP 4 Add i• IPv4 Addressing– Classful Addressing

– Classless Addressing2

2

Introduction

• Communication at network layeryEg. host to host, computercommunicate with Internet

• This level of communicationrequired a global address scheme

3

Functions of network layer

4

3

Network layer duties

5

NoteNote::

An IP address is a 32-bit address.

The IP addresses are unique and universal defines the connection to the Internet

6

4

NoteNote::

The address space of IPv4 is 232

or 4,294,967,296

7

IPv4 Notations

• Binary Notation

di l d i 32 bi- displayed in 32 bits

- each octet is often referred to as a byte

- Eg.

01110101 10010101 00011101 00000010

• Dotted-Decimal NotationDotted Decimal Notation- usually written in decimal form with a decimalpoint (dot) separating the byte

- Eg. 117.149.29.2 8

5

Figure. Dotted-decimal notation

9

Example 1Example 1Change the following IP addresses from binary notation to dotted-decimal notation.

a. 10000001 00001011 00001011 11101111

b. 11111001 10011011 11111011 00001111

SolutionSolution

We replace each group of 8 bits with its equivalent decimal number and dd d t f tiadd dots for separation:

a. 129.11.11.239b. 249.155.251.15

10

6

Example 2Example 2Change the following IP addresses from dotted-decimal notation to binary notation.

a. 111.56.45.78

b. 75.45.34.78

SolutionSolution

We replace each decimal number with its binary equivalent

a. 01101111 00111000 00101101 01001110b. 01001011 00101101 00100010 01001110

11

IPv4 Addressing

– Classful Addressing– Classless Addressing

12

7

NoteNote::

In classful addressing, the address space is divided into five

classes: A, B, C, D, and E.

13

Finding the classes in binary and dotted-decimal notation

14

8

Find the class of each address.a. 00000001 00001011 00001011 11101111b 11000001 10000011 00011011 11111111

Example Example 33

b. 11000001 10000011 00011011 11111111c. 14.23.120.8d. 252.5.15.111

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

SolutionSolution

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.

15

Table. Number of blocks and block size in classful IPv4 addressing

16

9

Note

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

Note

17

- IP address is divided into netid and hostid

Netid and Hostid- IP address is divided into netid and hostid- varying lengths, depend on the class of theaddress.Mask (Default Mask)

- A 32-bit address contiguous 1s and contiguous 0s- it can be also written as /nit can be also written as /n- n leftmost bits are 1s and (32-n) rightmost bits are0s- Eg. 234.56.78.69/8

11111111 00000000 00000000 0000000018

10

ClasslessInterdomain Routing

Table. Default masks for classful addressingg

19

Note

Classful addressing, which is almost obsolete, is replaced with classless

addressing.

Note

20

11

• To overcome the address depletion

Classless Addressing

• To overcome the address depletion• No classes• Addresses are granted in blocks (range)• Size of block varies based on the nature &

size of entity

21

To simplify the handling addresses, the Internet

Restriction

authorities impose three restrictions:1. The addresses in a block must be contiguous2. The number of addresses in a block must be

a power of 2 (1, 2, 4, 8, 16 …)3. The first address must be evenly divisible by

the number of addressesthe number of addresses

22

12

The next figure shows a block of addresses,in both binary and dotted-decimal notation,granted to a small business that needs 16

Example

gaddresses.

We can see that the restrictions are appliedto this block. The addresses are contiguous.The number of addresses is a power of 2 (16

24) d th fi t dd i di i ibl b 16= 24), and the first address is divisible by 16.The first address, when converted to adecimal number, is 3,440,387,360, whichwhen divided by 16 results in 215,024,210. 23

Figure. A block of 16 addresses granted to a small organization

24

13

Note

In IPv4 addressing, a block of addresses can be defined as

x.y.z.t /nin which x y z t defines one of the

Note

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

25

Note

The first address in the block can be found by setting the rightmost

32 − n bits to 0s.

Note

26

14

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 in the block?

Example 4Example 4

The binary representation of the given address is11001101 00010000 00100101 00100111

If we set 32−28 rightmost bits to 0, we get 11001101 00010000 00100101 0010000

SolutionSolution

or 205.16.37.32.

This is actually the block shown in Figure slide 24

27

Note

The last address in the block can be found by setting the rightmost

32 − n bits to 1s.

Note

28

15

Find the last address for the block in Example 4

Example Example 55

SolutionSolutionThe binary representation of the given address is

11001101 00010000 00100101 00100111If we set 32 − 28 rightmost bits to 1, we get

11001101 00010000 00100101 00101111 or

205.16.37.47Thi i t ll th bl k h i Fi lid 24This is actually the block shown in Figure slide 24

29

Note

The number of addresses in the block can be found by using the formula

232−n.

Note

30

16

Find the number of addresses in Example 4

Example Example 66

Sol tionSol tion

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

SolutionSolution

31

Another way to find the first address, the last address,and the number of addresses is to represent the maskas a 32-bit binary (or 8-digit hexadecimal) number.This is particularly useful when we are writing a

ExampleExample

This is particularly useful when we are writing aprogram to find these pieces of information. InExample 5 the /28 can be represented as

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

Finda. The first addressb. The last addressc. The number of addresses.

32

17

a Th fi t dd b f d b ANDi th i

Example Example ... continued... continued

SolutionSolution

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

33

b. The last address can be found by ORing the

SolutionSolution

Example Example ... continued... continued

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.

34

18

SolutionSolution

Example Example ... continued... continued

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

35

Note

The first address in a block is normally not assigned to any device; it is used as the network address that

represents the organization

Note

represents the organization to the rest of the world.

36

19

1) In a block of addresses, we know the IP address of onehost is 25.34.12.56/16. What are the first address(network address) and the last address (limited

ExerciseExercise

broadcast address) in this block?

1) Write the following masks in slash notation (/n)a. 255.255.255.0b. 255.0.0.0c. 255.255.224.0d 255 255 240 0

Idawaty A

hmad : S

em: 2008/2009

d. 255.255.240.0

3) Find the range of addresses in the following blocksa. 123.56.77.32/29 b. 17.34.16.0/23

37

mester 2

NoteNote::

IP addresses are designed with two (no subnetting) or three

(subnetting) levels of hierarchy.

38

20

Note

Each address in the block can be considered as a two-level

hierarchical structure: the leftmost n bits (prefix) define

the network;the network;the rightmost 32 − n bits define

the host.39

Figure .A frame in a character-oriented protocol

40

21

Figure. A network with two levels of hierarchy

41

Three –Level of Hierarchy:Subnetting

Eg. Suppose an organization is given the block17.12.40.0/26, which contains 64 addresses.The organization has three offices and needsto divide the addresses into three subblocks of32, 16 and 16 addresses.,

42

22

Figure. Configuration and addresses in a subnetted network

43

Figure. Three-level hierarchy in an IPv4 address

44

23

Table Addresses for private networksTable. Addresses for private networks

45

Figure. A NAT implementation

46

24

Figure. Addresses in a NAT

47

Figure . NAT address translation

48

25

Table. Five-column translation table

49