720 likes | 930 Views
ICMP. Based on Chapter 23 in Computer Networks and Internets, Comer. ICMP. I nternet C ontrol M essage P rotocol is an extension to the Internet Protocol (defined by RFC 792).
E N D
ICMP Based on Chapter 23 in Computer Networks and Internets, Comer
ICMP • Internet Control Message Protocol is an extension to the Internet Protocol (defined by RFC 792). • ICMP packets convey information about errors that occurred, or control information (indicating that a source should transmit less or reroute, etc.) and general information about the IP delivery system. • ping and tracert use ICMP to provide information about Internet connections. • “Messages for routers”
ICMP categories • ICMP packets fall into two categories • Error messages: ICMP packets that are sent when a non-ICMP packet encounters some difficulty. • Reply/request: ICMP packets requesting information and ICMP packets replying to those requests. • ICMP packets are handled like any ordinary packet except that an ICMP packet that encounters difficulty does not result in further ICMP packets
Nested encapsulations An ICMP message is placed in an IP packet which is placed in a Layer 2 frame, such as Ethernet. But ICMP is considered a Layer 3 service. ICMP is a Layer-3 message encapsulated in another Layer-3 packet.
Source Quench • If a router’s buffer is full, it is forced to drop a packet. • When routers drop a packet, they (may) send a message to the source. • The source reduces the rate at which it is transmitting messages. • This is part of “flow control.” • Analog of xon-xoff – the ASCII code printers use to indicate the buffer is full
Source Quench Source Quench Message sends back header and some data from packet being dropped.
Destination Unreachable • Indicates that a packet cannot be delivered because the destination cannot be reached. • There could be various reasons • the host is unreachable or unknown • the network is unreachable or unknown • the network or host is unreachable for this type of service • the protocol or port is unknown or unusable • fragmentation is required but not allowed (DF-flag is set)
Ports (physical) • There are “physical” ports and “logical” ports. • A physical port is a specific place for physically connecting to another device, usually with a socket and plug of some kind. • Serial ports: data is sent through port and corresponding connection bit-by-bit. • Parallel ports: data is sent through port and corresponding connection several bits at a time on parallel wires.
Ports (logical) • A logical port is the software place (address) for connecting. • In the client/server model, a computer acting as a server typically has many services available, so the client must specify not only which computer but which port. • Port numbers are from 0 to 65535. Ports 0 to 1023 are reserved for use by certain privileged services.
Well-known ports • Certain services, like Hypertext Transfer Protocol, have pre-assigned ports. These are called "well-known ports" and have been assigned by the Internet Assigned Numbers Authority (IANA). • HTTP uses port 80 as a default, it does not have to be specified in the URL. • Other applications are given port numbers dynamically. When a service starts, it is said to “bind” to its designated port. Clients wanting to use the service, must request to bind to the designated port number.
Echo Request/Reply • Used to determine whether hosts are reachable on the network. • A source sends an Echo (request) message to a destination. The destination host responds with an Echo Reply. • The request can contain some data, the reply contains the same data. • When one pings, one issues a series (typically four) ICMP echo requests. If there is a successful echo from the destination, then the network connection is fine.
Echo Read echo, think of request for echo
Time Exceeded • A packet has a TTL (time to live) field. It is decremented by each router it passes through. If the TTL field reaches zero, a TTL exceeded message is sent to the source. (“Time” means hops here.) • This stops mislabeled packets from continuously using bandwidth as they are passed around the network. • Another time exceeded message occurs when a destination receives a fragmented packet. It starts a timer and sends a message to the source if all fragments are not received within a certain amount of time. (“Time” means time (seconds) here.)
Time Exceeded Message Two kinds
traceroute/tracert • TTL (time to live) plays an important role in the traceroute command. • Traceroute sends out a series of ICMP packets, the first has a TTL of 1. So that packet makes one hop, its TTL is decremented to zero and a Time Exceeded packet is sent back to the source. • The source address of the Time Exceeded packet is the first node of the packet’s route.
traceroute (Cont.) • The source then issues successive ICMP packets each with the TTL one higher than the previous packet. Each packet gets one hop further before a Time Exceeded packet is sent to the source. • In this way the source collects information on the nodes comprising the packet’s route.
tracert versus traceroute • traceroute is a Unix command and that tracert is a Windows/DOS command. They differ not only in which operating system the command is issued from but also in how the process is terminated. • The tracert (Windows/DOS) packets have an echo request. So when the packet finally reaches the destination, it does not issue a Time Exceeded message but rather an echo reply.
Unix traceroute termination • A traceroute (Unix) packet requests a port number that is outside the normal range. • When the packet reaches its destination computer, the destination sends a Port Unreachable message. • Destination Unreachable message with code 3, port unreachable. • If you see an asterisk (*), this indicates a hop that exceeded some time limit (real time, not TTL time).
Redirect • Used by a host or router to let the sending host know that packets should be forwarded to another address. • A network may have more than one router connected. One router will serve as the “default gateway” or “default router.” This is where the computer sends messages if it does not know where to send them.
Redirect • If the default router determines that the host should have sent the message to another router instead, it forwards the message to that router but it also sends an ICMP redirect message to the source so that it will update its table and send any future message with that destination to the correct router.
Redirect Message Router address that should be used in the future.
Address Mask Request/Reply • A diskless workstation does not know its IP address when it boots and uses RARP to determine it. • There is an ICMP packet used if a host does not know its subnet mask. • The host broadcasts an address mask request when it boots, and routers that receive the request send the network’s subnet mask.
Timestamp/Timestamp Reply • Like Echo messages, but have a field for the time to be entered (with millisecond precision). This provides one with • a measure of how long remote systems spend buffering and processing packets • a way for hosts to synchronize their clocks.
Determining path MTU • A path MTU is the smallest MTU (maximum transmission unit, i.e. maximum packet size) along a route from source to destination. • One can use some ping options to determine a path MTU. • One obtains the ping options by typing ping /?
Ping options • The two relevant ping options for determining path MTU are – l (ell) and –f. • The –l option is followed by a number which is the size of the IP packet being sent. • The –f options sets a flag in the IP packet that disallows fragmentation. • The packet will be dropped rather than broken up. • A destination unreachable ICMP message is sent to the source.
Determining path MTU • One can set the IP packet size to something large and in addition set the flag to block fragmentation. • Then do a (binary) search on the packet sizes, to determine the largest packet that gets through. This is the path MTU.
TCP Based on Chapter 24 in Computer Networks and Internets, Comer
TCP • UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) sit on top of IP (Internet Protocol) in the Transport layer of the TCP/IP model. • While IP is responsible for delivering the packets, TCP is in charge of ensuring that messages were received (reliability) and delivered to the correct application (de-multiplexes).
Somewhat Connection-Oriented • TCP provides some of the features (especially reliability) of a connection-oriented scheme to the underlying connectionless IP delivery system. • Recall the TCP/IP Model’s transport layer is “thicker” than OSI Model’s transport layer, this is because TCP takes on some of the responsibilities of the OSI Model’s Session Layer (which establishes and terminates a communication session – agreements to communicate).
TCP Example • When an HTML file is sent to you (the client) from a Web server, the server’s TCP layer breaks the file into packets, numbers the packets, and then passes them one-by-one to its IP layer. • The packets may follow different routes. • Your (the client’s) TCP layer collects and reassembles the individual packets and hands a single file to your HTTP program in the Application Layer.
TCP • TCP compensates for loss and/or delay of packets in an internet. • It hides the loss or delay of packets from the higher layers. • TCP provides reliability without sacrificing efficiency. • TCP allows applications on different computers to interact without regard for the details of the connection between them.