Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

63
Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6

Transcript of Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Page 1: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Chapter 15

Network LayerProtocols:

ARP, IPv4, ICMPv4, IPv6, and ICMPv6

Page 2: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.1 Protocols at network layer

Network layer Protocols

1. IGMP2. IP (main protocol)3. ARP4. RARP5. ICMP

Page 3: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

IP criteria:

►Responsible for host to host delivery of datagrams from a source to destination.

►Needs a protocol called ARP to find the MAC(Physical) address of the next hop.

► IP is designed for unicast delivery.► For multicasting, IP uses the services of IGMP.►During the datagram delivery, IP needs the

services of ICMP to handle unusual situation (Error).

► The current version is IPV4.

Page 4: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 8-1

Page 5: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

20.1 ARP20.1 ARP

Mapping

Packet Format

Encapsulation

Operation

Page 6: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

ARP (Address Resolution Protocol):

► The hosts and routers are recognized at the network level by their IP addresses, which is universally unique.

► The hosts and routers are recognized at the physical network by their MAC addresses, which is local and it should be unique locally but not necessarily universally unique.

► The MAC address and IP address are two different identifiers, and both are equally necessary. Because a physical network (Ethernet) can have two different protocols (IP, IPX) at the network layer. In the same way a packet at network layer (IP) may pass through two different physical networks (Ethernet, Token Ring).

► So delivery of a packet needs two levels of addressing (IP and MAC). So it is necessary to map an IP address to its corresponding MAC address.

Page 7: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Mapping► Static mapping► Dynamic mapping

► Static mapping: 1. Creates a table (in each machine of the network) that associates an IP

address with a MAC address. 2. The machine that knows the IP address of other machine but not MAC

address, can look through this table.3. Static mapping table must be periodically updated.

► Limitation: 1. A machine can change its network card, results in a new MAC address.2. In some LANs (Local talk (Apple)), the MAC address changes every time

the computer is turned on.3. A mobile computer can move from one computer to another computer,

results in a new MAC address.

► Dynamic mapping (ARP, RARP)1. Each time a machine knows one of the two addresses, it can use a

protocol to find the other.2. 2 protocols (ARP and RARP) have been designed for dynamic mapping.3. ARP maps an IP address to a MAC address.4. RARP/DHCP maps a MAC address to an IP address.

Page 8: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.2 ARP operation

Page 9: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 8-6

Page 10: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.3 ARP packet

Page 11: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.4 Encapsulation of ARP packet

Page 12: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.5 Four cases using ARP

Page 13: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

An ARP request is broadcast; an ARP reply is unicast.

NoteNote::

Page 14: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Example 1Example 1

A host with IP address 130.23.3.20 and physical address B23455102210 has a packet to send to another host with IP address 130.23.43.25 and physical address A46EF45983AB. The two hosts are on the same Ethernet network. Show the ARP request and reply packets encapsulated in Ethernet frames.

Solution

Figure 20.6 shows the ARP request and reply packets. Note that the ARP data field in this case is 28 bytes, and that the individual addresses do not fit in the 4-byte boundary. That is why we do not show the regular 4-byte boundaries for these addresses. Note that we use hexadecimal for every field except the IP addresses.

Page 15: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.6 Example 1

Page 16: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 8-8 RARP

Page 17: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 8-9

Page 18: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 8-10

Page 19: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

DHCP (Dynamic Host Configuration Protocol):

1. RARP (now obsolete) has been replaced by DHCP.2. DHCP maps a MAC address to an IP address.3. It provides the information dynamically based on demand.4. It is used to assign addresses to a host dynamically.

► Operation:1. DHCP is a client server program.2. DHCP server has two databases. The first database statically

binds physical addresses to IP addresses. The second database makes DHCP dynamic.

3. When a DHCP client requests for a temporary, DHCP server goes to the pool of available IP addresses and assigns an IP address for a negotiable period of time.

4. When a DHCP client sends a request to a DHCP server, the server first checks its static database. If an entry with the requested physical address exists in the static database, the permanent IP address of the client is returned.

