Top Banner
Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1
63

Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Jan 01, 2016

Download

Documents

Hilda Gaines
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Network Protocols

Chapter 5 (TCP/IP Suite Book): IPv4 Addresses

Copyright © Lopamudra Roychoudhuri 1

Page 2: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Agenda

IPv4 Addresses: IPv4 addresses and classes Classful addressing Network addresses and masks Network Address Translation (NAT)

2

Page 3: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Network Layer The network layer is designed as a packet-

switched network. Packet-switched network can provide either

a connectionless service or a connection-oriented service.

When the network layer provides a connectionless service, each packet traveling in the Internet is an independent entity; there is no relationship between packets belonging to the same message.

In a connection-oriented service, there is a virtual connection between all packets belonging to a message. 3

Page 4: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Network Layer This means that the packet at the

source is divided into manageable packets, normally called datagrams.

Individual datagrams are then transferred from the source to the destination.

The received datagrams are assembled at the destination before recreating the original message.

The packet-switched network layer of the Internet was originally designed as a connectionless service.

4

Page 5: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Sender Network

Network

ReceiverOut of orderR3

R4

R5

R1 R2

A connectionlesspacket-swtiched network

Figure 4.3 A connectionless packet-switched network

4 3 2 1

1

2

3

42

3 31

4 43 21

5

The network layer is responsible for delivery of packets from the source to the destination.

Page 6: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 4.4 Forwarding process in a connectionless network

1 2

43

Outputinterface

Destinationaddress

Routing table

12

3

AB

HDestination

address

SA DA Data

Send the packetout of interface 2

SA DA Data

LegendSA: Source addressDA: Destination address

6

The source address may be used to send an error message to the source if the packet is discarded.

The forwarding decision is based on the destination address of the packet.

Page 7: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

IP Addresses

The identifier used in the IP layer of the TCP/IP protocol suite to identify each device connected to the Internet

Uniquely and universally defines the connection of a host or a router to the Internet

32 bits, 4 bytes long dotted decimal notation

Each of the 4 values is in range 0 – 255, such as, 150.21.39.52

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

7

Page 8: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

IP Addresses cont. How does every device on the

Internet get a different IP address? IP Address Prefixes assigned to

organizations by the Internet Assigned Numbers Authority (IANA) Distributes IP address pools to Regional

Internet Registry (RIR) organizations, such as Réseaux IP Européens Network Coordination Centre (RIPE NCC)

8

http://www.iana.org/numbers/

Page 9: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

IP Addresses cont. RIPE NCC hands over IP address

prefixes to Organizations: ISPs, Universities, large businesses

These organizations then control all IP addresses starting with that prefix

Small businesses are loaned a group of IP addresses by ISP

Individual PCs get a dynamically assigned IP address from ISP each time they dial up. 9

Page 10: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

0x80 0x0B 0x03 0x3F

IP Addresses cont.

Binary notation

Dotted Decimal notation

Hexadecimal notation

• An IP address can also be thought of as a number in base 256.

• i.e., 128.11.3.31 is nothing but • 128*256^3 + 11*256^2 + 3*256^1 + 31*256^0• (See TCP/IP Textbook appendix B, Page 898)

10

Page 11: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

IP Addresses

IP address is designed to identify A particular IP Network that this

packet should be delivered to by

Internet routers

A particular IP host machine on that

network that this packet should be

delivered to by local router at the

destination site

11

Page 12: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

IP addresses, when started a few decades ago, used the concept of classes. This architecture is called classful addressing.

Class A: for Large networks Class B: for Medium networks

Class C: for Small networks Class D: Multicast

Classful IP Addresses

12

Page 13: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 5.7 Finding the class of an address using continuous checking

1

Class: A

0Start

1

0

Class: B

1

0

Class: C

1

0

Class: D Class: E

13

Page 14: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

00000000 0 ……0 01111111 1 ……1

10000000 0 ……0 10111111 1 ……1

11000000 0 ……0 11011111 1 ……1

11100000 0 ……0 11101111 1 ……1

11110000 0 ……0 11111111 1 ……1

14

Page 15: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Occupation of the address space

15

Page 16: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 5.15 Information extraction in classful addressing

netid

First address

000 ... 0

16

Page 17: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

17

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

Example 19.1

Solution

We replace each group of 8 bits with its equivalent decimal number (see Appendix B) and add dots

for separation.

Page 18: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

18

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

Example 19.2

Solution

We replace each decimal number with its binary equivalent .

