{"id":51,"date":"2009-04-11T17:09:32","date_gmt":"2009-04-11T16:09:32","guid":{"rendered":"http:\/\/kudzia.eu\/b\/?p=51"},"modified":"2023-06-22T19:55:21","modified_gmt":"2023-06-22T18:55:21","slug":"2x-full-bgp-feed-with-quagga","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2009\/04\/2x-full-bgp-feed-with-quagga\/","title":{"rendered":"2x full bgp feed with quagga"},"content":{"rendered":"<p>maybe someone will find this one handy. it&#8217;s description + config file for bgp setup i&#8217;ve recently put on production using debian lenny + quagga.<br \/>\n<!--more--><br \/>\nscenario:<br \/>\n two service providers &#8211; GTS\/AS8246 and CDP\/AS12968 providing full feed of internet routes.<br \/>\n i have interconnecting networks with both, my ip is 217.2.1.2\/30 and 85.128.0.2\/30 respectivly, isp&#8217;s routers have: 85.128.0.1 and 217.1.1.1.<\/p>\n<p> own AS number AS44444, own PI address range 91.0.0.0\/23 [ to protect innocent changed from original ]<br \/>\n slightly unequal link speed to both ISPs &#8211; with proportions 2:1 with GTS having bigger pipe.<\/p>\n<p> GTS&#8217;s BGP speaker 217.1.1.1 &#8211; is not directly reachable &#8211; it&#8217;s couple of hops away so i need static routing to it. i configure that in zebra.conf:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhostname bulba\r\npassword bromba\r\nenable password bromba\r\nlog file \/var\/log\/quagga\/zebra.log\r\nlog syslog informational\r\n! eth0.3 goes to gts\r\ninterface eth0.3\r\n! eth0.4 goes to cdp\r\ninterface eth0.4\r\n! eth1 goes to end-users\r\ninterface eth1\r\ninterface lo\r\n! static route to gts BGP speaker. to protect innocent addres was slightly altered\r\nip route 217.1.1.0\/24 217.2.1.1\r\n&lt;\/code&gt;\r\n\r\nin bgpd.conf all the magic is happening:\r\n&lt;code&gt;\r\nhostname bulba\r\npassword bromba\r\nlog file \/var\/log\/quagga\/bgpd.log\r\nlog syslog warnings\r\n!\r\n! definition of my peers\r\nrouter bgp 44444\r\n bgp router-id 91.0.0.1\r\n network 91.0.0.0\/23\r\n ! configuration of neighbour CDP router - reachable directly on eth0.4\r\n ! 85.128.0.1 is address of CDP bgp speaker\r\n neighbor 85.128.0.1 remote-as 12968\r\n ! 85.128.0.2 is addres used by me on subnet where i have connection with CDP\r\n neighbor 85.128.0.1 update-source 85.128.0.2\r\n neighbor 85.128.0.1 soft-reconfiguration inbound\r\n neighbor 85.128.0.1 prefix-list my_announced out\r\n neighbor 85.128.0.1 route-map cdp_localpref in\r\n neighbor 85.128.0.1 route-map setcommunityCDP out\r\n !\r\n ! configuration of GTS neighbour. BGP speaker is at 217.1.1.1 but i cannot reach it directly - hence static routing in zebra.conf\r\n neighbor 217.1.1.1 remote-as 8246\r\n neighbor 217.1.1.1 ebgp-multihop 10\r\n ! 217.2.1.2 is my address on small interconnecting network with GTS router \r\n neighbor 217.1.1.1 update-source 217.2.1.2\r\n neighbor 217.1.1.1 soft-reconfiguration inbound\r\n neighbor 217.1.1.1 prefix-list my_announced out\r\n neighbor 217.1.1.1 route-map gts_localpref in\r\n neighbor 217.1.1.1 route-map setcommunityGTS out\r\n !\r\n ! some as-paths used to manipulate outgoing traffic\r\n ! matches anything that goes over cogent&#039;s network. we&#039;ll use it to make sure upload to cogent-connected hosts goes via GTS\r\n ip as-path access-list as_path_to_go_via_gts permit ^.*174.*$\r\n ! similarly but for TELIA-Sonera and all connected via it\r\n ip as-path access-list as_path_to_go_via_gts permit ^.*1299.*$\r\n ! all end-users of upc\/chello\r\n ip as-path access-list as_path_to_go_via_gts permit ^.*9141$\r\n !\r\n ! mci \/ verizone\r\n ip as-path access-list as_path_to_go_via_cdp permit ^.*701.*$\r\n ! qwest\r\n ip as-path access-list as_path_to_go_via_cdp permit ^.*209.*$\r\n ! all end-users of netia\r\n ip as-path access-list as_path_to_go_via_cdp permit ^.*12741$\r\n !\r\n ! in fact i have much more of those...\r\n !\r\n !\r\n ! and just for fun access lists for manipulating local prefs on subnet level\r\n ip prefix-list cdp_localpref seq 5 permit 193.110.228.0\/24\r\n !\r\n ip prefix-list gts_localpref seq 9 permit 89.64.0.0\/13\r\n !\r\n ip prefix-list any seq 5 permit any\r\n !\r\n ip prefix-list my_announced seq 1 permit 91.0.0.0\/23 \r\n !\r\n !\r\n ! apply higher local pref for selected routes \/ matching as-paths\r\n route-map cdp_localpref permit 10\r\n   match ip address prefix-list cdp_localpref\r\n   set local-preference 120\r\n route-map cdp_localpref permit 20\r\n   match as-path as_path_to_go_via_cdp\r\n   set local-preference 140\r\n !\r\n ! default - 100 - localpref for anythign else\r\n route-map cdp_localpref permit 100\r\n   match ip address prefix-list any\r\n   set local-preference 100\r\n !\r\n ! do the same for GTS\r\n  route-map gts_localpref permit 10\r\n    match ip address prefix-list gts_localpref\r\n    set local-preference 120\r\n route-map gts_localpref permit 20\r\n   match as-path as_path_to_go_via_gts\r\n   set local-preference 130\r\n route-map gts_localpref permit 100\r\n   match ip address prefix-list any\r\n   set local-preference 100\r\n !\r\n !\r\n ! add communities to advertised routes - used to somehow control incomming traffic\r\n route-map setcommunityGTS permit 10\r\n   match ip address prefix-list my_announced\r\n !\r\n route-map setcommunityGTS permit 20\r\n   match ip address any\r\n !\r\n ! main objective - to shift some incoming traffic away from CDP to GTS. so - prepending + community from CDP that does even more prepending.\r\n route-map setcommunityCDP permit 10\r\n   match ip address 2\r\n   set as-path prepend 47884\r\n   set community 12968:1011\r\n  !\r\n  route-map setcommunityCDP permit 20\r\n   match ip address 2\r\n<\/pre>\n<p>list of GTS communities can be found in whois from their <a href=\"http:\/\/www.db.ripe.net\/whois?form_type=simple&#038;full_query_string=&#038;searchtext=AS8246\">AS8246<\/a>.<\/p>\n<p>CDP is not so happy to announce their&#8217;s but i&#8217;ve found <a href=\"http:\/\/www.man.lodz.pl\/LISTY\/POLIP\/2008\/01\/0883.html\">this<\/a> and after a while got from their sales-rep that:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nremarks: ===================================================\r\nremarks:\r\nremarks: BGP community support: ipnoc(at)crowley.pl\r\nremarks:\r\nremarks: ---------------------------------------------------\r\nremarks: &lt;&lt;&lt; Communities used in AS12968 &gt;&gt;&gt;\r\nremarks: ---------------------------------------------------\r\nremarks: communities for specific link are 12968:a(b)01x\r\nremarks: x=6 for &quot;do not advertise&quot;\r\nremarks: x=1,2 for &quot;prepend 1,2 times&quot;\r\nremarks:\r\nremarks: 12968:101x ATMAN\r\nremarks: 12968:201x GIX\r\nremarks: 12968:301x WIX\r\nremarks: 12968:401x TPSA\r\nremarks: 12968:501x DE-CIX\r\nremarks:\r\nremarks:\r\nremarks: 12968:801x Globeinternet\r\nremarks: 12968:901x Level3\r\nremarks: 12968:1001x PL-IX\r\nremarks: 12968:1101x AC-X\r\nremarks: 12968:1201x Netia\r\nremarks:\r\nremarks: ----------------------------------------------------\r\nremarks: &lt;&lt;&lt; Communities applied at ingress &gt;&gt;&gt;\r\nremarks: ----------------------------------------------------\r\nremarks: 12968:10 ATMAN\r\nremarks: 12968:20 GIX\r\nremarks: 12968:30 WIX\r\nremarks: 12968:40 TPSA\r\nremarks: 12968:50 DE-CIX\r\nremarks:\r\nremarks:\r\nremarks: 12968:80 Globeinternet\r\nremarks: 12968:90 Level3\r\nremarks: 12968:100 PL-IX\r\nremarks: 12968:110 AC-X\r\nremarks: 12968:120 Netia\r\nremarks:\r\nremarks: 12968:180 Technical University of Silesia\r\nremarks: 12968:181 TASK\r\nremarks: 12968:182 TK Telekom\r\nremarks: 12968:183 Dialog Telecom\r\nremarks: 12968:184 TKP SA\r\nremarks: 12968:185 SITEL\r\nremarks:\r\nremarks: 12968:200 Polish routes\r\nremarks: 12968:210 Foreign routes\r\nremarks: 12968:220 Public peerings\r\nremarks: 12968:300 Crowley Customer&#039;s routes\r\nremarks\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>maybe someone will find this one handy. it&#8217;s description + config file for bgp setup i&#8217;ve recently put on production using debian lenny + quagga.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[5,6,4],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-tech","tag-bgp","tag-linux","tag-net"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":12,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":3524,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/51\/revisions\/3524"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}