{"id":785,"date":"2021-08-20T03:11:24","date_gmt":"2021-08-20T03:11:24","guid":{"rendered":"http:\/\/feralpacket.org\/?p=785"},"modified":"2021-08-20T03:11:24","modified_gmt":"2021-08-20T03:11:24","slug":"bgp-notes","status":"publish","type":"post","link":"https:\/\/feralpacket.org\/?p=785","title":{"rendered":"BGP Notes"},"content":{"rendered":"<p><b>BGP &#8211; Border Gateway Protocol<\/b>:<\/p>\n<p>&#8211; Exterior Gateway Protocol<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Designed for expandability<br \/>\n&#8211; IGPs created for fast convergience<br \/>\n&#8211; BGP main feature<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Scalability<br \/>\n&#8211; BGP version 4 (1993)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Supports aggregation (supernetting)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Has been updated with many &#8220;capabilities&#8221; over the years<br \/>\n&#8211; TCP port 179<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; To form neighborship<br \/>\n&#8211; 4 message types<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Open<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Update<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Notification<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Keepalive<br \/>\n&#8211; BGP metric is Path Attribute<br \/>\n&#8211; Uses Autonomous System Number to identify an organization \/ administrative boundary<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/9f2942671248d11631304ced150ef069.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>&#8211; Path Vector Protocol<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; or &#8211;<br \/>\n&#8211; Distance Vector Protocol<br \/>\n&#8211; BGP compares the AS sequence and decides the best path<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Ordered list of organizations crossed<br \/>\n&#8211; Support MD5 authentication<br \/>\n&#8211; Supports aggregation (summarization) and default routing<br \/>\n&#8211; Summarization is the single biggest topic within BGP<br \/>\n&#8211; Supports advanced filtering with the help of Regular Expressions<br \/>\n&#8211; Two types of neighborship<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Internal<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; External<\/p>\n<p><b>Neighborship Formation<\/b><\/p>\n<p><b><\/b><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/96fe89a4e6e0ed24d9950f05cff02228.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>As soon as BGP gets activated, it sends an OPEN message<br \/>\n&#8211; Open message<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Version number<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; ASB<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Holddown time<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Default is 180 seconds<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Lower is better if there is a conflict between neighbor configurations<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Router-id<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Options<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; MD5 hash<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Capabilities list<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Any specific feature<\/p>\n<p><b>Finite State Machine (FSM)<\/b><br \/>\n1. IDLE<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; No TCP synchronize message sent or received<br \/>\n2. CONNECT<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP sync message sent<br \/>\n3. ACTIVE<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP is actively trying to synchronize<\/p>\n<p>Steps 1 &#8211; 3 are TCP based<\/p>\n<p>4. OPENSENT<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; BGP OPEN message is sent<br \/>\n5. OPENCONFIRM<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; BGP OPEN message is received and the local side agrees to the parameters<br \/>\n6. ESTABLISHED<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; BGP neighborship is up<\/p>\n<p>Step 4 &#8211; 6 are BGP based<\/p>\n<p><span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">sh tcp brief<\/span><\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; look for port 179<br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">sh ip bgp summary<\/span><\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; shows neighbor state<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; ESTABLISHED is not shown, a numerical value is shown instead<\/p>\n<p>R1(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.2 remotes-as 200<\/span><\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Destination &#8211; 12.0.0.2<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Source &#8211; 12.0.0.1<\/p>\n<p>R2(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 200<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.1 remotes-as 100<\/span><\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Destination &#8211; 12.0.0.1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Source &#8211; 12.0.0.2<\/p>\n<p>Neighbor IP address is the TCP Destination<br \/>\n&#8211; Local exit interface IP address is the TCP Source<br \/>\n&#8211; Source must match the other end&#8217;s neighbor configuration<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/0c8c8f1cd9850d29ebaf5b2fe46d1431.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>Assume the loopbacks of R1 and R2 are reachable from each other<\/p>\n<p>R1(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 2.2.2.2 remote-as 200<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 2.2.2.2 update-source lo0<\/span><\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Destination &#8211; 2.2.2.2<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Source &#8211; 1.1.1.1<\/p>\n<p>R2(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 200<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 1.1.1.1 remote-as 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 1.1.1.1 update-source lo0<\/span><\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Destination &#8211; 1.1.1.1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; TCP Source &#8211; 2.2.2.2<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/0baacaf6e3e472f8cb84c7e9f34dda94.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/29ecd34089e6d5da822f05c12396e587.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p><b>Multihop eBGP Neighborship<\/b><\/p>\n<p><b><\/b><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/0c3a0d939b821571a5d772c9e9b18eaf.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>R1(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 23.0.0.3 remote-as 200<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 23.0.0.3 ebgp-multihop 2<\/span><\/span><\/p>\n<p>R3(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 200<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.1 remote-as 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.1 ebgp-multihop 2<\/span><\/span><\/p>\n<p>eBGP checks to see if the neighbor is on a directly connected network<br \/>\n&#8211; If not, an OPEN message is never sent<\/p>\n<p><b>eBGP Neighbor over Loopback<\/b><\/p>\n<p><b><\/b><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/87ebe1d915e91ad5822652a0959366bf.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>Assume there is a router between R1 and R2<\/p>\n<p>R1(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 2.2.2.2 remote-as 200<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 2.2.2.2 update-source lo0<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 2.2.2.2 ebgp-multihop<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 2.2.2.2 disable-connect-check<\/span><\/span><\/p>\n<p>R2(config)# <span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 200<\/span><\/span><br \/>\nn<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">eighbor 1.1.1.1 remote-as 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 1.1.1.1 update-source lo0<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 1.1.1.1 ebgp-multihop<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 1.1.1.1 disable-connect-check<\/span><\/span><\/p>\n<p><b>BGP Authentication<\/b><\/p>\n<p><span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/span><br \/>\n<span style=\"-evernote-highlight:true;\"><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor &lt;IP address&gt; password &lt;password&gt;<\/span><\/span><\/p>\n<p><b>Changing Next-hop Processing<\/b><\/p>\n<p><b><\/b><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/a244e1c5e77c061aa999d7219ba33208.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>Next-hop should be changed to &#8220;self&#8221; on edge routers towards iBGP neighbors<\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><br \/>\n<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.1 remote-as 100<\/span><br \/>\n<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.1 next-hop-self<\/span><\/p>\n<p>To set it back to default<br \/>\n<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor &lt;IP address&gt; next-hop-unchanged<\/span><\/p>\n<p><b>Database Exchange<\/b><br \/>\n&#8211; UPDATE packets are used<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Network Layer Reachability Information (NLRI)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; network \/ subnet mask<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; PATH-Attribute<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; WITHDRAWN Routes<br \/>\n&#8211; When updates are received, the information is kept in the BGP table<\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">sh ip bgp<\/span><\/p>\n<p>To advertise or introduce networks into BGP<br \/>\n&#8211; &#8220;network&#8221; command<br \/>\n&#8211; redistribution<\/p>\n<p>The network command checks the routing table for the existence of the network<br \/>\n&#8211; If the network exists (by any means), it will be advertised by BGP<br \/>\n&#8211; If the network does not exist, BGP ignores the network command<\/p>\n<p><b>PATH ATTRIBUTES<\/b><br \/>\n&#8211; These are BGP parameters associated with every network received in the UPDATE packet<br \/>\n&#8211; Helps BGP to decide the best route<br \/>\n&#8211; Two types<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Well Known<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Mandatory<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; Every UPDATE packet must have the attribute<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; next-hop, origin, as-path<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Discretionary<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; Every BGP device recognizes the attribute, but it may or may not be present in the UPDATE packet<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; local-preference<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Optional<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Transitive<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; May not be recognized by the receiving router, but will be sent further<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; community<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Non-transitive<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; May not be recognized by the receiving router and will be dropped if not<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; MED (multi-exit descriminator)<\/p>\n<p><b>PATH ATTRIBUTES Preference \/ Priority \/ Whatever<\/b><\/p>\n<p>1. Next-hop reachability<br \/>\n2. Weight<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Cisco proprietary attribute<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Higher is better<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Default is 0 for received routes, -32768 for locally generated routes<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; This is only locally significant<br \/>\n3. Locally generated routes are preferred over remote routes<br \/>\n4. Local preference<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Open attribute (not Cisco proprietary)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Higher is better<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Default is 100 for every route<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Significant only in the local AS<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; 0 &#8211; 4294967295 (2^32)<br \/>\n5. AS_PATH<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; AS sequence<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; lower number of organizations traversed, the better the route is<br \/>\n6. Origin<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Internal<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt;Originated by &#8220;network&#8221; command<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; IGP<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; External<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; EGP<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; &#8220;The&#8221; Exterior Gateway Protocol<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Old<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Should never see<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Run to the proctor<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Incomplete<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; IGP &gt; EGP &gt; Incomplete<br \/>\n7. Multi-exit Discriminator (MED)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Also known as &#8220;metric&#8221; in Cisco<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; 32 bit variable<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; 0 &#8211; 4294967295<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Default is 0 for received routes<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Equal to the metric of IGP for redistributed routes<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Lower is better<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/7cc2e4baac4a7f3ee9210ae22ec4b960.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>8. Neighbor Type<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; eBGP &gt; iBGP<\/p>\n<p>9. IGP cost to reach next hop in case both are iBGP neighbors<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/b63e8849a704fc237a3d0f23a22ae0c6.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>10. Oldest eBGP neighbor is preferred if there are multiple<\/p>\n<p>11. If IGP cost is also the same, the lower router-id neighbor is preferred<\/p>\n<p><b>Manipulating PATH ATTRIBUTE for best path selection<\/b><br \/>\n&#8211; Outgoing update manipulation<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Suggests a preferred route to a neighbor<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Neighbor can ignore<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; AS-PATH, ORIGIN, MED<br \/>\n&#8211; Incoming update manipulation<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Changing local route \/ AS decision on the best route<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Weight, LOCAL_PREFERENCE, AS-PATH, ORIGIN<\/p>\n<p>Weight<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Locally significant<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; -&gt; Only affects local router&#8217;s decision<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/109969c4bb65f02c617509f9690bebe8.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>Scenario -&gt; Change the &#8220;weight&#8221; attribute so it always elects R2 as next-hop to reach 50.0.0.0.<\/p>\n<p>R1(config)# <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">access-list 1 permite 50.0.0.0<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map WEIGHT<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">match ip add 1<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">set weight 200<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map WEIGHT permit 10<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp;-&gt; The router-map permit statement is needed, otherwise all other routes are denied (dropped)<\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.2 remote-as 200<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 12.0.0.2 route-map WEIGHT in<\/span><\/p>\n<p>Soft BGP reset (TCP connection not reset)<\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">clear ip bgp * soft [ in | out ]<\/span><\/p>\n<p>Otherwise:<\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">clear ip bgp 12.0.0.2 [ in | out ]<\/span><\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">clear ip bgp *<\/span><\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">sh ip bgp<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; -&gt; shows BGP table<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; next-hop &nbsp; &nbsp;weight<\/p>\n<p>*&gt; 50.0.0.0 &nbsp; &nbsp; 12.0.0.2 &nbsp; &nbsp; 200<\/p>\n<p>* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;12.0.0.3<\/p>\n<p>* -&gt; valid<\/p>\n<p>&gt; -&gt; best<\/p>\n<p>i &#8211; iBGP<\/p>\n<p>path<\/p>\n<p>300,200,100,i<\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">sh ip bgp 50.0.0.0<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp;-&gt; shows more detail<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/c8dc83661742a7c06a6f988c6c2118b9.jpeg\" style=\"height: auto;\" width=\"\" height=\"\"><\/p>\n<p>Scenario -&gt; To reach R6 lo0 network, all routers of AS 100 must choose R1 as exit point.<\/p>\n<p>R1(config)# <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">access-list 1 permit 6.6.6.6<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router-map LP<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">match ip add 1<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">set local-preference 50<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map LP permit 20<\/span><\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 14.0.0.4 remote-as 200<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 14.0.0.4 route-map LP in<\/span><\/p>\n<p>Scenario &#8211; &gt; Configure AS 200 in a way that AS 100 always uses R2 as the exit point to reach 6.6.6.6. (Using AS-PATH)<\/p>\n<p>Before:<\/p>\n<p>6.6.6.6 &nbsp; &nbsp; 200 i<\/p>\n<p>R4(config)# <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">access-list 1 permit 6.6.6.6<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map ASPATH<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">match ip add 1<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">set as-path prepend 200 200<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map ASPATH permit 20<\/span><\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 200<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 14.0.0.1 remotes-as 100<\/span><\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">&nbsp;neighbor 14.0.0.1 route-map ASPATH out<\/span><\/p>\n<p>After:<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AS-PATH<\/p>\n<p>6.6.6.6 &nbsp; &nbsp; 200 200 200 i<\/p>\n<p>In &#8220;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map ASPATH<\/span>&#8220;, &#8220;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">set origin incomplete<\/span>&#8221; also works.<\/p>\n<p>Scenario &#8211; &gt; Configure AS 200 in a way that AS 100 always uses R2 as the exit point to reach 6.6.6.6. (Using MED)<\/p>\n<p>R4(config)# <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">access-list 1 permit 6.6.6.6<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map MED<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">match ip add 1<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">route-map MED permit 20<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 200<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 14.0.0.1 remote-as 100<\/span><\/p>\n<p>&nbsp; <span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">neighbor 14.0.0.1 route-map MED out<\/span><\/p>\n<p><b>Missing (0) MED<\/b><\/p>\n<p>&nbsp;&#8211; The default MED (0) is best<\/p>\n<p>&nbsp;&#8211; The behavior can be changed so that missing MED (0) will be considered worst<\/p>\n<p>&nbsp;&#8211; If MED is then configured between 2 or more routers, lower is better<\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">bgp bestpath med missing-as-worst<\/span><\/p>\n<p>MED Comparison<\/p>\n<p>&nbsp;&#8211; MED is compared only if the incoming updates are from the same AS<\/p>\n<p>&nbsp; &nbsp; &nbsp;-&gt; This can be disable<\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">router bgp 100<\/span><\/p>\n<p>&nbsp;<span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\">bgp always-compare-med<\/span><\/p>\n<p><span style=\"background-color:rgb(255, 250, 165);-evernote-highlight:true;\"><\/span><\/p>\n<p>In the lab, you should never have to change the router-id to influence elections or the selection of routes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>BGP &#8211; Border Gateway Protocol:<\/p>\n","protected":false},"author":1,"featured_media":773,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[39,31,10,57],"class_list":["post-785","post","type-post","status-publish","format-standard","hentry","category-ccie","tag-bgp","tag-published","tag-service-provider","tag-share"],"_links":{"self":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts\/785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=785"}],"version-history":[{"count":1,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts\/785\/revisions"}],"predecessor-version":[{"id":983,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts\/785\/revisions\/983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/media\/773"}],"wp:attachment":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}