1 Chapter 6 – Internet Protocol: Connectionless Datagram Delivery 6.3 Internet Architecture and Philosophy Chapters are about this layer NETWORK INTERFACE (MAC) LAYER Not part of IP Chapter 12 will be about this layer Various later chapters about these
2 6.5 Connectionless Delivery System Internet Protocol (IP) is an ► unreliable (best-effort) ► connectionless packet delivery service (compare wired Ethernet) IP TCP SMTP, HTTP, etc. 6.6 Purpose of the Internet Protocol Chapter 6 – Packet format Chapter 7 – Forwarding Chapter 8 – Error messages (but some errors are reported)
3 Figure 6.3 Format of an IP Datagram
4 ORIGINAL ULTIMATE
Datagram Encapsulation
6 Figure 2.2 Ethernet Frame Format 0800IP DATAGRAM
7 Figure 6.7 Where Fragmentation Occurs (Payload) Fragmentation
8 Figure 6.8 (a) Original Datagram carrying 1400 octets of data (b) For a network MTU of 620 the data are fragmented between three new datagrams. They must be complete datagrams, with header!
9 Where to reassemble the payload? How to reassemble the payload? Reassembly of Fragments
10 MF 1 1 0
11
12
13 Routers make forwarding decisions. HOST Fig 7.1 – blue host has three possible choices when transmitting a datagram sender Chapter 7 IP: Forwarding IP Datagrams Hosts also make forwarding decisions.
Direct and Indirect Delivery of an IP Datagram Direct: No router between source and destination Indirect: sender must be able to identify first router in chain Q: How does sender know that direct delivery is possible? A: network parts of source and destination IP addresses are identical.
15 Indirect delivery is a concatentation of direct deliveries; Alternatively, direct delivery is the trivial case of indirect delivery. Last router in chain must deliver directly Datagram Delivery over a Single Network
Table-Driven IP Forwarding Routers store their forwarding instructions in “routing tables.” Hosts also have routing tables, but they are small. 7.5 Next-Hop (Next-Stop?) Forwarding A routing table contains pairs (N,R) where N is the IP address of a destination network and R is the IP address of the “next” router along the path to N. The “next hop” must be a directly-connected router. A router knows only the “next hop” along the way, not the complete path to the destination.
17 Size of routing table is proportional to number of networks. Fig. 7.2(b) the routing table in R
18 Consequences of choosing routes based only on the destination network: ► all traffic from a source to a given destination follows the same path; multiple paths may not be followed concurrently. ► only the final router along the path can know if the destination is operational (for Ethernet, not even the final router). ► forward and reverse paths may be different. Routes are chosen only on basis of destination network BHM NO CHL ATL
Default Routes Routing table in Q: Deliver Directly Deliver Directly DefaultForward to Huge benefit! Entire external Internet can often be collapsed into a single entry!
The IP Forwarding Algorithm Fig 7.3 Check IP Version and checksum !
21 Forwarding Algorithm (revised) Check IP version and header checksum Extract destination IP address, D, from the datagram; if table contains a host-specific route for D send datagram to next-hop specified in table (ENCAPSULATE) and quit; compute N, the network prefix of address D; if N matches any directly-connected network address deliver datagram to destination D over that network (ENCAPSULATE); else if table contains a route for network prefix N send datagram to next hop specified in table (ENCAPSULATE); else if table contains a default route send datagram to default router specified (ENCAPSULATE); else declare a forwarding error; ENCAPSULATE = map IP address to a physical address, encapsulate the datagram in a frame and send.
Dotted Decimal Notation compute N, the network prefix of address D; “Address Mask”
23 Elaboration of routing algorithm (figure 7.3, or revision): “if table contains a route for network prefix N send datagram to next hop specified in table;” Algorithm is: For each row of the forwarding table If (address mask).and. IP D = destination network IP address then send datagram to next hop IP address exit routing algorithm. Notation: Table row contains (destination network IP address, next hop IP address) Recall forwarding table:
Forwarding with IP Addresses which fields are changed by router? Nowhere! The router simply passes the next-hop IP address down to the network interface layer for ARP processing. After table-lookup has determined the next-hop IP address, where in the IP datagram does the router IP layer store it? In Destination IP Address?
25 Why not use physical addresses when storing and computing routes? 01:FA:96:43:1B:49 02:16:7B:62:78:F3
26 Why does IP software avoid using physical addresses when storing and computing routes? Using only IP addresses above the dashed line makes routes easy to examine or change and hides the details of the underlying physical networks. Figure 7.4
Handling Incoming Datagrams Hosts IP layer checks its own IP address against the destination IP address in the arriving datagram. If match, OK else host discards datagram. Why discard? ► there has been an error and if host forwards the datagram to the correct destination, error will persist; ► we don’t want the host to be diverted from its legitimate work to do the router’s work.
Handling Incoming Datagrams – continued Routers Check all of own IP addresses against the destination IP address in incoming datagram. If no match (usual situation) router is a stop along the way from source to destination – execute forwarding algorithm (fig 7.3) else router is final destination of this datagram – message is for higher layer within the router, eg. routing table change
Establishing Routing Tables For now, assume routing tables are loaded manually; In chapters 13 and 15 we’ll see protocols that allow routers to learn routes from each other. End of Chapter 7.
30 Summary of Bridge 1.Like computer with 2 NICs in promiscuous mode 2.Store and forward frames 3.Processes only valid frames 4. Works at layer 2 with hardware addresses 5. Automatically learns which destination hosts are reachable from which interface (no administrator required). 6. Does not change frame in any way (bridges “leave no fingerprints”) 7. Forwards frames with local broadcast hardware address in destination-address field Summary of Router 1.Like computer with 2 NICs in normal mode 2. Store and forward IP datagrams 3. Processes only valid IP datagrams 4. Works at layer 3 with IP addresses 5.Administrator has to enter next hop in routing tables. 6. When forwarding IP datagram, changes at least two fields in datagram header 7. Does not forward IP datagrams with local broadcast IP address in destination-address field
31 Perspective on Comer’s Chapters 6 – 8 Chapter 6 - Internet Protocol: Connectionless Datagram Delivery no routers necessarily involved – lab sessions Chapter 7 - Internet Protocol: Forwarding IP Datagrams how routers work – lab session 4 Chapter 8 – Internet Protocol: Error and Control Messages (ICMP) PING in lab sessions 1 – 3, will see more in later labs.
32 Chapter 8 – Internet Protocol: Error and Control Messages (ICMP) 8.2 The Internet Control Message Protocol ICMP is a required part of IP. Although IP does not guarantee delivery, it does not capriciously discard datagrams and when it is forced to do so it tries to be helpful by sending an ICMP message. Both routers and hosts send ICMP messages.
33 The ultimate destination of an ICMP message is the IP software on the machine intended to receive the message – it is the IP software that has the code to handle the message. 8.2 The Internet Control Message Protocol – contd. Like all traffic across an IP network, ICMP messages travel in the payload of an IP datagram. 1 ICMP Message
Error Reporting vs. Error Correction Not all ICMP messages relate to errors – eg. PING. For errors, ICMP is a reporting mechanism, not a correcting mechanism. When a datagram causes an error, the unit detecting this usually sends an ICMP message back to the original source of the datagram, stating why the datagram was dropped. Why is notification restricted to the original source? That’s all the detecting unit knows!
35 Datagrams carrying ICMP messages are subject to the usual IP uncertainty. 8.4 ICMP Message Delivery Exception: If a datagram carrying an ICMP error message encounters difficulty, an error message about this error message is not sent. ICMP is not considered a higher-layer protocol – it is part of IP
ICMP Message Format Although each ICMP message has its own format, they all begin with the same three fields: ICMP messages that report errors always include the header plus additional octets from the IP datagram that caused the problem
37 Figure 8.2 Values that can appear in the TYPE field of an ICMP message Error? No Yes ? No ? Yes
Testing Destination Reachability and Status (Ping) Type 8 is request, type 0 reply. IDENTIFIER is a random number, used to match replies with requests. Will be studied in Lab Session #1
Reports of Unreachable destinations When a router cannot forward or deliver an IP datagram, the router sends an ICMP destination unreachable (type 3) message back to the original source.
40 * Code 4 used for path MTU discovery * 8.8 Reports of Unreachable destinations - continued
41 Comer page 116: A router may not know of all delivery failures, eg. final delivery over Ethernet. From revised version of routing algorithm (fig 7.3): compute N, the network prefix of address D; if N matches any directly-connected network address deliver datagram to destination D over that network (ENCAPSULATE); ENCAPSULATE = map IP to a physical address, encapsulate the datagram in a frame and send. No feedback to IP if ARP fails.
Route Change Requests from Routers If router R2 receives a datagram that it has to forward to R1, R2 sends an ICMP redirect message (type 5) to the sending host, telling it in future to send such datagrams directly to R1. Fig 7.1
Route Change Requests from Routers – continued This is not a general mechanism for route changes. It is restricted to routers sending to directly-connected hosts. R5 cannot redirect R1 to use the shorter path from S to D Figure 8.7
Detecting Circular or Excessively Long Routes Each time a router forwards a datagram it decrements the TTL by 1 If the result is zero, the router discards the datagram after sending an ICMP time exceeded (type 11, code 0) message. When a destination host reassembles a fragmented payload, it’s possible that some fragments are lost. When the host receives the first fragment it starts a reassembly timer. If the timer expires before all fragments arrive, the host gives up and sends an ICMP type 11, code 1 message back to the original source.
45
46 Input AInput B Output Output A.AND. B 2 binary inputs A, B Mask IP Destination Address
47 Input AInput B Output Output A.OR. B 2 binary inputs A, B