Dynamic routing

Link-state routers share a map; distance-vector routers share directions

Distance vector: directions from neighboursR1R2 told me:10.5.0.0/16 is 3 hops awayso for me it is 4, via R2RIP, EIGRP: knows distance and direction onlyLink state: everyone holds the same mapOSPF, IS-IS: every router runs shortest path firstLink-state routers share a map and each computes its own best paths; distance-vector routers pass on directions.A distance-vector router believes its neighbours’ totals and adds its own hop, which is simple but slow to notice a dead end.A link-state router floods a description of its own links to every router in the area; all build the same map and runDijkstra’s algorithm on it. BGP, between organisations, is a path vector: it passes on the list of networks a route crossed.

Distance-vector protocols pass on distances; link-state protocols such as OSPF flood the topology and each router computes its own paths.

Dynamic routing · Going deeper

RIP, EIGRP, OSPF, IS-IS and BGP compared

ProtocolTypeMetricDistance (Cisco)WhereRIPv2distance vectorhop count, max 15120legacy, labsEIGRPadvanced distance vectorbandwidth and delay90 (external 170)Cisco networksOSPFlink statecost from bandwidth110enterprise standardIS-ISlink statecost115service providersBGPpath vectorpath attributes, policyeBGP 20 · iBGP 200between organisationsInterior protocols find the fastest path inside one organisation; BGP connects organisations by policy.An interior gateway protocol (IGP) runs inside one autonomous system: OSPF, EIGRP, IS-IS, RIP. BGP is the exterior gatewayprotocol (EGP) of the internet. Network+ asks you to tell them apart; CCNA asks you to configure OSPF. RIP’s limit of 15 hopsis why it never scaled: 16 means unreachable.

IGPs route inside an organisation; BGP routes between them. Each protocol has its own metric and administrative distance.

OSPF cost

OSPF follows the lowest total cost, and cost comes from bandwidth

10G · 1010G · 1010G · 1010G · 1010G · 101G · 100ABCDECost = reference bandwidth ÷ link bandwidth. With the reference set to 100 Gbps, a 10G link costs 10 and a 1G link 100.OSPF sends traffic along the lowest total cost. A to E: A–B–E costs 20, against 30 or more by any other way.Each router adds up the costs along every path on its map and keeps the cheapest. The default reference bandwidth is still100 Mbps, so every link of 100 Mbps or faster costs 1 and OSPF cannot tell 1G from 100G. Raise it on every router withauto-cost reference-bandwidth 100000, or set ip ospf cost on interfaces. Equal-cost paths are used together, up to 4 by default.

OSPF cost is reference bandwidth ÷ link bandwidth; A reaches E by A–B–E at cost 20.

Convergence

When a link fails, every router recomputes from the same new map

10G · 10✗ failed10G · 1010G · 1010G · 101G · 100ABCDELink B–E fails. B and E flood the change, every router reruns SPF, and A’s best path to E becomes A–D–C–E, cost 30.When a link fails, every router updates the same map and recomputes, so they all agree on the new paths.Detection is the slow part: on a broadcast link a neighbour is declared dead after 40 seconds without hellos (10-second hellos),unless the interface itself goes down first. Bidirectional Forwarding Detection (BFD) cuts that to under a second.Once detected, the flood and the SPF run take milliseconds.

When B–E fails the change is flooded, every router reruns SPF, and A’s path becomes A–D–C–E, cost 30.

Convergence · Going deeper · 1 of 2

Becoming neighbours: states and the hello checks

DownInit2-WayExStartExchangeLoadingFullhellos seen both waysDROTHERs stop hereswap database summaries, then the missing piecesTwo routers become neighbours only if their hellos agree on:✓area IDboth sides in the same area✓subnet and maskon the same network✓hello and dead timers10 and 40 s by default✓authenticationif configured✓stub flagarea type✓MTUor they stick in ExStartNeighbours climb from Down to Full; a mismatch in area, subnet, timers or MTU stops them on the way.show ip ospf neighbor lists each neighbour’s state; a router stuck in Init sees the other’s hellos but is not seen, and onestuck in ExStart or Exchange almost always has an MTU mismatch. The router ID must also be unique: it is set by router-id,else the highest loopback address, else the highest active interface address, and changes only after clear ip ospf process.

OSPF neighbours pass from Down to Full. Area, subnet, timers, authentication, stub flag and MTU must all match. The router ID must be unique.