Page 19: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

19

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

Example 19.3

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.

Page 20: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

20

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

Example 19.4

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.

Page 21: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

21

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

wasted.

Note

Page 22: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

22

Classful addressing, which is almost obsolete, is replaced with

classless addressing.

Note

Page 23: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Find the number of addresses in a range if the first

address is 146.102.29.0 and the last address is

146.102.32.255.

Solution

We can subtract the first address from the last address

in base 256 (see Appendix B). The result is 0.0.3.255 in

this base. To find the number of addresses in the range

(in decimal), we convert this number to base 10 and

add 1 to the result.

= 255 * 256^0 + 3 * 256^1 = 1023 + 1 = 1024

Example 5.5

23

Page 24: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Net Address

First address in the block Network address defines the

network to rest of Internet Given network address we can find

the class of the address, the block, and range of addresses in the block

24

Page 25: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Network Address

25

Page 26: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Blocks in class A

26

Page 27: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Class A Address

First byte value between 1 and 127 ICANN specifies value of 1st byte Organization chooses IP address for each

device by assigning value in last 3 bytes. Organization may have (256 * 256 * 256) =

16 million different IP addresses for devices!! Millions of class A addresses are

wasted.

List of Assigned class A addresses

27

Page 28: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Blocks in class B

28

Page 29: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Class B Address

First byte has value between 128 and 191 ICANN specifies value of 1st and 2nd bytes Organization chooses IP address for each

device by assigning value in last 2 bytes. Organization has (256 * 256) = 65,536 different

IP addresses for devices!! Many class B addresses are wasted.

29

Page 30: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Blocks in class C

30

Page 31: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Class C Address

First byte has value between 192 and 223 ICANN specifies value of 1st, 2nd and 3rd bytes Organization chooses particular IP address for

each device by assigning value in last byte. Organization gets 256 different IP addresses for

its devices The number of addresses in class C is smaller

than the needs of most organizations

Example: IP addresses 207.46.232.x are all controlled by Microsoft Corporation

31

Page 32: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Unicast, Multicast, and Broadcast Addresses

Unicast communication is one-to-one.Multicast communication is one-to-many.Broadcast communication is one-to-all.

32

Page 33: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Class D Address

First byte has value between 224 and 239 There is no Network ID or Host ID. The

entire address is used for multicasting Each address represents a group of hosts

that all listen to one sender Example: Address 224.0.0.9 can be used

to send routing information to all RIP2-aware routers on a network segment.

List of used multicast addresses

33

Page 34: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Multicast Category addresses

Routing Information Protocol

Open Shortest Path First

Interior Gateway Routing Protocol

Distance Vector Multicast Routing Protocol

Internet Stream Protocol

34

Page 35: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

IP Special Addresses

Address Netid Hostid Src/Dest

Network Address

Specific All 0s None

Direct Broadcast

Specific All 1s Dest

Limited Broadcast

All 1s All 1s Dest

This host All 0s All 0s Source

Host on this network

All 0s Specific Dest

Loopback 127 Any Dest

35

Page 36: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Direct Broadcast

Direct broadcast address is used by a router to send a message to every host on a local network

36

Page 37: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Limited Broadcast Limited broadcast address is used by a host to send a

packet to every host on the same network However, the packet is blocked by routers

37

Page 38: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

This Host A host that does not know its IP address uses the IP

address 0.0.0.0 as the source address and 255.255.255.255 as the destination address to send a message to a boot strap server

Can be used only as a source address

38

Page 39: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Loopback A packet with loopback address will not reach the

network Can be used by a client process to send a message to

a server process on the same machine Can only be used as a destination address

39

Page 40: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Private AddressesA number of blocks in each class are assigned for private use.

They are not recognized globally, hence cannot be used on public Internet

40

Page 41: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Multihomed devices

A device that has more than one Internet address; a different address for each network connected to it

41

Page 42: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Sample internet

1. A LAN with nw address 220.3.6.0 (class C)

2. A LAN with nw address 134.18.0.0 (class B)

3. A LAN with nw address 124.0.0.0 (class A)

4. A point-to-point WAN

5. A switched WAN

Note: The book does not show any IP address for point-to-point link end-pointsBut in reality point-to-point WAN interfaces are also assigned IP addresses.

42

Page 43: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Question

How can you determine if an IP address belongs to a particular network?

Answer: Apply a netmask

A mask is a 32-bit binary number that gives the first address in the block, i.e. the network address when bitwise ANDed with an address in the block

