chapter 81 internet protocol (ip) our greatest glory is not in never failing, but in rising up every...

36
Chapter 8 1 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Upload: cornelia-foster

Post on 02-Jan-2016

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8 1

Internet Protocol (IP)

Our greatest glory is not in never failing, but in rising up every time we fail.

- Ralph Waldo Emerson

Page 2: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

2

Objectives

• Explain how routers process IP packets in IP networks

• Describe the structure of the IP header and explain functions of header fields

• Explain the packet fragmentation process in IP and the re-assembly process

Page 3: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

3

Network Layer Protocols

• The primary function of a routed or routable Network layer protocol is to move datagrams through an internetwork connected by routers, with the originator as the source Network layer address, and the target as the destination Network layer address

• Internet Protocol is the routed or routable Network layer protocol used in the Internet protocol suite

• Widely used version is IP version 4 (IPv4)

• Internet Protocol version 6 (IPv6) is undergoing initial deployments

Page 4: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

4

Sending IP Datagrams• IP offers connectionless service with end-to-end

Network layer addressing

• To build an IP datagram (or, an IP packet) and to send it on the physical medium, we must know the:– IP addresses of the source and destination– Hardware addresses of the source and recipient of

the data link frame

• Source host needs to resolve a destination host name to an IP address. This is called the name resolution process

Page 5: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

5

Destination host is local or remote?

• After determining the destination IP address, the source host compares the network portion of the destination address to its own local network address

• If they are the same, the destination is on the same local network. Otherwise, the destination is on a remote network

Page 6: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

6

When the source and destination hosts are on the same network

• If the source host determines that the destination is local, it encapsulates the IP packet in a data link frame with destination host’s MAC address and sends this frame to the local network.

• Destination host on the local network accepts this frame, removes the data link header and trailer and forwards the IP packet to its network layer.

• A router does not get involved when the source and destination hosts are on the same network.

Page 7: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

7

Example

• In Figure 2.18 a host with physical address 10 sends a frame to a host with physical address 87. The two hosts are on the same LAN. At the data link level this frame contains physical (link) addresses in the header. These are the only addresses needed. The rest of the header contains other information needed at this level. The trailer usually contains extra bits needed for error detection.

Page 8: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

8

Frame delivery using Physical (or, MAC) addresses at Data Link Layer

Figure. 2.18

Page 9: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

9

When the destination host is remote...• If the source host determines that the destination host is

remote (i.e., in a different network), the IP packet must be forwarded to a router on the local network. The router will then forward the packet towards its final destination.

• Source host consults its “Routing Table” and determines the IP address of the local router the packet should be forwarded to.

• Using ARP (Address Resolution Protocol) Cache entries or ARP process, source host finds the MAC address of the router, builds a data link frame and sends it to the local network.

Page 10: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

10

Example

• Hosts A & P are in different networks.

• A packet sent by A contains source and destination IP addresses (A and P, in Fig. 2.19). They remain the same from the original source to the final destination and will not change when packets go from one network to another network.

• However, the physical addresses will change as the packet moves from one network to another.

Page 11: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

11

Packets moving from one network to another (Fig. 2.19)

Page 12: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

12

Processing done by the local router...

• When a router receives a data link frame, after checking for errors, the data link header and trailer are removed (de-capsulation) and the IP packet is sent to the network layer of the router.

• After checking the IP Header Checksum, the destination IP address is extracted from the packet header.

• Router consults its routing table to determine the interface on which the received packet should be forwarded on.

Page 13: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

13

Processing done by the local router...

• Router builds a data link frame encapsulating the IP packet and forwards it through the interface indicated by the routing table.

• If the router has a direct connection to the destination network, in building the data link frame, it uses the MAC address of the destination host as the destination MAC address in the data link frame header.

• Router uses the MAC address of its interface used to forward the packet as the source MAC address in the frame header.

Page 14: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

14

When the packet reaches the destination network...

• Source and Destination IP addresses are not changed by routers (unless a router has to substitute the source address in the packet with a different IP address, as a part of the Network Address Translation process).

• The destination host accepts the data link frame addressed to it (with destination host’s MAC address as the destination address in the frame).

• Through the de-capsulation process in data link, network and transport layers, the data sent by the source application is finally forwarded to the destination host’s application.

Page 15: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

15

Internet Protocol (IP)

• Originally defined in RFC 791

• IP header fields and functions

• Lifetime of an IP datagram

• Fragmentation and reassembly

• Supporting Quality of Service (QoS)

• Checksum calculations and IP Options will not be discussed

Page 16: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

16

IP Header Fields and Functions

Page 17: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

17

Version field

• Most widely used version is 4

Total Length field• Total length of the IP datagram in bytes

(including IP Header and the payload)

Page 18: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

18

Protocol Field

• Identifies the upper layer protocol process on the destination host, to which the received IP data should be delivered

• Examples: (see RFC 1700 for complete list)

“Protocol” value Forward IP Payload to:

1 ICMP

2 IGMP

6 TCP

17 UDP

Page 19: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

19

Header Checksum field

• Provides error detection (not correction) on the IP header bytes only. This checksum does not cover the IP payload.

