Computer Network-Network Layer 3

Routing algorithm



Routing algorithm classification

  • Static routing:

    • Manual configuration
    • Slow routing update
    • High priority
  • Dynamic routing:

    • Fast routing update
    • Regular updates
    • Respond in time to link costs or network topology changes
  • Global information:

    • All routers have complete network topology and link cost information
    • Eg Link State (LS) routing algorithm
  • Decentralized information:

    • The router only grasps the physically connected neighbors and the link cost
    • Iterative process of information exchange and operation between neighbors
    • Eg distance vector (DV) routing algorithm

Link state routing algorithm

Dijkstra algorithm

  • All nodes (routers) master the network topology and link costs
    • Via "link state broadcast"
    • All nodes have the same information
  • Calculate the shortest path from one node ("source") to all other nodes
    • Get the forwarding table for this node
  • Iteration: After k iterations, get the shortest path to k destination nodes

symbol:

  • c (x, y): link cost from node x to node y; if x and y are not directly connected, then = ∞
  • D (v): current path cost value from source to destination v
  • p (v): along the current path from the source to v, the predecessor node of v
  • N ': the set of nodes that have found the least cost path



Dijkstra algorithm: discussion

  • Algorithm complexity: n nodes
    • Each iteration: need to detect all nodes w that are not in the set N '
    • n (n + 1) / 2 comparisons: O (n 2)
    • More efficient implementation: O (nlogn)
  • There may be oscillations:
    • eg, assuming the link cost is the traffic carried by the link:

Distance vector routing algorithm



Key point: the node gets the next hop of the shortest path, this information is used in the forwarding table

  • Asynchronous iteration:
    • Factors that trigger each local iteration
    • Local link cost change
    • DV updates from neighbors
  • distributed:
    • Each node is only notified to neighbors when the DV changes
    • Neighbors notify their neighbors when necessary (when their DV is updated)


Link cost changes:

  • Node detection local link cost change
  • Update routing information and recalculate distance vector
  • If DV changes, notify all neighbors
    • t 0: y detects the link cost change, updates DV, and advertises its neighbors.
    • t 1: z receives the DV update of y, updates its distance vector table, calculates the latest minimum cost to reach x, updates its DV, and sends it to all its neighbors.
    • t 2: y receives the DV update of z, updates its distance vector table, recalculates the DV of y,, no change, and no longer sends DV to z.

Good news spreads fast!

Poisoned reverse

  • If the least-cost path from a node (eg Z) to a destination (egX) is through a neighbor (egY), then:
  • Inform the neighbor node that the distance to the destination is infinite

Infinite counting problem

Hierarchical routing

Abstract a network of any size into a graph to calculate routing-too ideal

  • Identify all routers
  • "Flat" network
  • In actual networks (especially large-scale networks), it is not feasible!
    Network scale: Consider a network of 600 million destination nodes
  • The routing table can hardly be stored!
  • The amount of information exchanged during the route calculation process (eg link state grouping, DV) is huge and will overwhelm the link!
  • Management autonomy:
    • The management of each network may wish to autonomously control the routing within its network
    • Internet (internet) = network of networks (network of networks)

An aggregation router is an area: autonomous systems (autonomous systems), routers in the same AS run the same routing protocol (algorithm), and routing protocols in the autonomous system (“intra-AS” routing protocol)
. Routers in different autonomous systems can run differently. AS internal routing protocol

Gateway router (gatewayrouter): Located at the "edge" of the AS, a gateway router that connects to other ASs through links

Interconnected AS

Inter-AS



Introduction to RIP protocol

AS internal routing




RIP: link failure, recovery

If no notification is received within 180 seconds → Neighbor / link failure

  • Route through this neighbor is not available
  • Recalculate route
  • Send new announcements to neighbors
  • Neighbors send out announcements in turn (if the forwarding table changes)
  • Can the link failure information be quickly propagated to the entire network?
  • Infinite counting problems may occur
  • Toxic reversal technique is used to prevent ping-pong loop (otherwise: infinite distance = 16 hops)

RIP routing table processing

  • The RIP routing table is managed using an application layer process called route-d (daemon)
    • Application process implementation
    • Announcement messages are sent periodically via UDP datagrams

Introduction to OSPF protocol

  • "Open": publicly available
  • Using link state routing algorithm
  • LS packet diffusion (Announcement)
  • Each router constructs a complete network (AS) topology
  • Using Dijkstra algorithm to calculate routing
  • Each entry in OSPF advertisement corresponds to a neighbor
  • OSPF announcement floods the entire AS
  • OSPF packets are directly encapsulated into IP datagrams
  • A routing protocol very similar to OSPF: IS-IS routing protocol

OSPF advantages (not available in RIP)

  • Security: All OSPF messages can be authenticated (prevent malicious intrusion)
  • Multiple paths with the same cost are allowed (RIP can only choose one)
  • For each link, multiple different cost metrics can be set for different TOS (eg, satellite links can set "low" cost for "best effort" ToS; set "high" cost for real-time ToS)
  • Integrated unicast routing and multicast routing
  • Multicast OSPF protocol (MOSPF) uses the same network topology data as OSPF
  • OSPF supports hierarchical large-scale AS

Layered OSPF


Introduction to BGP

Internet AS-to-AS routing protocol

  • Border Gateway Protocol (BGP): the de facto standard inter-domain routing protocol

    • The key to "gluing" the Internet as a whole
  • BGP provides a means for each AS:

    • eBGP: Obtain subnet reachability information from neighbor AS.
    • iBGP: Propagate subnet reachability information to all AS internal routers.
    • Based on reachability information and strategies, determine the "good" path to other networks
  • Allow the subnet to announce its existence to the rest of the Internet: "I am here!"

  • BGP session (session):

    • Two BGP routers ("Peers")
  • Exchange BGP packets:

    • Advertise paths to different destination prefixes ("path vector" protocol)
    • Message exchange is based on a semi-permanent TCP connection
  • BGP message:

    • OPEN: establish a TCP connection with the peer and authenticate the sender
    • UPDATE: announce new path (or cancel original path)
    • KEEPALIVE: keep the connection alive when there is no UPDATE; also used to confirm the OPEN request
    • NOTIFICATION: Report errors in previous messages; also used to close the connection


BGP routing

  • After receiving the route advertisement, the gateway router uses its import policy to decide to accept / reject the route
    • eg, never route traffic to AS x
    • Policy-based routing
  • The router may learn multiple routes to a destination AS, and choose based on the following criteria:
  1. Local preference value attribute: policy
    decision
  2. Shortest AS-PATH
  3. Recent NEXT-HOP routers: hot potato
    routing
  4. Additional guidelines

Why use different intra-AS and inter-AS routing protocols

  • Policy:
    • inter-AS: Expect to be able to manage and control how traffic is routed, who routes through its network, etc.
    • intra-AS: single management, no strategic decision required
  • Scale:
    • Hierarchical routing saves routing table size and reduces routing update traffic
    • Adapt to large-scale Internet
  • Performance:
    • intra-AS: focus on performance
    • inter-AS: strategy-led

Guess you like

Origin www.cnblogs.com/ygjzs/p/12685241.html