From cb7811898c29a7ecfde66da2d42aeb4d8e572010 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Fri, 10 Sep 2021 20:46:05 +0000 Subject: [PATCH] blade-tuvok: set bgp_local_prefs --- ops/nixos/lib/bgp.nix | 6 ++++++ ops/nixos/lib/blade-router.nix | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ops/nixos/lib/bgp.nix b/ops/nixos/lib/bgp.nix index b41085f8e0..d96625cd36 100644 --- a/ops/nixos/lib/bgp.nix +++ b/ops/nixos/lib/bgp.nix @@ -14,6 +14,7 @@ let { if ! (avoid_martians4()) then reject; ${if ix.remote.must_be_next_hop then "if (bgp_path.first != ${toString ix.remote.asn}) then reject;" else "# no next-hop requirement"} + bgp_local_pref = ${toString ix.remote.bgp_local_pref}; accept; } filter bgp_in_${ixName}6 @@ -22,6 +23,7 @@ let { if ! (avoid_martians6()) then reject; ${if ix.remote.must_be_next_hop then "if (bgp_path.first != ${toString ix.remote.asn}) then reject;" else "# no next-hop requirement"} + bgp_local_pref = ${toString ix.remote.bgp_local_pref}; accept; } protocol pipe ${ixName}pipe_4 { @@ -139,6 +141,10 @@ in { type = bool; default = true; }; + bgp_local_pref = mkOption { # lukegbgp.config.peering..remote.bgp_local_pref + type = int; + default = 100; + }; routers = mkOption { # lukegbgp.config.peering..remote.routers type = listOf (submodule { options = { diff --git a/ops/nixos/lib/blade-router.nix b/ops/nixos/lib/blade-router.nix index 8e4f139c14..dd5575e329 100644 --- a/ops/nixos/lib/blade-router.nix +++ b/ops/nixos/lib/blade-router.nix @@ -138,6 +138,7 @@ in remote = { asn = 3170; export_community = 4001; + bgp_local_pref = 101; routers = [{ v4 = config.my.blade-router.addresses.linknet.v4.remote; v6 = config.my.blade-router.addresses.linknet.v6.remote; @@ -170,6 +171,7 @@ in v4 = "195.66.225.231"; v6 = "2001:7f8:4::220a:2"; }]; + bgp_local_pref = 109; must_be_next_hop = false; }; }; @@ -209,6 +211,7 @@ in v4 = "195.66.225.53"; v6 = "2001:7f8:4::5052:1"; }]; + bgp_local_pref = 110; prefix_limit.v4 = 16000; prefix_limit.v6 = 3000; }; @@ -217,7 +220,8 @@ in remote = { asn = 212895; export_community = 5004; - passive = true; # pending + passive = true; # pending v6 + bgp_local_pref = 100; routers = [{ enabled = cfg.linx.enable; v4 = "195.66.225.105"; @@ -234,6 +238,7 @@ in v4 = "195.66.224.21"; v6 = "2001:7f8:4::1b1b:1"; }]; + bgp_local_pref = 110; prefix_limit.v4 = 176000; prefix_limit.v6 = 156000; }; @@ -248,6 +253,7 @@ in v4 = "195.66.227.14"; v6 = "2001:7f8:4::f320:1"; }]; + bgp_local_pref = 120; prefix_limit.v4 = 1000; prefix_limit.v6 = 1000; }; @@ -261,6 +267,7 @@ in v4 = "195.66.224.125"; v6 = "2001:7f8:4::3b41:1"; }]; + bgp_local_pref = 120; prefix_limit.v4 = 15000; prefix_limit.v6 = 10000; }; @@ -274,6 +281,7 @@ in v4 = "195.66.225.179"; v6 = "2001:7f8:4::3417:1"; }]; + bgp_local_pref = 120; prefix_limit.v4 = 20000; prefix_limit.v6 = 2000; };