IP Forwarding Relates to Lab 3 Covers the
IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks. 1
Orientation • Internet is a collection of networks • IP provides an end-to-end delivery service for IP datagrams between hosts • The delivery service is realized with the help of IP routers 2
Delivery of an IP datagram • View at the data link layer: – Internetwork is a collection of LANs or point-to-point links or switched networks that are connected by routers IP 3
Delivery of an IP datagram • View at the IP layer: – An IP network is a logical entity with a network number – We represent an IP network as a “cloud” – The IP delivery service takes the view of clouds, and ignores the data link layer view IP 4
Tenets of end-to-end delivery of datagrams The following conditions must hold so that an IP datagram can be successfully delivered 1. The network prefix of an IP destination address must correspond to a unique data link layer network (=LAN or point-to-point link or switched network). 2. Routers and hosts that have a common network prefix must be able to exchange IP datagrams using a data link protocol (e. g. , Ethernet, PPP) 3. An IP network is formed when a data link layer network is connected to at least one other data link layer network via a router. 5
Delivery of IP datagrams • There are two distinct processes to delivering IP datagrams: – Forwarding: How to pass a packet from an input interface to the output interface. Makes use of a routing table – Routing: How to find and setup the routing tables (next hop) • Forwarding must be done as fast as possible: – on routers, is often done with support of hardware – on PCs, is done in kernel of the operating system • Routing is less time-critical – On a PC, routing is done as a background process 6
Processing of an IP datagram in IP IP router: IP forwarding enabled Host: IP forwarding disabled 7
Processing of an IP datagram in IP • Processing of IP datagrams is very similar on an IP router and a host • Main difference: “IP forwarding” is enabled on router and disabled on host • IP forwarding enabled if a datagram is received, but it is not for the local system, the datagram will be sent to a different system • IP forwarding disabled if a datagram is received, but it is not for the local system, the datagram will be discarded 8
Processing of an IP datagram at a router Receive an IP datagram 1. 2. 3. 4. 5. 6. 7. 8. 9. IP header validation Process options in IP header Parsing the destination IP address Routing table lookup Decrement TTL Perform fragmentation (if necessary) Calculate checksum Transmit to next hop Send ICMP packet (if necessary) 9
Routing tables • • Each router and each host keeps a routing table which tells the router how to process an outgoing packet Main columns: 1. Destination address: where is the IP datagram going to? 2. Next hop or interface: how to send the IP datagram? • Routing tables are setup so that a datagram gets closer to its destination with every hop Routing table of a host or router IP datagrams can be directly delivered (“direct”) or are sent to a next hop router (“R 4”). Entry in table will give IP address of the router’s interface over a network that you both have in common Destination 20. 2. 1. 0/28 10. 1. 0. 0/24 10. 1. 2. 0/24 10. 2. 1. 0/24 10. 3. 1. 0/24 20. 1. 0. 0/16 Next Hop direct R 4 10
A Typical Routing Table at a Host and a Router Destination Gateway 10. 0. 96. 100 10. 0. 160. 1 10. 0. 32. 0 10. 0. 192. 2 10. 0. 96. 0 10. 0. 160. 1 10. 0. 64. 0 10. 0. 192. 1 10. 0. 160. 0 *(direct) 10. 0. 192. 0 *(direct) 127. 0. 0. 1 * 0. 0(default) 10. 0. 160. 2 Genmask 255. 224. 0 255. 0. 0 Flags Iface UGH eth 0 UG eth 1 UG eth 0 UG eth 1 U eth 0 U eth 1 U lo UG eth 0 Prefix /32 /19 /19 /19 /8 /0 11
Type of routing table entries • Network route (prefix 1 -31) – Destination addresses is a network address (e. g. , 10. 0. 2. 0/24) – Most entries are network routes • Host route (prefix 32) – Destination address is an interface address (e. g. , 10. 0. 1. 2/32) – Used to specify a separate route for certain hosts • Default route (prefix 0) – Used when no network or host route matches – The router that is listed as the next hop of the default route is the default gateway (for Cisco: “gateway of last resort) • Loopback address (prefix 8) – Routing table for the loopback address (127. 0. 0. 1) – The next hop lists the loopback (lo 0) interface as outgoing interface 12
Routing table lookup • When a router or host needs to transmit an IP datagram, it performs a routing table lookup • Routing table lookup: Use the IP destination address as a key to search the routing table. • Result of the lookup is the IP address of a next hop router, or the name of a network interface Destination address Next hop network prefix IP address of (/1 -31) next hop router* or or host IP address (/32) Name of a or network loopback address interface (/8) or default route (/0) * Note: A router has many IP addresses. The IP address in the routing table refers to the address of the network interface on the same directly connected network. 13
Longest Prefix Match • Longest Prefix Match: Search for the routing table entry that has the longest prefix match with the destination IP address. WHY? – The longer the prefix the closer you are to destination…. 128. 143. 71. 21 1. Search for a match on all 32 bits 2. Search for a match for 31 bits …. . 32. Search for a match on 0 bits Host route 32 -bit prefix match Default route is represented as 0. 0/0 0 -bit prefix match The longest prefix match for 128. 143. 71. 21 is for 20 bits with entry 128. 143. 64. 0/20 Datagram will be sent to R 4 Matches but prefix 16 < 20 15
Forwarding to a directly connected interface 20. 2. 1. 0 IP Dest: 10. 2. 1. 55 R 4 ? ? 10. 4. 2. 0 10. 4. 2. 2 128. 5. 2. 1 136. 4. 33. 2 Datagram eth 1 ? 10. 2. 1. 0 10. 2. 1. 55/28 = 20. 2. 1. 0 10. 2. 1. 55/24 = 10. 4. 2. 0 10. 2. 1. 55/24 = 10. 1. 2. 0 10. 2. 1. 55/24=10. 2. 1. 0 ? 10. 3. 1. 0 Destination 20. 2. 1. 0/28 10. 4. 2. 0/24 10. 1. 2. 0/24 10. 2. 1. 0/24 10. 3. 1. 0/24 20. 1. 0. 0/16 Next Hop eth 0 ser 0 R 4 eth 1 eth 2 R 4 16
Forwarding to a Router as next hop 10. 1. 2. 1 20. 2. 1. 0 IP Dest: 10. 1. 2. 65 ? ? Datagram 10. 4. 2. 0 R 4 10. 4. 2. 2 10. 1. 2. 0 128. 5. 2. 1 136. 4. 33. 2 ser 0 ? ? 10. 2. 1. 0 10. 1. 2. 65/28 = 20. 2. 1. 0 10. 1. 2. 65/24 = 10. 4. 2. 0 10. 1. 2. 65/24 = 10. 1. 2. 0 Route to R 4 – IP address 10. 4. 2. 2/28 = 20. 2. 1. 0 10. 4. 2. 2/24 = 10. 4. 2. 0 10. 3. 1. 0 Destination 20. 2. 1. 0/28 10. 4. 2. 0/24 10. 1. 2. 0/24 10. 2. 1. 0/24 10. 3. 1. 0/24 20. 1. 0. 0/16 Next Hop eth 0 ser 0 R 4 eth 1 eth 2 R 4 17
Creating Topology Using Routing Tables Destination Router/ Interface 10. 0. 96. 100/32 10. 0. 160. 1 (R 1) 10. 0. 32. 0/19 10. 0. 192. 2 (R 2) 10. 0. 96. 0/19 10. 0. 160. 1 (R 1) 10. 0. 64. 0/19 10. 0. 192. 1 (R 3) 10. 0. 160. 0/19 eth 0 10. 0. 192. 0/19 eth 1 127. 0. 0. 0/8 lo 0. 0 10. 0. 160. 2 (R 4) 10. 32. 0. 0/19 R 2 R 3 10. 0. 64. 0/24 10. 0. 192. 0/19 All other destinations eth 1 R 4 eth 0 10. 0. 160. 0/19 R 1 10. 0. 96. 0/24
GNS 3 Example 19
Routing Table and Routing Cache on a R 1 20
Route Aggregation • Longest prefix match algorithm permits the aggregation of prefixes with identical next hop address to a single entry • This contributes significantly to reducing the size of routing tables of Internet routers 20. 2. 0. 0/16 -> 20. 00000010. 0. 0 20. 1. 1. 0/28 -> 20. 00000001. 0000 8+6=14 Destination Next Hop 10. 1. 0. 0/24 10. 1. 2. 0/24 10. 2. 1. 0/24 10. 3. 1. 0/24 20. 2. 0. 0/16 20. 1. 1. 0/28 R 3 direct R 3 R 2 10. 1. 0. 0/24 10. 1. 2. 0/24 10. 2. 1. 0/24 10. 3. 1. 0/24 20. 0/14 R 3 direct R 3 R 2 21
Addressing: routing to another LAN walkthrough: send datagram from A to B via R – focus on addressing – at IP (datagram) and MAC layer (frame) – assume A knows B’s IP address – assume A knows IP address of first hop router, R (routing table) – assume A knows R’s MAC address (ARP) A R 111 74 -29 -9 C-E 8 -FF-55 B 222 49 -BD-D 2 -C 7 -56 -2 A 222. 220 1 A-23 -F 9 -CD-06 -9 B 111. 112 CC-49 -DE-D 0 -AB-7 D 111. 110 E 6 -E 9 -00 -17 -BB-4 B 222. 221 88 -B 2 -2 F-54 -1 A-0 F 5 -22
Addressing: routing to another LAN A creates IP datagram with IP source A, destination B A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram v v MAC src: 74 -29 -9 C-E 8 -FF-55 MAC dest: E 6 -E 9 -00 -17 -BB-4 B IP src: 111 IP dest: 222 IP Eth Phy A R 111 74 -29 -9 C-E 8 -FF-55 B 222 49 -BD-D 2 -C 7 -56 -2 A 222. 220 1 A-23 -F 9 -CD-06 -9 B 111. 112 CC-49 -DE-D 0 -AB-7 D 111. 110 E 6 -E 9 -00 -17 -BB-4 B 222. 221 88 -B 2 -2 F-54 -1 A-0 F 5 -23
Addressing: routing to another LAN frame sent from A to R frame received at R, datagram extracted, passed up to IP v v MAC src: 74 -29 -9 C-E 8 -FF-55 MAC dest: E 6 -E 9 -00 -17 -BB-4 B IP src: 111 IP dest: 222 IP Eth Phy A IP Eth Phy R 111 74 -29 -9 C-E 8 -FF-55 B 222 49 -BD-D 2 -C 7 -56 -2 A 222. 220 1 A-23 -F 9 -CD-06 -9 B 111. 112 CC-49 -DE-D 0 -AB-7 D 111. 110 E 6 -E 9 -00 -17 -BB-4 B 222. 221 88 -B 2 -2 F-54 -1 A-0 F 5 -24
Addressing: routing to another LAN v R forwards datagram with IP source A, destination B v R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram MAC src: 1 A-23 -F 9 -CD-06 -9 B MAC dest: 49 -BD-D 2 -C 7 -56 -2 A IP src: 111 IP dest: 222 IP Eth Phy A R 111 74 -29 -9 C-E 8 -FF-55 IP Eth Phy B 222 49 -BD-D 2 -C 7 -56 -2 A 222. 220 1 A-23 -F 9 -CD-06 -9 B 111. 112 CC-49 -DE-D 0 -AB-7 D 111. 110 E 6 -E 9 -00 -17 -BB-4 B 222. 221 88 -B 2 -2 F-54 -1 A-0 F 5 -25
Addressing: routing to another LAN v R forwards datagram with IP source A, destination B v R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram MAC src: 1 A-23 -F 9 -CD-06 -9 B MAC dest: 49 -BD-D 2 -C 7 -56 -2 A IP src: 111 IP dest: 222 IP Eth Phy A R 111 74 -29 -9 C-E 8 -FF-55 IP Eth Phy B 222 49 -BD-D 2 -C 7 -56 -2 A 222. 220 1 A-23 -F 9 -CD-06 -9 B 111. 112 CC-49 -DE-D 0 -AB-7 D 111. 110 E 6 -E 9 -00 -17 -BB-4 B 222. 221 88 -B 2 -2 F-54 -1 A-0 F 5 -26
Addressing: routing to another LAN v v R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame MAC src: 1 A-23 -F 9 -CD-06 -9 B contains A-to-B IP datagram MAC dest: 49 -BD-D 2 -C 7 -56 -2 A IP src: 111 IP dest: 222 IP Eth Phy A R 111 74 -29 -9 C-E 8 -FF-55 B 222 49 -BD-D 2 -C 7 -56 -2 A 222. 220 1 A-23 -F 9 -CD-06 -9 B 111. 112 CC-49 -DE-D 0 -AB-7 D 111. 110 E 6 -E 9 -00 -17 -BB-4 B 222. 221 88 -B 2 -2 F-54 -1 A-0 F 5 -27
Routing table manipulations with ICMP • When a router detects that an IP datagram should have gone to a different router, the router (here R 2) • forwards the IP datagram to the correct router • sends an ICMP redirect message to the host • Host uses ICMP message to update its routing table (in most implementations it is only the route cache that is updated) R 1 28
ICMP Router Solicitation ICMP Router Advertisement • After bootstrapping a router broadcasts an ICMP router solicitation. • In response, routers send an ICMP router advertisement message • Also, routers periodically broadcast ICMP router advertisement This is sometimes called the Router Discovery Protocol 29
- Slides: 28