1 / 32

Internet Protocol: IP Routing

Internet Protocol: IP Routing. Linda Wu (CMPT 471 • 2003-3). Content. Definitions Direct / indirect delivery Table-driven IP routing IP routing algorithms Routing with IP addresses Incoming datagram handling Routing in Linux References: chapter 8 & 10. Definitions.

junius
Télécharger la présentation

Internet Protocol: IP Routing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Internet Protocol: IP Routing Linda Wu (CMPT 471 • 2003-3)

  2. Content • Definitions • Direct / indirect delivery • Table-driven IP routing • IP routing algorithms • Routing with IP addresses • Incoming datagram handling • Routing in Linux References: chapter 8 & 10 CMPT 471  2003-3

  3. Definitions In packet-switched systems: • Routing • The process of choosing a path over which to send packet • IP routing • The process of choosing a path within a single network or across multiple networks over which a datagram should be sent • 2 forms of routing • Direct delivery • Indirect delivery CMPT 471  2003-3

  4. Definitions (cont.) • Router • A computer which interconnects multiple physical networks and makes routing decisions • Host • A computer that usually connects directly to one physical network • Multi-homed host • A host that connects directly to multiple networks * TCP/IP standards draw a sharp distinction between the functions of a router and of a host CMPT 471  2003-3

  5. Direct / Indirect Delivery • Direct delivery • The ultimate destination connects to the same physical network as the deliverer • No router involved • Direct delivery occurs when: • Source and destination are in the same physical network, or, • The delivery is between the last router and the destination CMPT 471  2003-3

  6. Direct delivery Host Host Direct delivery Net 1 To the rest of internet Router Direct / Indirect Delivery (cont.) CMPT 471  2003-3

  7. Direct / Indirect Delivery (cont.) • The source determines whether the delivery is direct by: • Extracting the destination network address from the destination IP address • Comparing the destination network address with its own network address • If a match is found  direct delivery • How is datagram delivered? • Map the destination IP address into a physical address (mapping table, ARP) • Encapsulate datagram in a frame • Use physical hardware to deliver it CMPT 471  2003-3

  8. Direct / Indirect Delivery (cont.) • Indirect delivery • The destination is not on the same physical network as the source • The datagram goes from router to router till it reaches the one connected to the same physical network as the destination • Note: a delivery always involves one direct delivery but zero or more indirect delivery, with the direct delivery as the last one CMPT 471  2003-3

  9. Host Net 1 Indirect delivery Router Net 2 Router Indirect delivery Net 3 Direct delivery Host Direct / Indirect Delivery (cont.) (source) (destination) CMPT 471  2003-3

  10. Direct / Indirect Delivery (cont.) • How is datagram delivered? • The source maps the nearest router’s IP address into a physical address, encapsulates the datagram in a frame, and sends the frame to the router • The router extracts the datagram and selects the next router on the path towards the destination • Datagram is again placed in a frame and sent over next physical network to a second router • So on till it can be delivered directly CMPT 471  2003-3

  11. Table-Driven IP Routing • Routing table • Stores information about possible destinations and how to reach them • Both hosts and routers have routing tables • Reduce the size of routing table • Contains next hop addresses instead of the routes to the ultimate destinations • Contains destination network address instead of every possible IP address (i.e., network-specific routing instead of host-specific routing) CMPT 471  2003-3

  12. B A Net 1 Net 2 Net 3 R1 R2 Table-Driven IP Routing (cont.) (a) Routing tables based on route (b) Routing tables based on next hop CMPT 471  2003-3

  13. S A B C D Net 1 Net 2 R1 Table-Driven IP Routing (cont.) CMPT 471  2003-3

  14. Table-Driven IP Routing (cont.) • Consequences of routing based on next hop and destination network address • All traffic destined for a given network takes the same path without regard to the delay or throughput of the physical network • Only the final router along the path can determine whether the destination host exists or is operational • Datagrams from A to B may follow an entirely different path than that from B to A CMPT 471  2003-3

  15. Table-Driven IP Routing (cont.) • Next-hop routing • The routing table holds only the address of next hop instead of the complete route • A machine M’s routing table contains pairs (N, R) • N: the destination network address • R: the IP address of the next router along the path to N; router R is called next hop * R must lie on the network to which M connects directly * The routing table on M only specifies one step along the path from M to a destination network; M does not know the complete path to a destination CMPT 471  2003-3

  16. 20.0.0.5 30.0.0.6 40.0.0.7 Net 1 10.0.0.0 Net 2 20.0.0.0 Net 3 30.0.0.0 Net 4 40.0.0.0 Q R S 30.0.0.7 10.0.0.5 20.0.0.6 Table-Driven IP Routing (cont.) • The size of routing table depends on the number of networks in the internet • The size of routing table is independent of the number of individual hosts connect to the networks CMPT 471  2003-3

  17. A Net 1 R1 R3 Net 2 Net 3 R2 B Table-Driven IP Routing (cont.) • Host-specific routing • The destination host address is given in the routing table • Efficiency is sacrificed for other advantages: • The local network administrator is given more control over routing CMPT 471  2003-3

  18. A Net 1 R1 Net 2 R2 (default router) To the rest of internet Table-Driven IP Routing (cont.) • Default routing • Consolidates multiple entries into a default case • First look in the routing table for the destination network; if no route appears in the table, send the datagram to the default router • Especially useful when a site has a small set of local addresses and only one connection to the rest of the internet CMPT 471  2003-3

  19. Table-Driven IP Routing (cont.) • Static v.s. dynamic routing table • Static routing table • The administrator enters the route for each destination into the table • The table cannot update automatically when there is a change in internet; it must be manually altered by the administrator • Can be used in a small internet that does not change very often • Dynamic routing table • The routing table is updated periodically using dynamic routing protocol: RIP, OSPF, BGP • Used in large internet CMPT 471  2003-3

  20. IP Routing Algorithms • Standard routing algorithm for classful addressing • routing table entries (network address, next hop) • Hierarchical strategy for routing lookup • Direct delivery • Host-specific routing • Network-specific routing • Default routing CMPT 471  2003-3

  21. IP Routing Algorithms (cont.) Input: datagram DG, routing table T D  extract destination IP address from DG N  compute destination network address if N matches any directly connected network address map D to a physical address PD encapsulate DG in a frame send the frame to PD over that network else if T contains a host-specific route for D send DG to next hop specified in T else if T contains a route for network N send DG to next hop specified in T else if T contains a default route send DG to the default router else declare a routing error CMPT 471  2003-3

  22. IP Routing Algorithms (cont.) • Subnet routing algorithm • Routing table entries (subnet mask, network address, next hop) • Subsumes all special cases of the standard algorithm • Host-specific routing: mask = all 1s, network address = host IP address • Routing to a classful network: using default mask of that class • Default routing: mask = all 0s, network address = all 0s CMPT 471  2003-3

  23. IP Routing Algorithms (cont.) Input: datagram DG, routing table T D  extract destination IP address from DG if prefix of D matches any directly connected network address map D to a physical address PD encapsulate DG in a frame send the frame to PD over that network else for each entry in T do N = D & subnet mask if (N == network address field of the entry) route DG to the specified next hop endfor if no match found, declare a routing error CMPT 471  2003-3

  24. Routing with IP Addresses • IP routing does not alter datagram except for, • Decrementing time to live (TTL) • Recomputing checksum • Source and destination IP addresses always specify the original source and ultimate destination • Next-hop address • Selected by IP routing algorithm • Used by network interface software to get physical address • Discarded after physical address is found CMPT 471  2003-3

  25. Routing with IP Addresses (cont.) • Why use IP address in routing table? • Provide an clean interface between IP routing software and high-level software that manipulates routes • The objective of IP protocol is to hide the details of underlying networks CMPT 471  2003-3

  26. Income Datagram Handling When a datagram arrives at a machine: • The machine compares the destination address with the IP address for each of its network connection • If the destination address matches the machine’s IP address • IP software accepts the datagram • Passes it to the appropriate higher-level protocol for further processing • If not match • Host: discard the datagram • Router: forward the datagram using routing algorithm CMPT 471  2003-3

  27. Routing in Linux • Route command • Show / manipulate the IP routing table • Run “route” on July (172.16.1.7 / 172.18.1.7) CMPT 471  2003-3

  28. Routing in Linux (cont.) • Flags • U (up): the router is up and running • G (gateway): the destination is in another network, use gateway for delivery • H (host-specific): destination is a host • D (added by redirection): the entry is added to the routing table by a redirect message • M (modified by redirection): the entry is modified by a redirect message • Metric: distance (# of hops) to the destination address • Ref: # of users that are using this route • Use: # of packets transmitted through this router for the corresponding destination • Iface: the name of the interface CMPT 471  2003-3

  29. Routing in Linux (cont.) • Manipulate routing table route add/del –net route add/del –host Examples: route add -net 192.56.76.0 255.255.0.0 gw 192.56.76.9 eth0 route del -net 192.56.76.0 255.255.0.0 gw 192.56.76.9 eth0 route add -host 192.168.0.253 gw 192.168.1.3 • More details: man route CMPT 471  2003-3

  30. Routing in Linux (cont.) • Traceroute command • Track packet’s routing path to a host • Run “traceroute spring.net17” on July Path: july  cisco.net18  january  spring.net17 traceroute to spring.net17 (172.17.1.250), 30 hops max, 38 byte packets 1 cisco.net18 (172.18.1.254) 3.964 ms 1.787 ms 1.925 ms 2 january (172.16.1.253) 6.898 ms 0.935 ms 0.827 ms 3 spring.net17 (172.17.1.250) 1.712 ms 0.566 ms 0.599 ms CMPT 471  2003-3

  31. Routing in Linux (cont.) • How traceroute works? • Launch UDP probe packet with ttl =1, and listen for reply; increase ttl by 1, or stop probing, after receiving the reply • 2 types of reply • ICMP time exceeded message (from router) • ICMP port unreachable message (from the destination) • -p: to set the base UDP port number used in probes • Default base port: 33434; traceroute hopes that nothing is listening on UDP port (base ~ base + nhops – 1) on destination • The port number is incremented by 1 for each subsequent packet CMPT 471  2003-3

  32. Routing in Linux (cont.) • -q: number of probes • Default: 3 (3 probes are sent at each ttl setting) • -m: maximal ttl used in outgoing probe packets • Default: 30 • -w: time to wait for a response to a probe • Default: 3s (if there is no response within 3s, “*” is printed for that probe) • Output • Each line is composed of ttl, address of router, round trip time of each probe • More details: man traceroute CMPT 471  2003-3

More Related