Route Optimization (intra-AS) Petr Grygárek © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 1 Goal of route optimization • Static routing: • More predictable and safer • Dynamic routing: • • • • Automatically reacts on topology changes Lower administration Higher CPU and memory utilization Consumes bandwidth • • • • selection from routes learned from various routing protocols policy-based routing controlled redistribution ... By using route optimization, we influence the process of best routes selection © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 2 How can we influence routing decision ? • • • • Selection of proper routing protocol • Metric, load balancing support, ... Configuration of routing protocol and link parameters • • • • setting of link costs creating router areas, summarization default route propagation, route filtering … Local definition of packet forwarding rules for particular router (policy routing) AD manipulation • For whole routing protocol of for particular routes © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 3 Metric • Metric of link/path determines the preference of that link/path • Various metrics reflect current link properties • • Lower metric is preferred • • Scalar metric Composite metric • We need to compare metric values • Transformed to scalar metric (coefficients) • The same transformation method should be used at every router Static and dynamic metric • • • Dynamic metric incorporate instant link parameters (may change rapidly) Commonly, only static metric is used Risk of route flapping when dynamic metric of a link changes too often • Dynamic measurements of link characteristics (load, error rate) needs to be averaged over time © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 4 Load balancing • How many routes to the same network are maintained in routing table ? • Equal-cost load balancing – limited by maximum paths allowed • Unequal-cost – limited by variance (and max. paths) • Based on utilized loop-free path calculation algorithm, routing protocol does not guarantee to provide ALL alternate paths • Load balancing method • Per-packet – round-robin, slower implementation (SW) • Per-source/Per-destination/Combination of both • faster (easier HW implementation when using route cache) • load balancing efficiency depends on traffic pattern © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 5 Usage of Default Routes • • Default route limits number of records in routing tables Denoted as 0.0.0.0/0 • Static default • Dynamic default (propagated by/learned from IGP protocols) • Matches every packet • Possibly more floating static defaults • • • Propagated as 0.0.0.0/0 or as specially-tagged records Receiving router chooses from candidate defaults based on normal metric Origination of default route: • • Redistribution of static default Router itself is the source of default • router itself doesn’t have to have default in it’s routing table, but a set of specific routes instead © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 6 Multiprotocol Routing © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 7 Multiprotocol Routing - Principle • Route table (RIB) filled-in with routes by more routing processes (protocols) • even multiple instances of the same routing protocol • Routes learned from multiple routing protocols are uncomparable • various routing protocols use incompatible metrics • If multiple (potentially different) paths to some network are learned from multiple routing protocols, router must decide which one to place into routing table © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 8 Reasons for multiprotocol routing • History of particular network • Limited routing protocol support in routers and/or • host operating systems Different routing protocols feasible in various parts of internetwork • fast LANs • slow WAN links • dial-on demand circuits • large ISP network • ad-hoc wireless network • Inter-AS link •… © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 9 Multiprotocol routing Administrative distance distance (AD) – specifies preference of • Administrative particular routing protocol particular routing protocol • AD is Cisco term, but the concept is general • Route with lower AD is always better • Regardless of metric values • Only route metrics with the same mask can be compared • Rememer, longest match always wins • AD has only local scope (not propagated between routers) a path is learned by multiple routing protocols, path from • Ifmore preferred routing protocol is placed into routing table more preferred routing protocol is placed into routing table if multiple paths are learned from the same routing protocol, • Only protocol metric is used to choose between them protocol metric is used to choose between them © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 10 Administrative Distance settings • Common AD settings: • Connected < Static < OSPF < RIP • (lower is more preferred) • Cisco AD default values: • Connected: • Static • IGRP (Cisco) • OSPF • IS-IS • RIP 0 (cannot be changed) 1 100 110 115 120 © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 11 Tricks with AD setting • Set AD for routes to specific networks only • Set AD for (some) routes received from some neighbor • LSA originator in case of OSPF • Set AD=255: do not use that route • Set different AD for protocol's internal and external routes • OSPF: intra-area are ALWAYS preferred “inside” OSPF, but resulting route calculated by OSPF may be compared with same route from other protocol(s) using AD •… © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 12 Floating Static Routes • Floating static route = static route with worse • administrative metric than normally used route Becomes active (“floats up”) when the route normally used is lost • routing protocol removes route • next hop specified in primary static route becomes unreachable • Often used with dial-on-demand links • floating static route forwards packet via dial-on-demand circuit © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 13 Routing Processes • Router can run multiple separate routing processes (of various or the same routing protocols) • Every process works with subset of router’s interfaces • multiple routing protocols on the same interface may be useful sometimes also • Cisco IOS: can support up to 30 routing processes (instances) • More instances of the same routing protocol possible • Cisco IOS: RIP is an exception, but RIP “contexts” may serve as workaround • Routing table filled by all routing processes • • But even DV routing processes have to maintain separate data structures (routing tables learned just by that protocol) Routing processes don’t interchange information mutually if not explicitly instructed to do so • Information interchange can be configured using redistribution © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 14 Redistribution • Redistribution = interchange of information between routing processes (and appropriate protocols) • Redistribution of static routes or connected networks into routing protocol is a special (but frequent) case • Possibility to filter routes during redistribution • One-way and Two-way redistribution © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 15 Problems with Redistribution (1) • Redistribution from classless to classful protocol • Distributing subnets (subnetted major networks) from classless into classful protocol cause problems on some routes • See http://www.cisco.com/warp/public/105/52.html • Cisco: When redistributing from classful routing protocol into OSPF, only classful routes are redistributed by default. Use : „subnets“ keyword in redistribute command to override this behavior. • Uncompatible metric • Route are redistributed with “default” metric • (“default” metric value may be specified) © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 16 Problems with Redistribution (2) • Circular redistribution • when redistribution takes place on more routers • redistributed routes have to be filtered to prevent loops • Bad AD setting may cause problems • See http://www.cisco.com/warp/public/105/redist.html#ad • Intra-AS traffic goes through other AS’s routes • may be resolved by manual incresing of redistributed routes’ metric • Suboptimal routing or even routing loops • AS topology: A=B-C • Traffic from B to C via A © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 17 Redistribution – advanced issues • Possible to specify protocol-dependent parameters and/or filtering criteria • metric-type (OSFP: E1,E2) • tag •… • If protocol tags external routes, it will not export them • again out of AS Recommended usage of redistribution if configured on more than one router: • oneway redistribution + default route propagated in opposite direction © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 18 Redistribution examples • RIP and EIGRP on single router • RIP and OSPF on single router (external routes) • Multiple independent routing processes of the same • • • protocol on single router Default routing loop prevention mechanism • Different AD for external routes Preventing circular redistribution with route filtering Typical scenario: • Static routes into stub networks redistributed into backbone • • routing protocol Dynamic routing protocol in backbone. Stub networks reach other networks using default. © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 19 Route tagging • Some routing protocols allow to append tag to routes • that they advertise Usage: • Candidate default route • External route • Internal routes always preferred over external (internal traffic • shouldn’t leave AS) External routes should not be advertised back out of AS • Custom route tagging • route filtering and/or redistribution control may be based on these user-defined route tags © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 20 Vector • Distance updates updates Route Filtering Protocols: filtering of routes in routing • Networks if advertised/received updates filtered (out/in) • Based on destination network or neighbor (update source) • Link State Protocols: of SPF always based on entire topology database (no • calculation filtering of LSAs!) • filtering only on area/AS boundary • filtering possible when placing routes into routing table (anywhere) • used sporadically • Filtering during redistribution • Cisco: redistribution filtering implemented by distribute lists • distribute lists use ACL or prefix list to define routes to be filtered • per routing protocol/per interface/per neighbor © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 21 Metric manipulation in DV protocols • Metric may be manipulated for networks • advertised or received in routing updates May help to • give preference to particular route • avoid intra-AS traffic to leak out of the AS • defend against circular redistribution © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 22 Passive Interface • Route updates are not sent out of passive interface • Received updates accepted • Hellos are not sent – adjacencies not established • Applied on Ethernet stub network, dial-up lines, • routing domain (AS) boundaries Network connected to passive interface is normally advertised into routing protocol © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 23 Stub routing • Dynamic routing to (dual attached) branch office • • routers Aviods transit path via branch office (stub) router in case of core router failure Only routes from stub are propagated to backbone, but routes learned from first uplink are never reflected back to second uplink © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 24 Route Summarization (1) • • • Commonly recommended as a good practise Advantages • Fewer records in routing tables • Less bandwidth consumed by routing updates • Limits (hides) route flapping • Increases routing protocol stability Rules • Only router at boundary of the network which „owns“ all subnets of the summarized address range may summarize that range • otherwiise blackholing may occur • Need for hierarchical IP addressing plan • Some routing protocols allows for summarization only at specific routers (OSPF: ABR, ASBR) Keep in mind that routers still use the route with longest prefix match • Autosummarization – relates only to connected subnets © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 25 Route Summarization (2) • Behavior of routing protocols: routing protocols summarize by default at major • Some networks' boundaries • In some of them, it is possible to turn it off (RIPv2, BGP), in others not (RIP) © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 26 • • Policy routing Kind of extension of static routing Route decision based on SOURCE (instead of destination) address or incoming interface of routed packet • may also depend on destination address and other parameters • • Entry format: packet matching criteria => outgoing interface | next hop General format of route map entry: “match X set Y” • But apply only when outgoing interface is up • Defined statically by “route maps” on particular router(s) • Route maps have higher priority than routing tables • • • otherwise, routing table is used normally to determine next hop Examples: • • Two parallel links, traffic sourced from one subnet not allowed to pass the faster link (because of political reasons) Two links to different ISPs; some internal subnets communicate with Internet via ISP1, others via ISP2 May cause packets to be routed by CPU © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 27 Labs Load balancing: RIP, OSPF (few notes about ISIS) Floating static routes RIP-OSPF redistribution (two-way at single router) AD of routing protocols RIP-RIP circular redistribution, RIP-OSPF circular redistribution (harmless) OSPF-OSPF redistribution Policy routing: debug ip policy, sh route map © 2005 Petr Grygarek, VSB-TU Ostrava, Routed and Switched Networks 28