• The receiving host/router computes the Header Checksum and compares its computed checksum with the checksum in the received IP header. If they don’t match, the packet is discarded and an ICMP message is sent to the source host.

Page 20: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

20

Source Address field

• Contains the IP address of the host that originated the packet

Destination Address field• Indicates the IP address of the destination

host

• This field can include a unicast, multicast or a broadcast address

Page 21: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

21

Header Length field

• Indicates the length of the IP header in multiples of four bytes

• If the “Header Length” field is 5, length of the IP header is 5 x 4 => 20 bytes

• Used by a receiving host/router to extract the header bytes. Because of “Options”, the receiving host/router will otherwise not know exact length of the IP header.

Page 22: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

22

Time to Live (TTL) field

• Built-in mechanism to ensure that packets cannot indefinitely travel due to routing loops

• Source host sets the TTL value to some default initial value (such as: 32, 64, 128)

• When a router receives an IP packet, it decrements the TTL value by 1 before forwarding it to the next router

• After decrementing, if TTL value is 0, router must discard the packet and send an ICMP message to the source indicating why packet was discarded

Page 23: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

23

Lifetime of an IP Datagram

• If a packet with TTL=1 arrives at a host, what should the host do?– The host will process the packet

• The hosts do not need to decrement the TTL value upon receipt

• TRACEROUTE uses the TTL value to trace the end-to-end path through an internetwork

Page 24: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

24

Identification Field• Each IP packet is given a unique ID number

by the source host

• If the packet must be fragmented by a router to fit on a network that has a smaller MTU (Max. Transmission Unit) size, the same ID number is placed in each fragment

• During reassembly, a destination host uses ID value to identify fragments that belong to the same original datagram

Page 25: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

25

Fragmentation and Reassembly

• IP fragmentation enables a larger packet to be fragmented by a router into smaller packets to cross a link that supports a smaller MTU size

• Once fragmented, no reassembly occurs until all the fragments arrive at the destination. Routers along the path to the destination host do not attempt reassembly of fragmented datagrams - Why?

Page 26: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

26

Fragment Offset field

• Used by the destination host in reassembling the received fragments in the correct order to form the original datagram

• If the packet is a fragment, this field shows the destination host where to place this packet’s data when the fragments are reassembled

Page 27: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

27

Flags field• Three bits: Reserved, DF and MF bits

• DF (Don’t Fragment) bit:– If 0, routers can fragment the packet, if needed

– If 1, routers must not fragment the packet

• MF (More Fragments) bit:– Used during reassembly by destination host

– If 0, this is the last fragment

– If 1, more fragments to follow

Page 28: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

28

Fragmentation and Reassembly

• The first fragment of a packet:– More bit = 1; Offset = 0

• Intermediate fragments:– More bit = 1; Offset = non-zero

• Last fragment– More bit = 0; Offset = non-zero

• When the fragments arrive at the destination IP host, they are put back in the correct order based on the Fragment Offset value in the IP header

Page 29: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

29

Type of Service field

• TOS byte has two components: – 3 Precedence bits – 4 Type of Service bits– 1 Reserved bit

• Not implemented by routers or applications• If implemented, a router uses precedence bits to

determine what packet to send next when many packets are queued up for forwarding through an interface– Reduces the waiting time (delay or latency) for a high

precedence packet inside a router

Page 30: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

30

Type of Service (TOS) Bits

• If implemented, routers use TOS bits in determining the interface on which a packet should be forwarded, when multiple paths are available to the destination

• Does not reduce the delay experienced by a packet inside a router, but impacts the path taken by a packet through the network

• TOS Value Interpretation by a router0 Default4 Maximize throughput8 Minimize delay15 Maximize security

Page 31: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

31

Type of Service (TOS) Bits

• If implemented, routers use TOS bits in determining the interface on which a packet should be forwarded, when multiple paths are available to the destination

• Does not reduce the delay experienced by a packet inside a router, but impacts the path taken by a packet through the network

Protocol TOS Value Interpretation by a router ICMP 0 Routine (Default)

SNMP 2 Maximize reliability FTP Data 4 Maximize throughput Telnet 8 Minimize delay

Page 32: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

32

Redefining the TOS Byte ...

• RFC 2474 “Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers” has redefined the original TOS byte as Differentiated Services Code Point (DSCP) field (6 bits) for supporting Quality of Service (QoS) for new applications such as voice

• Two bits in the original TOS byte were left as “unused” by RFC 2474

Page 33: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

33

Redefining the TOS Byte ...

Page 34: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

34

Options field• The IP header can be extended by several

options (although these options are not often used)

• If the header is extended with options, those options must end on a 4-byte boundary because the Internet Header Length (IHL) field defines the header length in 4-byte boundaries

• Padding bytes are used to make the length of “Options” field to be a multiple of 4 bytes

Page 35: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

35

References

• RFC 1180, A TCP/IP Tutorial, Jan. 1991

• Douglas Comer, “Internetworking With TCP/IP Volume 1: Principles Protocols, and Architecture,” 5th Edition, Prentice Hall, 2006

• W. Richard Stevens, “TCP/IP Illustrated Volume 1: The Protocols,” Addison Wesley, 1994

Page 36: Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson

Chapter 8

36