Introduction to TCP/IP, IP, ARP, RARP, ICMP
3.11 INTERNET CONTROL MESSAGE PROTOCOL (ICMP)
3.11.1 How ICMP Works
ICMP works by sending an error message for a specific reason to the concerned host. For instance, in our example of Fig. 3.35, the ICMP software on router R would send a message Destination unreachable to host A, when host A sends any datagrams destined for host B. Similarly, for other kinds of problems, different messages are used.
Let us consider a few examples of ICMP error messages.
Destination unreachable We have already discussed this with reference to the figure. Whenever a router realizes that a datagram cannot be delivered to its final destination, it sends a Destination unreachable message back to the host, which sent the datagram originally. This message also includes a flag to indicate whether the destination host itself is unreachable, or whether the network containing the end destination is down.
76
Source quench There are occasions when a router receives so many datagrams than it cannot handle them.
That is, the number of datagrams arrived at a router could exhaust the size of its memory buffer, where it usually stores these datagrams temporarily before forwarding them to the next router / the final destination.
The router cannot simply accept any more datagrams. In such situations, any more datagrams that the router receives must be discarded. However, if the router simply discards them, how would the senders know that there is a problem? The senders would have no clue! And, they could go on sending more datagrams to this router. In order to prevent such a situation, the router sends a Source quench message to all the senders who are sending it more datagrams. This signals the hosts sending datagrams to the router, that they should not send any datagrams to that router now. Rather, they should wait for some time before transmitting more datagrams or before re-transmitting the datagrams discarded by the router.
Redirect When a host creates a datagram for sending it to a particular destination, it first sends it to the nearest router. The router then forwards it on to another router, or the end destination, if the end destination is directly reachable. However, during the journey of a datagram via one or more routers like this, it could happen that a router incorrectly receives a datagram, which is not on the path of the end destination. The datagram should, instead, go to another router. In such a case, the router that received the datagram incorrectly sends a Redirect message to the host or network from where it received that datagram.
Figure 3.35 shows such an example. Here, host A wants to send a datagram to host B. We realize that the datagram should be first forwarded to the router R2 as both host A and router R2 are on the LAN shown in the figure. Thereafter, the router R2 should forward it to the host B, as both router R2 and the host B are on the WAN shown in the figure. Let us assume that, by mistake, the host A first sends the datagram to router R1.
However, R1 is not directly on the route of host B. Router R1 realizes this, and forwards the datagram to the appropriate router R2 after consulting its routing table, which tells R1 that if you have to send a datagram from R1 to B, it will have to be sent to R2. At the same time, R1 sends a Redirect message back to host A to ensure that host A updates its routing table and sends all datagrams destined for host B thereafter to router R2.
Fig. 3.35 Example of Redirect ICMP message
Time exceeded We know that every IP datagram contains a field called as Time to live. This field is used to determine how long the datagram can live. This helps the Internet infrastructure in preventing datagrams from living and moving on for too long, especially when there are network problems. For instance, suppose that host
77 A sends a datagram to host B and that the two hosts are separated by a number of intermediate routers. Initially, the host A sets this value based on the expected number of routers that the datagram is expected to pass through (may be a little more than that number). Then every time a datagram moves from A to B via these routers, the router reduces the amount of the field Time to live of that datagram by a certain value before forwarding it to the next router. If a router receives this field with the value of Time to live being zero, it means that the datagram must be discarded, as it is moving through too many routers. Therefore, the router discards this datagram. It then communicates this fact to the original sending host by a Time exceeded ICMP message. The original host can then take an appropriate corrective action, such as choosing another router, or waiting for some time before retransmission.
To avoid sending long text messages such as Destination unreachable, ICMP actually maps these messages to error codes, and just sends the error code to the host. For instance, when a router has to send a Destination unreachable message to a host, it sends an error
code of 3. The number 3 corresponds to the Destination unreachable message. This can be done by standardizing all error codes vis-à-vis their corresponding messages, and making that table of codes and messages a part of the ICMP software. A few ICMP error codes and their corresponding messages for the ones discussed earlier are shown in Table 3.4.
SUMMARY
l Computers within the same network communicate with each other using their physical addresses.
l Different networks have different address lengths as well as addressing formats. Therefore, we cannot use physical addresses to identify computers across different physical networks.
l Logical addressing is used, which is uniform and does not depend on the underlying network. This logical address is called as IP address.
l The Internet is a network of many heterogeneous computer networks.
l The Address Resolution Protocol (ARP) is the mechanism that specifies the IP address of a computer, and gets back its physical address.
l In some situations, the reverse of what ARP does, is required. In such situations, the Reverse Address Resolution Protocol (RARP) is used.
l A router maintains a table to decide which destination addresses are directly reachable, and for which other addresses it has to forward the datagrams to another router.
l The physical address or the hardware address of a computer is hard coded on the Network Interface Card (NIC) of the computer.
l The IP address consists of three parts: class, network number and host number.
l Each network on the Internet is given a unique network number. Within a network, each host is assigned a unique host number.
l IP addresses are made up of 32 bits. Thus, an IP address would contain 32 ON/OFF flags (i.e., 0 or 1).
l Since it is cumbersome to write IP addresses this way, the dotted-decimal notation is used, instead.
Table 3.4 ICMP error codes and error messages
Error code Error message
3 Destination unreachable
4 Source quench
5 Redirect
11 Time exceeded
78
l The Transmission Control Protocol / Internet Protocol (TCP/IP) suite of communication protocols makes the Internet a worldwide network of computer networks.
l Technically, TCP/IP consists of four layers, but for the sake of understanding, we can ignore this and consider it to be made up of five of them: Physical, Data Link, Internet, Transport and Application.
l The physical layer is concerned with the physical characteristics of the transmission medium, such as what voltage level signifies a binary 0 or 1, etc.
l The data link layer deals with the issues of media access and control.
l The Internet layer is unique to TCP/IP. The IP protocol at this layer is responsible for uniform host addressing, datagram formats and lengths and routing.
l The transport layer is responsible for end-to-end delivery of IP datagrams, and contains two main and widely differing protocols: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP).
l TCP is a reliable protocol that guarantees delivery of IP datagrams between two hosts.
l UDP does not guarantee a successful delivery of datagrams, and instead, makes the best attempt for delivery.
l The application layer sits on top of the transport layer, and allows the end users to do Web browsing (using HTTP), file transfers (using FTP) and send emails (using SMTP), etc.
l The Internet Control Message Protocol (ICMP) is a error-reporting (but not error-correcting) protocol for error detection and reporting.
l Examples of ICMP messages are destination unreachable, source quench, redirect, time exceeded, etc.
REVIEW QUESTIONS
Multiple-choice Questions
1. Layer 4 from bottom in TCP/IP is the .
(a) physical layer (b) application layer (c) transport layer (d) internet layer 2. ARP lies in the .
(a) physical layer (b) application layer (c) transport layer (d) internet layer 3. does not offer reliable delivery mechanism.
(a) UDP (b) TCP (c) ARP (d) FTP
4. IP address the physical address.
(a) is the same as (b) has no relation with
(c) means (d) none of the above
5. Currently, the IP address has a size of bits.
(a) 128 (b) 64 (c) 32 (d) 16
6. The field helps routers in discarding packets that are likely to cause congestion.
(a) time to live (b) options (c) protocol (d) fragmentation offset 7. IP makes a of datagram delivery.
(a) worst effort (b) guaranteed delivery
(c) best effort (d) All of the above
79 8. In scheme, the physical address is hard coded on the NIC of a computer.
(a) configurable addresses (b) static addresses
(c) dynamic addresses (d) none of the above
9. The for all computers on the same physical network is the same.
(a) host id (b) physical address (c) IP address (d) network id 10. If an IP address starts with a bit sequence of 110, it is a class address.
(a) A (b) B (c) C (d) D
Detailed Questions
1. What are the different methods of assigning physical address to a computer?
2. Explain the process of message transfer between two computers.
3. Describe the three parts of an IP address.
4. Describe the various fields in the IP datagram header.
5. What is the purpose of the time to live field of the IP datagram header?
6. Why is IP called as connectionless?
7. How does the Address Resolution Protocol (ARP) work?
8. Why is IP called as a best-effort delivery protocol?
9. Explain the following ICMP messages: (a) Destination unreachable, (b) Source quench, and (c) Redirect.
10. What is the purpose of the field time to live in the IP datagram header?
Exercises
1. Observe that when you connect to busy Web sites such as Yahoo or Hotmail, the IP address of that site keeps changing. Investigate why this is the case.
2. Think what could happen if domain names are not unique. Assuming that there are multiple entries in the DNS for a single domain, what problems could come up?
3. If all physical networks in the world were to be replaced by a single, uniform network such as Ethernet or Token ring, would IP addressing be still required? Why?
4. Find out how your computer at work or office obtains an IP address to communicate over the Internet.
5. Many organizations set up a proxy server. Find out more details about the proxy server in your organization, college or university, if there is one.
80