Browse Source

Update bgp filters : the med is used between different ASes for incoming routes

Philippe Le Brouster 8 years ago
parent
commit
73c78b75f0
3 changed files with 50 additions and 38 deletions
  1. 11 11
      etc/local/bird/bird/bgp.conf
  2. 35 26
      etc/local/bird/bird6/bgp.conf
  3. 4 1
      etc/local/bird/common/bgp-filters.conf

+ 11 - 11
etc/local/bird/bird/bgp.conf

@@ -10,7 +10,7 @@ template bgp ibgp {
 	gateway direct;
 	local as 20766;
 	next hop self;
-	import where bgp_import(20766,"core",0);
+	import where bgp_import(20766,"core",0,100);
 	export where bgp_export(20766,"core");
 }
 
@@ -38,7 +38,7 @@ protocol bgp core_vodka from ibgp {
 template bgp tpl_fdn {
 	local as 20766;
 	description "Livraison FDN";
-        import where bgp_import(65055,"member",50000);
+        import where bgp_import(65055,"member",50000,100);
         export where bgp_export(65055,"default");
 }
 
@@ -55,7 +55,7 @@ protocol bgp membre_fdn2 from tpl_fdn {
 template bgp tpl_ldn {
        local as 20766;
        description "Livraison Lorraine Data Network";
-        import where bgp_import(60197,"member",40000);
+        import where bgp_import(60197,"member",40000,100);
         export where bgp_export(60197,"full");
 }
 
@@ -74,7 +74,7 @@ protocol bgp member_ldn2 from tpl_ldn {
 template bgp tpl_neutrinet {
 	local as 20766;
 	description "Livraison Neutrinet";
-        import where bgp_import(204059,"member",40000);
+        import where bgp_import(204059,"member",40000,100);
         export where bgp_export(204059,"members");
 }
 
@@ -88,7 +88,7 @@ protocol bgp member_neutrinet from tpl_neutrinet {
 template bgp tpl_absolight {
 	local as 20766;
 	description "Transit Absolight";
-        import where bgp_import(29608,"transit",10004);
+        import where bgp_import(29608,"transit",10004,100);
         export where bgp_export(29608,"members");
 }
 
@@ -118,7 +118,7 @@ protocol bgp transit_ielo from tpl_ielo {
 template bgp tpl_grenode {
 	local as 20766;
 	description "Peering Grenode";
-	import where bgp_import(51083,"peering",30000);
+	import where bgp_import(51083,"peering",30000,100);
         export where bgp_export(51083,"members");
 }
 
@@ -131,13 +131,13 @@ protocol bgp peering_grenode1 from tpl_grenode {
 #
 template bgp tpl_franceix_rs {
 	local as 20766;
-        import where bgp_import(51706,"peering",26000);
+        import where bgp_import(51706,"peering",26000,200);
         export where bgp_export(51706,"members");
 	import limit 100000;
 }
 template bgp tpl_franceix_peers {
 	local as 20766;
-        import where bgp_import(51706,"peering",26000);
+        import where bgp_import(51706,"peering",26000,210);
         export where bgp_export(51706,"members");
 	import limit 10000;
 }
@@ -219,7 +219,7 @@ protocol bgp franceix_21502 from tpl_franceix_peers {
 # EquinIX: route collector (only for monitoring)
 template bgp tpl_equinix_rc {
         local as 20766;
-        import where bgp_import(65517,"peering",22000);
+        import where bgp_import(65517,"peering",22000,100);
         export where bgp_export(65517,"members");
         import limit 10;
 }
@@ -232,13 +232,13 @@ protocol bgp equinix_rc1 from tpl_equinix_rc {
 # EquinIX: Route server
 template bgp tpl_equinix_rs {
         local as 20766;
-        import where bgp_import(24115,"peering",22000);
+        import where bgp_import(24115,"peering",22000,100);
         export where bgp_export(24115,"members");
 	import limit 100000;
 }
 template bgp tpl_equinix_peers {
         local as 20766;
-        import where bgp_import(24115,"peering",22000);
+        import where bgp_import(24115,"peering",22000,110);
         export where bgp_export(24115,"members");
 	import limit 100000;
 }

+ 35 - 26
etc/local/bird/bird6/bgp.conf

@@ -3,6 +3,15 @@
 # vim: set ts=4:sw=4
 
 #
+# Default configuration for all bgp templates
+#
+template bgp tpl_bgp {
+        # Use MED for routes received by different ASes
+        bgp med;
+}
+
+
+#
 # iBGP: Backbone
 #
 template bgp ibgp {
@@ -10,7 +19,7 @@ template bgp ibgp {
 	gateway direct;
 	local as 20766;
 	next hop self;
-	import where bgp_import(20766,"core",0);
+	import where bgp_import(20766,"core",0,100);
         export where bgp_export(20766,"core");
 }
 
@@ -35,27 +44,27 @@ protocol bgp core_vodka from ibgp {
 #
 # Member: FDN
 #
-template bgp tpl_fdn {
-	local as 20766;
-	description "Livraison FDN";
-        import where bgp_import(65055,"member",50000);
+template bgp tpl_fdn from tpl_bgp {
+        local as 20766;
+        description "Livraison FDN";
+        import where bgp_import(65055,"member",50000,100);
         export where bgp_export(65055,"default");
 }
 
 protocol bgp member_fdn1 from tpl_fdn {
-	neighbor 2001:910:0:800::213 as 65055;
+        neighbor 2001:910:0:800::213 as 65055;
 }
 protocol bgp member_fdn2 from tpl_fdn {
-	neighbor 2001:910:0:800::214 as 65055;
+        neighbor 2001:910:0:800::214 as 65055;
 }
 
 #
 # Member: Lorraine Data Network
 #
-template bgp tpl_ldn {
+template bgp tpl_ldn from tpl_bgp {
         local as 20766;
         description "Livraison Lorraine Data Network";
-        import where bgp_import(60197,"member",40000);
+        import where bgp_import(60197,"member",40000,100);
         export where bgp_export(60197,"full");
 }
 
@@ -72,10 +81,10 @@ protocol bgp member_ldn2 from tpl_ldn {
 # Member: Neutrinet
 #
 
-template bgp tpl_neutrinet {
+template bgp tpl_neutrinet from tpl_bgp {
 	local as 20766;
 	description "Livraison Neutrinet";
-        import where bgp_import(204059,"member",40000);
+        import where bgp_import(204059,"member",40000,100);
         export where bgp_export(204059,"members");
 }
 
@@ -87,10 +96,10 @@ protocol bgp member_neutrinet from tpl_neutrinet {
 #
 # Transit: Absolight
 #
-template bgp tpl_absolight {
+template bgp tpl_absolight from tpl_bgp {
 	local as 20766;
 	description "Transit Absolight";
-        import where bgp_import(29608,"transit",10004);
+        import where bgp_import(29608,"transit",10004,100);
         export where bgp_export(29608,"members");
 }
 
@@ -108,7 +117,7 @@ template bgp tpl_ielo {
         import where bgp_import(29075,"transit",10003);
         export where bgp_export(29075,"members");
 }
- 
+
 protocol bgp transit_ielo from tpl_ielo {
         neighbor 2a02:2178:3:5::1 as 29075;
         description "Transit Ielo (th2)";
@@ -117,10 +126,10 @@ protocol bgp transit_ielo from tpl_ielo {
 #
 # Peering: Grenode
 #
-template bgp tpl_grenode {
+template bgp tpl_grenode from tpl_bgp {
 	local as 20766;
 	description "Peering Grenode";
-        import where bgp_import(51083,"peering",30000);
+        import where bgp_import(51083,"peering",30000,100);
         export where bgp_export(51083,"members");
 }
 
@@ -131,16 +140,16 @@ protocol bgp peering_grenode1 from tpl_grenode {
 #
 # Peering: FranceIX
 #
-template bgp tpl_franceix_rs {
+template bgp tpl_franceix_rs from tpl_bgp {
 	local as 20766;
-        import where bgp_import(51706,"peering",26000);
+        import where bgp_import(51706,"peering",26000,200);
         export where bgp_export(51706,"members");
 	import limit 100000;
 }
 
-template bgp tpl_franceix_peers {
+template bgp tpl_franceix_peers from tpl_bgp {
 	local as 20766;
-        import where bgp_import(51706,"peering",26000);
+        import where bgp_import(51706,"peering",26000,210);
         export where bgp_export(51706,"members");
 	import limit 10000;
 }
@@ -208,9 +217,9 @@ protocol bgp franceix_39405 from tpl_franceix_peers {
 # Peering: EquinIX
 #
 # EquinIX: route collector (only for monitoring)
-template bgp tpl_equinix_rc {
+template bgp tpl_equinix_rc from tpl_bgp {
         local as 20766;
-        import where bgp_import(65517,"peering",22000);
+        import where bgp_import(65517,"peering",22000,100);
         export where bgp_export(65517,"members");
         import limit 10;
 }
@@ -221,15 +230,15 @@ protocol bgp equinix_rc1 from tpl_equinix_rc {
 }
 
 # EquinIX: Route server
-template bgp tpl_equinix_rs {
+template bgp tpl_equinix_rs from tpl_bgp {
         local as 20766;
-        import where bgp_import(24115,"peering",22000);
+        import where bgp_import(24115,"peering",22000,100);
         export where bgp_export(24115,"members");
 	import limit 100000;
 }
-template bgp tpl_equinix_peers {
+template bgp tpl_equinix_peers from tpl_bgp {
         local as 20766;
-        import where bgp_import(24115,"peering",22000);
+        import where bgp_import(24115,"peering",22000,110);
         export where bgp_export(24115,"members");
 	import limit 10000;
 }

+ 4 - 1
etc/local/bird/common/bgp-filters.conf

@@ -16,7 +16,7 @@
 #                       core:     this is a core session. It's the backbone iBGP sessions.
 #    community    / community number to associate to the route. If equal 0, there is no association.
 #
-function bgp_import( int AS; string import_type; int community)
+function bgp_import( int AS; string import_type; int community; int import_med)
 {
     if ! (import_type = "transit" || import_type="peering" || import_type="member" || import_type="core") then {
         print "bgp_import: parametre import_type invalide";
@@ -58,6 +58,9 @@ function bgp_import( int AS; string import_type; int community)
     # Specific configuration (test for Tetaneutral weird no-export)
     if AS = 51706 then bgp_community.delete( [(65535,*)] );
 
+    # Define med
+    if import_med >= 0 then bgp_med=import_med;
+
     return true;
 }