1
0

Init ibgp routing

This commit is contained in:
clerie 2020-12-17 01:35:27 +01:00
parent 23747424da
commit 872fbea418
4 changed files with 118 additions and 8 deletions

View File

@ -10,6 +10,8 @@
"net.ipv6.conf.all.forwarding" = true;
};
# Open Firewall for BGP
networking.firewall.allowedTCPPorts = [ 179 ];
# Open Fireall for OSPF
networking.firewall.extraCommands = ''
ip6tables -A INPUT -p ospfigp -j ACCEPT

View File

@ -57,6 +57,8 @@
ipv6 table ospf6;
ipv4 table ospf4;
ipv6 table bgp6;
ipv4 table bgp4;
protocol direct direct_lo {
interface "lo";
@ -128,6 +130,40 @@
};
}
template bgp ibgp6 {
local as 4200002574;
graceful restart on;
source address ${ (lib.head config.networking.interfaces.lo.ipv6.addresses).address };
ipv6 {
table bgp6;
next hop self;
import keep filtered;
import all;
export all;
};
}
template bgp ibgp4 {
local as 4200002574;
graceful restart on;
source address ${ (lib.head config.networking.interfaces.lo.ipv4.addresses).address };
ipv4 {
table bgp4;
next hop self;
import keep filtered;
import all;
export all;
};
}
protocol bgp bgp_nonat from ibgp6 {
neighbor fd00:152:152:103::1 as 4200002574;
}
protocol bgp bgp_porter from ibgp6 {
neighbor fd00:152:152:102::1 as 4200002574;
}
protocol device {
scan time 10;
}

View File

@ -72,17 +72,19 @@
ipv6 table ospf6;
ipv4 table ospf4;
ipv6 table bgp6;
ipv4 table bgp4;
protocol static static_6 {
protocol static static_bgp6 {
ipv6 {
table ospf6;
table bgp6;
};
route 2001:638:904::/48 via ${config.networking.defaultGateway6.address};
}
protocol static static_4 {
protocol static static_bgp4 {
ipv4 {
table ospf4;
table bgp4;
};
route 141.24.0.0/16 via ${config.networking.defaultGateway.address};
}
@ -107,22 +109,22 @@
};
}
protocol kernel kernel_6 {
protocol kernel kernel_ospf6 {
ipv6 {
table ospf6;
export filter {
krt_prefsrc=fd00:152:152:103::1;
krt_prefsrc=${ (lib.head config.networking.interfaces.lo.ipv6.addresses).address };
accept;
};
import none;
};
}
protocol kernel kernel_4 {
protocol kernel kernel_ospf4 {
ipv4 {
table ospf4;
export filter {
krt_prefsrc=10.152.103.1;
krt_prefsrc=${ (lib.head config.networking.interfaces.lo.ipv4.addresses).address };
accept;
};
import none;
@ -157,6 +159,40 @@
};
}
template bgp ibgp6 {
local as 4200002574;
graceful restart on;
source address ${ (lib.head config.networking.interfaces.lo.ipv6.addresses).address };
ipv6 {
table bgp6;
next hop self;
import keep filtered;
import all;
export all;
};
}
template bgp ibgp4 {
local as 4200002574;
graceful restart on;
source address ${ (lib.head config.networking.interfaces.lo.ipv4.addresses).address };
ipv4 {
table bgp4;
next hop self;
import keep filtered;
import all;
export all;
};
}
protocol bgp bgp_carbon from ibgp6 {
neighbor fd00:152:152:104::1 as 4200002574;
}
protocol bgp bgp_porter from ibgp6 {
neighbor fd00:152:152:102::1 as 4200002574;
}
protocol device {
scan time 10;
}

View File

@ -64,6 +64,8 @@
ipv6 table ospf6;
ipv4 table ospf4;
ipv6 table bgp6;
ipv4 table bgp4;
protocol direct {
interface "lo";
@ -133,6 +135,40 @@
};
}
template bgp ibgp6 {
local as 4200002574;
graceful restart on;
source address ${ (lib.head config.networking.interfaces.lo.ipv6.addresses).address };
ipv6 {
table bgp6;
next hop self;
import keep filtered;
import all;
export all;
};
}
template bgp ibgp4 {
local as 4200002574;
graceful restart on;
source address ${ (lib.head config.networking.interfaces.lo.ipv4.addresses).address };
ipv4 {
table bgp4;
next hop self;
import keep filtered;
import all;
export all;
};
}
protocol bgp bgp_carbon from ibgp6 {
neighbor fd00:152:152:104::1 as 4200002574;
}
protocol bgp bgp_nonat from ibgp6 {
neighbor fd00:152:152:103::1 as 4200002574;
}
protocol device {
scan time 10;
}