Salta al contenuto
Note per Studenti Internet Routing Protocols - RIP, OSPF and BGP Report

Internet Routing Protocols - RIP, OSPF and BGP

In questa pagina 5
In questa pagina 5

Algorithms (Routing Algorithms - Link State and Distance VectorRouting finds least-cost paths in a weighted graph where routers are nodes and networks between routers are edges. Link state floods each router's local links (LSPs) so every router knows the whole graph and runs Dijkstra; distance vector has each router exchange its distance vector with neighbours only and update it with Bellman-Ford, D(A,w)=min(D(A,w), D(A,Y)+d(Y,w)), which converges in at most n-1 rounds but suffers from count to infinity (limited infinity of 16, hold down, triggered updates, split horizon, poison reverse); path vector announces whole paths, chooses by policy and detects loops by finding itself in the path.Routing Algorithms - Link State and Distance Vector →) say how to compute routes; a routing protocol implements an algorithm and defines the packets routers exchange. How the resulting tables are used: Forwarding and Routing TablesForwarding moves each packet one hop at a time toward its destination; it is direct when the destination is on a local network (ARP gives its MAC) and indirect otherwise (the packet goes to the next hop or default gateway given by the routing table). With netmasks, delivery is direct on interface x if the destination AND the mask equals the interface address AND the mask; otherwise the table is scanned from the longest mask (longest prefix match) and the default route 0.0.0.0/0 always matches; route aggregation shortens tables.Forwarding and Routing Tables →.

Hierarchical routing and autonomous systems

One protocol cannot serve the whole Internet, for two reasons: scalability (tables would be too large, so border gateways partition the routers hierarchically) and administrative autonomy (an ISP wants to manage its own routers and not carry traffic that does not concern its users).

Definition (autonomous system, AS). A set of interconnected routers that all run the same routing algorithm (chosen by the AS) and use a standard protocol to connect to routers of other ASes. Two protocol levels: IGP (Interior Gateway Protocol, intra-AS) and EGP (Exterior Gateway Protocol, inter-AS).

Each AS has a unique AS number (16 bits, extended to 32 bits from 2006; 64 512-65 534 are private), assigned by IANA through the Regional Internet Registries. Interior gateways (IG) run the AS's own algorithm; border gateways (BG) connect different ASes and tell the IGs which addresses are reachable through them. Example: for hosts h1h_1 (AS AA) and h2h_2 (AS BB), the packet uses the intra-AS protocol of AA to the border router, the inter-AS protocol between AA and BB, and the intra-AS protocol of BB.

level protocol algorithm
IGP RIP distance vector
IGP IGRP distance vector
IGP OSPF link state
IGP IS-IS link state
EGP BGP (eBGP and iBGP) path vector

RIP

Definition. IGP (RFC 1058), distance vector (Bellman-Ford), metric = hop count, maximum cost 15 (16 is infinity), updates periodic (about every 30 s) plus asynchronous (on topology change). Messages are RIP packets in UDP datagrams, port 520 (UDP - User Datagram ProtocolUDP is the connectionless, unreliable transport protocol that adds to IP only process-to-process communication through ports and an optional checksum; its header is 8 bytes (source port, destination port, length, checksum), the checksum covers a pseudo-header (IP addresses, protocol 17, length), the UDP header and the data as a one's complement sum (0 means not computed and a computed 0 is sent as 0xFFFF), and UDP has no connection setup, sequence numbers, flow, error or congestion control, which makes it suitable for short messages (DNS, DHCP, RIP, SNMP) and real-time applications.UDP - User Datagram Protocol →).

The table has three columns: destination network, next router, cost in hops.

Update example. R1R_1 has N1N_1 (direct, 1) and N2N_2 via R2R_2 (3), and receives from R2R_2: N2N_2 at 1 hop, N3N_3 at 2, N4N_4 at 15. Adding 1 for the hop to R2R_2 and applying Bellman-Ford: N2=min⁡{3,1+1}=2N_2=\min\{3,1+1\}=2 via R2R_2 (improves); N3=min⁡{∞,2+1}=3N_3=\min\{\infty,2+1\}=3 via R2R_2; N4=15+1=16=∞N_4=15+1=16=\infty: unreachable, discarded. N1N_1 unchanged (directly connected).

Next-hop rule. If the announcement comes from the router that is already the next hop of a row, R1R_1 updates the cost even if it gets worse (if R2R_2 now says N2=5N_2=5, the cost is 5+1=65+1=6). Announcements from other routers must beat the current cost.

RIP v2 adds route tag and next hop in the message, authentication, classless routing (subnet mask in the message) and multicast (224.0.0.9224.0.0.9).

Timers.

  • Periodic: random in [25,35][25,35] s (mean 30 s), to avoid all routers sending at the same time.
  • Expiration: 180 s without update, the route expires and its cost becomes 16.
  • Garbage collection: the row is deleted 120 s after expiration (neighbours learn the route is invalid first). Last update at t=0t=0: expires at 180180 s, deleted at 300300 s.

RIP counters count to infinity with limited infinity (16), split horizon, poison reverse, hold down and triggered updates.

OSPF

Definition. IGP for large ASes (RFC 1247, 1583). Link state, hierarchical, uses HELLO, each router has a unique identifier, routers exchange Link State Advertisements (LSA). Each link can have a weight chosen from different metrics (throughput, hops, delay), possibly per type of service. Messages are encapsulated directly in IP (no UDP or TCP).

Each router runs Dijkstra to obtain its tree of shortest paths and builds its table. With hop count as cost, OSPF and RIP tables in the same AS are identical.

Areas. Flooding LSPs in a large AS would produce heavy control traffic, so the AS is divided into areas (sets of connected networks, hosts and routers). All areas must be connected to area 0 (the backbone). Flooding is confined to each area: with nn routers and mm links a complete flooding round costs about n⋅mn\cdot m messages; an AS with n=60n=60, m=120m=120 split into 6 areas of 10 routers and 20 links costs about 10⋅20=20010\cdot20=200 per area instead of 60⋅120=720060\cdot120=7200. Area Border Routers (ABR) summarise their area's topology to the others through the backbone.

Five LSA types.

  • Type 1, router link: announces a router in the area, with its links (transient, stub, point-to-point). Stays inside the area.
  • Type 2, network link: announces a network, on behalf of which an elected Designated Router (DR) speaks (a network is passive); lists the routers on it.
  • Type 3, summary link to network: sent by an ABR to announce the networks of an area to the other areas via the backbone.
  • Type 4, summary link to AS: announces the location of an ASBR (AS Boundary Router, directly connected to another AS).
  • Type 5, external link: sent by an ASBR to announce a network outside the AS (type 4 is still needed to locate the ASBR).
type generated by spread in purpose
1 every OSPF router same area links of the router
2 DR on multi-access networks same area routers on the network
3 ABR other areas networks of other areas
4 ABR other areas where the ASBR is
5 ASBR whole OSPF domain external routes

BGP

Routers know their own AS's networks but not other ASes'. BGP version 4 is the only inter-domain routing protocol in use; it is a path vector protocol that provides reachability information.

  • Every border router (ASBR) runs eBGP to obtain reachability from neighbour ASes.
  • Every router in each AS runs iBGP, used by the ASBRs to spread reachability information to all routers of the same AS.
  • Routes are chosen according to reachability and policy.

Each update carries the path vector, the whole path of ASes. A router receiving a route checks whether its own AS is already in the path: if yes, the route is rejected (loop-free, no count to infinity); if no, it compares the cost with the current one and, if better, adds itself and (possibly) re-announces.

eBGP. Two BGP peers (speakers) in adjacent ASes open a TCP connection on well-known port 179 and exchange information on their ASes' networks. Example: a message from border router R1R_1 tells R5R_5 that N1,…,N4N_1,\dots,N_4 are reachable through R1R_1.

iBGP. Creates TCP sessions (port 179) between every pair of routers inside an AS, even non-adjacent. Using an IGP (OSPF, RIP) to spread external routes is strongly discouraged because of the huge number of routes.

Route selection policies (not a shortest-path tree): local preference (administrator prefers some routes), shortest AS-PATH, origin of the path (IGP, BGP, unknown), link dynamics.

Example. For network NN a router receives AS3 AS2 AS1\text{AS}_3\,\text{AS}_2\,\text{AS}_1 (3 ASes) and AS4 AS1\text{AS}_4\,\text{AS}_1 (2 ASes). With equal local preference the second wins; if the first has higher local preference, it wins despite being longer. A route AS5 AS1 AS6\text{AS}_5\,\text{AS}_1\,\text{AS}_6 received in AS1\text{AS}_1 contains the own AS and is discarded.

BGP messages.

message purpose
Open opens a neighbour relationship over TCP; specifies a hold timer (interval between keepalives or updates, 0 = no keepalive)
Keepalive sent periodically to confirm connectivity
Notification signals an error
Update withdraws previously announced destinations, announces a route to a new destination, or both

Comparison

RIP OSPF BGP
traffic local updates to neighbours only, little traffic complex messages, can use much bandwidth many messages, much traffic
convergence slow, loops and count to infinity fast (after Dijkstra completes) no loops, no count to infinity
robustness not robust: a fault or corrupted data in one router spreads to all robust: routers are independent not robust: faults spread as in RIP

Versione ripasso

Algorithms: Routing Algorithms - Link State and Distance VectorRouting finds least-cost paths in a weighted graph where routers are nodes and networks between routers are edges. Link state floods each router's local links (LSPs) so every router knows the whole graph and runs Dijkstra; distance vector has each router exchange its distance vector with neighbours only and update it with Bellman-Ford, D(A,w)=min(D(A,w), D(A,Y)+d(Y,w)), which converges in at most n-1 rounds but suffers from count to infinity (limited infinity of 16, hold down, triggered updates, split horizon, poison reverse); path vector announces whole paths, chooses by policy and detects loops by finding itself in the path.Routing Algorithms - Link State and Distance Vector →; use of tables: Forwarding and Routing TablesForwarding moves each packet one hop at a time toward its destination; it is direct when the destination is on a local network (ARP gives its MAC) and indirect otherwise (the packet goes to the next hop or default gateway given by the routing table). With netmasks, delivery is direct on interface x if the destination AND the mask equals the interface address AND the mask; otherwise the table is scanned from the longest mask (longest prefix match) and the default route 0.0.0.0/0 always matches; route aggregation shortens tables.Forwarding and Routing Tables →.

Hierarchy

  • Needed for scalability and administrative autonomy. AS = routers under one administration with one algorithm. IGP inside an AS (RIP, OSPF, IGRP, IS-IS), EGP between ASes (BGP). AS numbers are 32 bits (since 2006). Border gateways announce reachable addresses to interior gateways.

RIP

OSPF

  • Link state, large ASes, Dijkstra, LSAs carried directly in IP, per-link weights. Areas connected to area 0 (backbone) confine flooding (60 routers and 120 links: 7200 versus 6⋅2006\cdot200 messages); ABRs summarise areas.
  • LSA types: 1 router link (area), 2 network link (DR, area), 3 summary to network (ABR), 4 summary to ASBR (ABR), 5 external (ASBR).

BGP

  • BGP4: path vector, reachability and policy, TCP port 179. eBGP between border routers of adjacent ASes; iBGP between all routers inside an AS (an IGP is discouraged for external routes).
  • Path contains own AS ⇒\Rightarrow discard: no loops, no count to infinity.
  • Policies: local preference, shortest AS-PATH, origin. AS3AS2AS1\text{AS}_3\text{AS}_2\text{AS}_1 versus AS4AS1\text{AS}_4\text{AS}_1: the second wins unless local preference says otherwise.
  • Messages: Open (hold timer), Keepalive, Notification, Update (withdraw and/or announce).

Comparison

  • RIP: little traffic, slow convergence, not robust. OSPF: heavy messages, fast convergence, robust. BGP: heavy traffic, loop-free, not robust.
  • Typical errors: mixing up ports (RIP UDP 520, BGP TCP 179, OSPF over IP directly); forgetting that 16 means unreachable in RIP.

Teoria collegata