43

Page 44: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Network Address

The network address is the beginning address of each block.

It can be found by applying the default mask to any of the addresses in the block (including itself).

It keeps the netid of the block and sets the hostid to zero.

44

Page 45: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Masking concept

bit bit45

Page 46: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

46

Anding & Oring Tables

Anding

Oring

0 0 00 1 00 0 11 1 1

0 0 01 1 01 0 11 1 1

Page 47: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Default Masks

10001101 00001110 01001000 00011000

11111111 11111111 00000000 00000000

10001101 00001110 00000000 00000000

47

Page 48: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

A block of addresses is granted to a small organization. We know that one of the addresses is

205.16.37.39/24. What is the first address in the block?

Solution

The binary representation of the given address is

11001101 00010000 00100101 00100111

If we used the default mask and And it with the IP address, we get

11001101 00010000 00100101 00000000

or

205.16.37.0.

Example 19.6

48

Page 49: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

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

32 − n bits to 1s.

Note

49

Page 50: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

An address in a block is given as 73.22.17.25. Find the number of addresses in the block, the first address, and the last address.

SolutionFigure 5.16 shows a possible configuration of the network that uses this block. 1. From the 1st byte we know that this is a class A address. Hence number of network bits (n) is 8. The number of addresses in this block is N = 232−n=232−8=224 =16,777,216.2. To find the first address, we keep the leftmost 8 bits and set the rightmost 24 bits all to 0s. The first address is 73.0.0.0, in which 8 is the value of n.3. To find the last address, we keep the leftmost 8 bits and set the rightmost 24 bits all to 1s. The last address is 73.255.255.255.

Example 5.13

50

Page 51: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 5.16 Solution to Example 5.13

51

Page 52: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

An address in a block is given as 180.8.17.9. Find the number of addresses in the block, the first address, and the last address.

SolutionFigure 5.17 shows a possible configuration of the network that uses this block. 1. The number of addresses in this block is N = 232−n =

65,536.2. To find the first address, we keep the leftmost 16 bits and set the rightmost 16 bits all to 0s. The first address is 180.8.0.0, in which 16 is the value of n.3. To find the last address, we keep the leftmost 16 bits and set the rightmost 16 bits all to 1s. The last address is 180.8.255.255.

Example 5.14

52

Page 53: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 5.17 Solution to Example 5.14

53

Page 54: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

An address in a block is given as 200.11.8.45. Find the number of addresses in the block, the first address, and the last address.

SolutionFigure 5.17 shows a possible configuration of the network that uses this block. 1. The number of addresses in this block is N = 232−n = 256.2. To find the first address, we keep the leftmost 24 bits and set the rightmost 8 bits all to 0s. The first address is 200.11.8.0, in which 24 is the value of n.3. To find the last address, we keep the leftmost 24 bits and set the rightmost 8 bits all to 1s. The last address is 200.11.8.255.

Example 5.15

54

Page 55: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 5.18 Solution to Example 5.15

55

Page 56: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

A router receives a packet with the destination address 201.24.67.32. Show how the router finds the network address of the packet.

SolutionSince the class of the address is C, we assume that the router applies the default mask for class C, 255.255.255.0 to find the network address.

Example 5.16 (Note that the book’s solution is incorrect)

255

67

56

Page 57: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

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.

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.

b. The last address can be found by ORing the given

addresses with the complement of the mask

The complement of a number is found by changing each 1 to 0 and each 0 to 1.

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

1 to it.

Another way to find the first address, last address,

, and the number of addresses

57

Page 58: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

58

Network Address Translation (NAT)  Network Address Translation (NAT): is the process of modifying IP address information in IPv4 headers while in transit across a traffic routing device.

NAT is necessary when the number of IP addresses assigned to you by your ISP is less than the total number of computers that you wish to provideInternet access for.

The simplest type of NAT provides a one-to-one translation of IP addresses. This refers to this type of NAT as basic NAT, which is often also called a one-to-one NAT. 

Another way to map an entire network (or networks) to a single IP address (Security wise).

NAT allows you to take advantage of the reserved address blocks.

Page 59: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 19.10 A NAT implementation

59

Page 60: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 19.11 Addresses in a NAT

60

Page 61: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 19.12 NAT address translation

61

Page 62: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Table 19.4 Five-column translation table

62

Page 63: Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses Copyright © Lopamudra Roychoudhuri 1.

Figure 19.13 An ISP and NAT

63