5. On the other hand, if the entry does not exist in the static database, the server selects an IP address from the available pool, assigns the address to the client, and adds the entry to the dynamic database.

Page 20: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

DHCP Transition:

Page 21: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

DHCP Transition states:

(1) Initialization state:The DHCP client broadcasts a DHCP DISCOVER message.

(2) Selecting state:The servers that provide this type of service respond with a DHCP OFFER message. DHCP OFFER message includes IP address and lease duration.The server that sends DHCP OFFER message, locks the IP address, so other clients cannot use it.If the clients receive no DHCP OFFER message, it tries 4 times, after every 2 seconds. Finally if fails the clients sleeps for 5 minutes, before trying again. On the other hand, if the client receives the DHCP OFFER message, it sends a DHCP REQUEST message to the selected server.

(3) Requesting state:Here client waits until it receives DHCP ACK message from the server, which binds the client’s physical address and its IP address.

(4) Bound state:In this state client can use the IP address until the lease expires. If the lease expires it goes to the initial state.If 50% of the lease period expires, the client sends DHCP REQUEST for renewal. If the server agrees, it sends DHCP ACK message to the client

(5) Renewing state:If client receives DHCP ACK message from the server, it renews the lease agreement. If the lease time 87.5% expires and the DHCP client does not receive the DHCP ACK message, it sends the DHCP REQUEST to the server and goes to the Rebinding state.

(6) Rebinding state:If client receives DHCP ACK message from the server, it renews the lease agreement. If the lease time expires or the client receives a DHCP N ACK message from the server, it goes to the initialization state.

Page 22: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 15-4 Part I (Exchanging messages)

Page 23: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 15-4 Part II

Page 24: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

20.2 IP

Datagram

Fragmentation

Page 25: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Characteristics:

►Host to host delivery protocol for the internet.

►Unreliable and connectionless datagram protocol (best effort delivery service) and also applicable for packet switching network.

► IP provides no error and flow control mechanism.

► IP provides only error detection mechanism and discards the packet if it is corrupted.

► For reliability, IP is paired with TCP.

Page 26: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Continue……

Datagram:A datagram variable length packet has two parts. Header and Data.

Header20 -60 bytes

