{"id":196,"date":"2023-11-29T23:06:52","date_gmt":"2023-11-29T22:06:52","guid":{"rendered":"https:\/\/mokrane-assam.com\/?p=196"},"modified":"2026-11-29T23:12:39","modified_gmt":"2026-11-29T22:12:39","slug":"redistribution-ospf-and-bgp-external-lsas-metrics-and-loops","status":"publish","type":"post","link":"https:\/\/mokrane-assam.com\/index.php\/2023\/11\/29\/redistribution-ospf-and-bgp-external-lsas-metrics-and-loops\/","title":{"rendered":"Redistribution OSPF and BGP: External LSAs, Metrics, and Loops"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Redistribution between OSPF and BGP is where the enterprise meets the internet: an IGP that knows the inside, a path-vector protocol that knows the outside, and a boundary router that must translate between them without starting a routing loop. This walk-through goes from why you redistribute to external LSA metric types, seed metrics, and the tag-based defense that keeps mutual redistribution from eating itself.<\/p><h2 class=\"wp-block-heading\">1. Why redistribute OSPF and BGP at all<\/h2><p class=\"wp-block-paragraph\">OSPF carries your internal topology; BGP carries reachability to and from other autonomous systems. At the <strong>edge<\/strong> \u2014 a dual-homed enterprise, a provider PE \u2014 one router sits in both worlds and must move selected routes across. You redistribute OSPF into BGP so the outside can reach your networks, and BGP into OSPF so the inside can reach external destinations. The art is moving <em>only what should move<\/em>, in one controlled direction where possible.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 200\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"Why redistribute OSPF and BGP\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"200\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">Why redistribute OSPF and BGP<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"95\" width=\"230\" height=\"70\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"175\" y=\"125\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"13\" font-weight=\"700\">OSPF domain<\/text><text x=\"175\" y=\"146\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">internal topology<\/text><rect x=\"360\" y=\"95\" width=\"200\" height=\"70\" rx=\"10\" fill=\"#0f172a\"\/><text x=\"460\" y=\"125\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"12\" font-weight=\"700\">ASBR \/ edge<\/text><text x=\"460\" y=\"146\" text-anchor=\"middle\" fill=\"#94a3b8\" font-size=\"10\">redistributes both ways<\/text><rect x=\"630\" y=\"95\" width=\"230\" height=\"70\" rx=\"10\" fill=\"#dcfce7\" stroke=\"#166534\"\/><text x=\"745\" y=\"125\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"13\" font-weight=\"700\">BGP \/ internet<\/text><text x=\"745\" y=\"146\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">external reachability<\/text><line x1=\"290\" y1=\"130\" x2=\"360\" y2=\"130\" stroke=\"#0A66C2\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><line x1=\"560\" y1=\"130\" x2=\"630\" y2=\"130\" stroke=\"#166534\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><\/svg><\/figure><h2 class=\"wp-block-heading\">2. The two directions are not symmetric<\/h2><p class=\"wp-block-paragraph\">Each direction has its own rules. <strong>OSPF into BGP<\/strong>: by default only <em>internal<\/em> OSPF routes are taken; external OSPF routes need an explicit <code>match external<\/code>. <strong>BGP into OSPF<\/strong>: only <strong>eBGP<\/strong> routes are redistributed by default \u2014 iBGP routes are held back unless you enable <code>bgp redistribute-internal<\/code>, a safety valve that exists precisely because redistributing iBGP carelessly is a classic way to build a loop.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 210\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"OSPF->BGP vs BGP->OSPF&#8221;><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"210\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">OSPF->BGP vs BGP->OSPF<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"90\" width=\"360\" height=\"90\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"240\" y=\"118\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"13\" font-weight=\"700\">OSPF -> BGP<\/text><text x=\"240\" y=\"142\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">internal OSPF taken by default<\/text><text x=\"240\" y=\"162\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">external needs match external<\/text><rect x=\"500\" y=\"90\" width=\"360\" height=\"90\" rx=\"10\" fill=\"#dcfce7\" stroke=\"#166534\"\/><text x=\"680\" y=\"118\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"13\" font-weight=\"700\">BGP -> OSPF<\/text><text x=\"680\" y=\"142\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"11\">eBGP routes by default<\/text><text x=\"680\" y=\"162\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"11\">iBGP needs redistribute-internal<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">3. BGP into OSPF becomes a Type 5 External LSA<\/h2><p class=\"wp-block-paragraph\">When BGP routes enter OSPF, they are not ordinary intra-area routes \u2014 they arrive as <strong>Type 5 External LSAs<\/strong>, flooded across the whole OSPF domain (outside stub areas), originated by the <strong>ASBR<\/strong>. Every router then sees them as <strong>O E1<\/strong> or <strong>O E2<\/strong> routes. Recognising that redistributed routes are externals is the key to reading the routing table and to understanding the metric behaviour that follows.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 210\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"BGP into OSPF = Type 5 External LSA\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"210\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">BGP into OSPF = Type 5 External LSA<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"360\" y=\"86\" width=\"200\" height=\"50\" rx=\"10\" fill=\"#0f172a\"\/><text x=\"460\" y=\"106\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"12\" font-weight=\"700\">ASBR<\/text><text x=\"460\" y=\"124\" text-anchor=\"middle\" fill=\"#94a3b8\" font-size=\"10\">originates Type 5 LSA<\/text><rect x=\"120\" y=\"170\" width=\"180\" height=\"46\" rx=\"10\" fill=\"#fff\" stroke=\"#0A66C2\"\/><text x=\"210\" y=\"198\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"11.5\">router sees O E2<\/text><rect x=\"370\" y=\"170\" width=\"180\" height=\"46\" rx=\"10\" fill=\"#fff\" stroke=\"#0A66C2\"\/><text x=\"460\" y=\"198\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"11.5\">router sees O E2<\/text><rect x=\"620\" y=\"170\" width=\"180\" height=\"46\" rx=\"10\" fill=\"#fff\" stroke=\"#0A66C2\"\/><text x=\"710\" y=\"198\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"11.5\">router sees O E2<\/text><line x1=\"420\" y1=\"136\" x2=\"220\" y2=\"170\" stroke=\"#166534\" stroke-width=\"2\"\/><line x1=\"460\" y1=\"136\" x2=\"460\" y2=\"170\" stroke=\"#166534\" stroke-width=\"2\"\/><line x1=\"500\" y1=\"136\" x2=\"700\" y2=\"170\" stroke=\"#166534\" stroke-width=\"2\"\/><text x=\"460\" y=\"156\" text-anchor=\"middle\" fill=\"#64748b\" font-size=\"10.5\">flooded domain-wide (except stub areas)<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">4. E1 vs E2 \u2014 the metric type that trips everyone<\/h2><p class=\"wp-block-paragraph\">External OSPF routes carry a metric <strong>type<\/strong>. <strong>E2<\/strong> (the default) keeps the <em>external<\/em> metric constant everywhere in the domain \u2014 the internal cost to reach the ASBR is ignored, so all routers see the same metric and pick the ASBR by lowest internal cost only as a tiebreak. <strong>E1<\/strong> adds the internal cost to the external metric, so the total grows with distance to the ASBR. Use E1 when you have multiple ASBRs and want routers to prefer the nearest one.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 220\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"OSPF external metric types E1 vs E2\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"220\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">OSPF external metric types E1 vs E2<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"90\" width=\"360\" height=\"92\" rx=\"10\" fill=\"#fff\" stroke=\"#f59e0b\"\/><text x=\"240\" y=\"118\" text-anchor=\"middle\" fill=\"#9a3412\" font-size=\"13\" font-weight=\"700\">E2 (default)<\/text><text x=\"240\" y=\"142\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">metric = external only (constant)<\/text><text x=\"240\" y=\"162\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">internal cost ignored<\/text><rect x=\"500\" y=\"90\" width=\"360\" height=\"92\" rx=\"10\" fill=\"#fff\" stroke=\"#166534\"\/><text x=\"680\" y=\"118\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"13\" font-weight=\"700\">E1<\/text><text x=\"680\" y=\"142\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">metric = external + internal cost<\/text><text x=\"680\" y=\"162\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">prefers the nearest ASBR<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">5. The seed metric \u2014 redistribution needs a starting cost<\/h2><p class=\"wp-block-paragraph\">Metrics do not translate across protocols: an OSPF cost means nothing to BGP&#8217;s MED, and a BGP path means nothing to OSPF&#8217;s cost. So redistribution assigns a <strong>seed metric<\/strong> \u2014 the metric the route starts with in the new protocol. Into OSPF you set the external cost (and E1\/E2 type); into BGP the IGP metric can become the <strong>MED<\/strong>. Leave it unset and you may get a protocol default that is either unreachable or wildly wrong, so always set it deliberately.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 200\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"Seed metric\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"200\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">Seed metric<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"80\" y=\"95\" width=\"300\" height=\"70\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"230\" y=\"124\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">into OSPF<\/text><text x=\"230\" y=\"146\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">set external cost + E1\/E2<\/text><rect x=\"540\" y=\"95\" width=\"300\" height=\"70\" rx=\"10\" fill=\"#dcfce7\" stroke=\"#166534\"\/><text x=\"690\" y=\"124\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"12\" font-weight=\"700\">into BGP<\/text><text x=\"690\" y=\"146\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">IGP metric -> MED (optional)<\/text><text x=\"460\" y=\"135\" text-anchor=\"middle\" fill=\"#64748b\" font-size=\"20\">seed<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">6. Admin distance decides who wins a tie<\/h2><p class=\"wp-block-paragraph\">When the same prefix is learned by more than one protocol, the router installs the one with the lowest <strong>administrative distance<\/strong>. The relevant values here: <strong>eBGP 20<\/strong>, <strong>OSPF 110<\/strong>, <strong>iBGP 200<\/strong>. That eBGP (20) beats OSPF (110) is exactly what makes mutual redistribution dangerous \u2014 a route you sent out via BGP can come back and be preferred over the original OSPF route, silently. Knowing the AD order is how you predict, and prevent, that.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 190\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"Administrative distance\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"190\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">Administrative distance<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"100\" width=\"240\" height=\"56\" rx=\"10\" fill=\"#dcfce7\" stroke=\"#166534\"\/><text x=\"180\" y=\"125\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">eBGP<\/text><text x=\"180\" y=\"145\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">AD 20<\/text><rect x=\"330\" y=\"100\" width=\"240\" height=\"56\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"450\" y=\"125\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">OSPF<\/text><text x=\"450\" y=\"145\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">AD 110<\/text><rect x=\"600\" y=\"100\" width=\"240\" height=\"56\" rx=\"10\" fill=\"#fef2f2\" stroke=\"#C8102E\"\/><text x=\"720\" y=\"125\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">iBGP<\/text><text x=\"720\" y=\"145\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"11\">AD 200<\/text><text x=\"460\" y=\"178\" text-anchor=\"middle\" fill=\"#64748b\" font-size=\"11\">Lowest AD wins \u2014 eBGP (20) beats OSPF (110), the root of feedback loops<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">7. Mutual redistribution and the feedback loop<\/h2><p class=\"wp-block-paragraph\">Redistribute both ways at two or more boundary routers and you create a path for a route to leave OSPF, traverse BGP, and re-enter OSPF at another ASBR with a <em>better<\/em> administrative distance \u2014 so the router believes the external copy and a loop or black hole forms. This is the single most important failure mode of two-way redistribution, and it is entirely predictable from the AD values above.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 220\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"The mutual-redistribution loop\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"220\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">The mutual-redistribution loop<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"80\" y=\"95\" width=\"180\" height=\"56\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"170\" y=\"127\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"600\">ASBR 1<\/text><rect x=\"660\" y=\"95\" width=\"180\" height=\"56\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"750\" y=\"127\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"600\">ASBR 2<\/text><line x1=\"260\" y1=\"110\" x2=\"660\" y2=\"110\" stroke=\"#166534\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><text x=\"460\" y=\"102\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"10.5\">OSPF route -> BGP<\/text><line x1=\"660\" y1=\"140\" x2=\"260\" y2=\"140\" stroke=\"#C8102E\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><text x=\"460\" y=\"158\" text-anchor=\"middle\" fill=\"#C8102E\" font-size=\"10.5\">comes back via BGP (AD 20) and wins<\/text><text x=\"460\" y=\"192\" text-anchor=\"middle\" fill=\"#9f1239\" font-size=\"11\" font-weight=\"600\">The re-learned external route beats the original -> loop \/ black hole<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">8. Route tags \u2014 the standard defense<\/h2><p class=\"wp-block-paragraph\">The clean fix is <strong>route tagging<\/strong>. When a route is redistributed from OSPF into BGP, tag it; at every boundary that redistributes <em>back<\/em> into OSPF, <strong>deny any route carrying that tag<\/strong>. The route can never return to the protocol it came from, so the loop cannot close. Tags are protocol-neutral 32-bit values that survive redistribution, which is exactly why they are the textbook mechanism \u2014 pair them with prefix filtering and one-way redistribution wherever the design allows.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 200\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"Route tags break the loop\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"200\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">Route tags break the loop<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"95\" width=\"230\" height=\"70\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"175\" y=\"124\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">OSPF -> BGP<\/text><text x=\"175\" y=\"146\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">tag = 100<\/text><rect x=\"360\" y=\"95\" width=\"200\" height=\"70\" rx=\"10\" fill=\"#0f172a\"\/><text x=\"460\" y=\"124\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"12\" font-weight=\"700\">BGP -> OSPF<\/text><text x=\"460\" y=\"146\" text-anchor=\"middle\" fill=\"#fca5a5\" font-size=\"10\">deny tag 100<\/text><rect x=\"630\" y=\"95\" width=\"230\" height=\"70\" rx=\"10\" fill=\"#dcfce7\" stroke=\"#166534\"\/><text x=\"745\" y=\"124\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"12\" font-weight=\"700\">loop broken<\/text><text x=\"745\" y=\"146\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">route cannot return<\/text><line x1=\"290\" y1=\"130\" x2=\"360\" y2=\"130\" stroke=\"#0A66C2\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><line x1=\"560\" y1=\"130\" x2=\"630\" y2=\"130\" stroke=\"#166534\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><\/svg><\/figure><h2 class=\"wp-block-heading\">Takeaways<\/h2><p class=\"wp-block-paragraph\">OSPF-BGP redistribution is two asymmetric directions, external LSAs with an E1\/E2 metric type, a mandatory seed metric, and an administrative-distance order (eBGP 20 &lt; OSPF 110) that makes two-way redistribution loop-prone by default. Tag on the way out, deny the tag on the way back, filter to exactly the prefixes intended, and redistribute one-way wherever you can \u2014 and the edge stays stable.<\/p>","protected":false},"excerpt":{"rendered":"<p>Redistribution between OSPF and BGP is where the enterprise meets the internet: an IGP that knows the inside, a path-vector protocol that knows the outside, and a boundary router that must translate between them without starting a routing loop. This walk-through goes from why you redistribute to external LSA metric types, seed metrics, and the<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"https:\/\/mokrane-assam.com\/index.php\/2023\/11\/29\/redistribution-ospf-and-bgp-external-lsas-metrics-and-loops\/\" class=\"home-blog-btn\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-196","post","type-post","status-publish","format-standard","hentry","category-basic"],"_links":{"self":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/comments?post=196"}],"version-history":[{"count":1,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/196\/revisions"}],"predecessor-version":[{"id":197,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/196\/revisions\/197"}],"wp:attachment":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/media?parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/categories?post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/tags?post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}