Convergence · Going deeper · 2 of 2

The designated router on a shared segment

One Ethernet segment, 10.0.0.0/24R1priority 1 · ID 1.1.1.1DROTHERR2priority 100 · ID 2.2.2.2DRR3priority 1 · ID 3.3.3.3BDRR4priority 0 · ID 4.4.4.4neverHighest priority wins DR, the next BDR; ties go to the highest router ID; priority 0 never stands. R3 beats R1 on router ID.On a shared segment every router talks to a designated router instead of to each other, cutting n² adjacencies to n.Routers send to 224.0.0.6 to reach the DR and BDR; the DR repeats changes to 224.0.0.5, all OSPF routers. DROTHERs stay in2-Way with each other and go Full only with the DR and BDR. The election is not pre-emptive: a better router added laterwaits until the DR fails. Point-to-point links, set with ip ospf network point-to-point, elect no DR at all.

The highest OSPF priority, then the highest router ID, becomes DR; the next becomes BDR. Priority 0 never stands.

Administrative distance

When sources disagree, the most trusted one wins

administrative distance: lower is more trustedConnected0Static1eBGP20EIGRP90OSPF110IS-IS115RIP120iBGP200Unknown: never used255When two sources offer a route to the same prefix, the more trusted source, the lower distance, goes in the table.Distance is compared only between routes to exactly the same prefix; a longer prefix from a less trusted source still wins thelookup. A metric cannot be compared across protocols (OSPF cost and RIP hops mean different things), so distance settles it.These are Cisco’s values; other vendors use different numbers for the same idea.

Administrative distance ranks route sources: connected 0, static 1, EIGRP 90, OSPF 110, RIP 120. Lower wins for the same prefix.

BGP

The internet is joined by policy, between autonomous systems

AS 64496 · your companyAS 64497 · ISP AAS 64498 · ISP BAS 64499 · a cloudAS path 64497 64499AS path 64498 64510 64499BGP joins the internet’s autonomous systems and chooses routes by policy, starting with the shortest list of networks.Each AS is one organisation’s network with its own number. BGP neighbours exchange prefixes with the AS path they crossed; arouter refuses any path already containing its own AS, which prevents loops. Shortest AS path is only one rule: localpreference, origin and business agreements come first. The global table holds about a million IPv4 prefixes.

BGP exchanges prefixes between autonomous systems with the AS path each crossed; policy, then the shortest path, decides.

First-hop redundancy

Two routers share one gateway address, so hosts never notice a failure

R1 · active10.1.10.2 · priority 110R2 · standby10.1.10.3 · priority 100Virtual gateway 10.1.10.1MAC 0000.0c07.ac0a (group 10)every host’s gateway: 10.1.10.1if R1 fails, R2 takes over thevirtual address within 10 sTwo routers share one virtual gateway address, so hosts never notice when one of them fails.A host has one default gateway and cannot switch by itself. HSRP (Cisco) and VRRP (open standard) let routers answer for ashared virtual IP and MAC; the active router forwards and the standby listens to its hellos, every 3 seconds for HSRP, and takesover after 10 seconds of silence. Hosts’ ARP caches stay correct because the virtual MAC moves with the address.

HSRP and VRRP give two routers a shared virtual IP and MAC; the active one forwards, the standby takes over if it fails.

First-hop redundancy · Going deeper

HSRP, VRRP and GLBP compared

HSRP (Cisco)VRRP (IETF, RFC 5798)GLBP (Cisco)Rolesactive, standbymaster, backupAVG and AVFsVirtual MAC0000.0c07.acXX (v1)0000.5e00.01XXone per forwarderDefault priority100100 (owner of the IP: 255)100Pre-emptionoff by defaulton by defaultoff by defaultHello / hold3 s / 10 s1 s / about 3 s3 s / 10 sLoad sharingone active per groupone master per groupyes, across routersR1# show standby briefInterface   Grp  Pri P State    Active          Standby         Virtual IPVl10        10   110 P Active   local           10.1.10.3       10.1.10.1HSRP and VRRP do the same job with different names and defaults; read the state, priority and P for pre-emption.

HSRP is active/standby with pre-emption off by default; VRRP is master/backup with pre-emption on. show standby brief shows the state.

Lesson complete

You finished “Dynamic routing and OSPF”

Nicely done.

Open in a new tab