Data(65536-20) ((65536-60) bytes

Page 27: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.7 IP datagram

Page 28: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

The total length field defines the total length of the datagram including the

header.

Note:

Page 29: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Version: Version: IPV4IPV4► Header length:Header length: 1. Length of the header is variable.2. Length of the datagram is 4 byte words.

► Differentiated services:Differentiated services:1. This is necessary for quality of service purposes.

► Total length:Total length:1. Length of data = total length-header length2. Total length of the IP datagram = (216-1) bytes = 65535 bytes. [16 bits]

► Time to live:Time to live:1. Controls the maximum number of hops (routers) visited by the

datagram.2. When a source node sends a datagram, stores a number approximately

2 times the maximum number of routes between any two hosts. Each router that process the datagram decrements this number by 1. If the value is 0, the router decrements the datagram.

► Protocol:Protocol:1. An IP datagram encapsulates data from several higher-level protocols,

such as TCP, UDP, ICMP and IGMP.2. This field specifies the final destination protocol, to which the IP

datagram should be delivered.

Page 30: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.8 Multiplexing

Demultiplexing

Page 31: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Protocols

Checksum:The checksum in the IP packet covers only the header, but not the data. The reasons are:

•The checksum for the IP datagram doesn’t have to check the encapsulated data.•The header of the IP packet changes with each visited router, but the data do not.

Page 32: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.9 Example of checksum calculation

Page 33: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.10 MTU

Maximum transfer unit: (MTU)When a datagram is encapsulated in a frame, the total size of the datagram <= maximum size (depends on hardware and software of the network).The maximum length of the IP datagram = the largest maximum transfer unit (MTU) = 65535 bytes.For other physical networks, we must divide the datagram to make it possible to pass through these networks.A datagram can be fragmented by the source host or any router in the path.Reassembly will be done at the destination.

Page 34: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Fields related to fragmentation: ► Flags:Flags:1. This is a 3-bit field.2. The first bit is reserved.3. The second bit is “Do not fragment bit”. If

its value is 0, the datagram can be fragmented. If the value is 1, the machine must not fragment the datagram.

4. The third bit is called “The more fragment bit”. If the value is 1, it means the more datagram exit after the current fragment. If the value is 0, it means this is the last or only fragment.

Page 35: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.11 Fragmentation example

Fragmentation offset:This 13 bit field shows the relative position of this fragment with respect to the whole datagram.

Page 36: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

20.3 ICMP (Internet Control Message Protocol

Types of Messages

Page 37: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Necessity of ICMP:► IP has no error-reporting or error-

correcting mechanism.► IP has no mechanism for host and

management queries. A host sometimes needs to know if a router or another host is alive. ICMPs messages are not passed directly to

the data link layer. Instead the messages are first encapsulated inside IP datagram before going to the lower level.

If the value of the protocol field = 1, in the IP datagram, IP data implies ICMP message.

Page 38: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.12 ICMP encapsulation

Page 39: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

ICMP always reports error messages to the original source.

Note:

Page 40: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Types of ICMP message:

2 types: (1) Error reporting (2) Query

► Error reporting:1. IP is an unreliable protocol, it cannot perform

error checking and error control.2. ICMP was designed for this shortcoming.3. ICMP always reports error messages to the

original source (originator of the datagram).4. ICMP doesn’t correct errors; the correction

belongs to the higher level protocols.5. Five types of errors are reported.

Page 41: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.13 Error-reporting messages

Page 42: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Error Reporting► Destination unreachable:Destination unreachable: If a router cannot route a datagram or a host cannot

deliver a datagram, the datagram is discarded, the router or host sends a destination unreachable message to the source host.

► Source quench (Slow down):Source quench (Slow down):► IP is a connectionless protocol.► IP has lack of flow control and congestion control.► Lack of flow control can create a problem in source-

destination delivery.► The lack of congestion control creates a problem in the

routers that are supposed to forward the packet.► When a router or host discards a datagram due to

congestion, it sends a source-quench message to the source host.

► source-quench message can inform the source that the datagram has been discarded.

► source-quench message help the source host to slow down the sending messages.

Page 43: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Continue…..► Time exceeded:1. The router that receives the datagram with a value 0 in the TTL field,

discard the packet, and a time-exceeded message must be sent by the router to the source.

2. If all fragments of a message do not arrive at the destination in time, then this message is reported to the source.

► Parameter problem:1. If a router or host discovers an ambiguous value or a missing value in any

field of the datagram, it sends a parameter problem message to the source.

► Redirection:1. The numbers of hosts are too many compared to the number of routers,

and so they don’t take part in the routing update process dynamically, as unacceptable traffic can be produced.

2. The host usually uses static routing, and knows only the IP address of a default router.

3. So when a host sends a packet to the default router that may not be the dedicated router to send the packet to the appropriate network, it simply forwards the packet to the appropriate router.

4. However to update the routing table of a host, router sends a redirection message to this host.

Page 44: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

There is no flow control or congestion control mechanism in IP.

Note:

Page 45: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.14 Query messages

Page 46: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Query message:► Echo request and reply:Echo request and reply:1. Designed for diagnostic purposes.2. The combination of Echo request and reply messages

determines, whether two systems (hosts or routers) can communicate with each other or not.

► Time- stamp request and reply:Time- stamp request and reply:1. This is used to synchronize the clocks in two machines.2. Two machines (hosts or routers) can determine the

round trip time for an IP datagram to travel between them, using this message.

► Addresses mask request and reply:Addresses mask request and reply:1. A host may know its full IP address, but it may not know

which part of the address defines the networks and sub networks and which part defines the host identifier.

2. In this case a host can send Addresses mask request message to the router.

3. The router then sends a mask in an Addresses mask reply message.

Page 47: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Continue….

► Router solicitation and advertisement:Router solicitation and advertisement:1. The hosts must know whether the routers are alive or not

through Router solicitation and advertisement messages.

2. A host can broadcast or multicast a Router solicitation message.

3. A router that receives Router solicitation message, broadcast their routing information using the Router advertisement message.

4. The router can do it periodically, even if no host has solicited.

Page 48: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

ICMPv6

►Strategy: Like ICMPV4►Purpose: Like ICMPV4►ARP and IGMP of IPV4 are combined in

ICMPV6. RARP is dropped from the suite, as it is used seldom now a day.

Page 49: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

20.4 IPv6

IPv6 Addresses

Categories of Addresses

IPv6 Packet Format

Fragmentation

ICMPv6

Transition

Page 50: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Demerit of IPV4:► IPV4 has a two-level address structure (net ID and host ID)

categorized into five classes. The address space is insufficient.

► Internet must accommodate encryption and authentication of data for some applications. Originally no security mechanism was provided in IPV4.

► Internet must accommodate real time audio and video transmission. This requires minimum delay strategies and reservation of resources. This is not provided in IPV4.

Page 51: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Merit of IPV6 over IPV4:► Larger address space:Larger address space: An IPV6 address is 128 bits long, while

IPV4 has 32 bits.► Better header format:Better header format: Here options are separated from the

base header and the upper layer data.► New options:New options: Allow options for additional functionalities.► Allowance for extension:Allowance for extension: Allow the extension of the protocol, if

required by new technologies or applications. ► Support for resource allocation:Support for resource allocation: Flow level has been added to

enable the source to request special handling of the packet and to support traffic (real time audio and video).

► Support for more security:Support for more security: The encryption and authentication options in IPV6 provide confidentiality and integrity of the packet.

Page 52: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.15 IPv6 address

Page 53: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.16 Abbreviated address

Page 54: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.17 Abbreviated address with consecutive zeros

Page 55: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.18 CIDR address

IPv6 allows classless addressing and CIDR notation.

Figure: Prefix of 60 bits using CIDR

Page 56: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

IPv6 Categories of addresses:

► IPV6 defines three types of addresses:IPV6 defines three types of addresses:1. Unicast address2. Anycast address3. Multicast address

► Unicast addressUnicast address Defines a single computer

► Anycast addressAnycast address1. Anycast address is a new type of address incorporated in

IPv6. 2. It defines a group of computers with addresses that have

the same prefix.3. In contrast to conducting transmission to all nodes in a

group as in multicast, anycast sends the packet only to the nearest node in the group.

► Multicast address:Multicast address: A packet sent to a multicast address must be delivered to

each member of the set.

Page 57: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.19 Format of an IPv6 datagram

Page 58: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Fragmentation in IPv6:►The policy is same as that of IPV4.

► In IPV4, a source or router is responsible to fragment the datagram if necessary.

► In IPV6, only the source is responsible to fragment the datagram.

►A source uses a path MTU discovery technique to find the smallest MTU supported by any network on the path.

► If path MTU discovery technique is not used, the source must fragment the datagram to a size of 576 bytes or smaller.

Page 59: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.20 Comparison of network layers in version 4 and version 6

Page 60: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.21 Three transition strategies from IPv4 to IPv6

Page 61: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.22 Three transition strategies

Dual stack:A station should run IPV4 and IPV6 simultaneously until all the systems in the internet use IPV6.When it is necessary to send a packet to a destination, the source host queries the DNS (Domain name system). If the DNS returns and IPV4 address, the source sends an IPV4 packet, else if IPV6 address then it sends IPV6 packet.

Page 62: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.23 Tunneling

When two IPV6 host computers want to communicate with each other, and must pass through a network that uses IPV4 protocol, it is used.To pass through the IPV4 protocol region, the packet must have an IPV4 address. So IPV6 packet must be encapsulated into IPV4 packet, when the packet enters into the region and the protocol value is set to 41, and leaves IPV4 header when it exits the region.

Page 63: Chapter 15 Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv6.

Figure 20.24 Header translation

It is necessary when majority of the internet has moved to IPV6, but some systems still use IPV4.Here source may want to use IPV6, but the receiver does not understand IPV6. Tunneling is not a solution here.Here header format must be changed totally through header translation.