|
|
|
# BGP example 2
|
|
|
|
|
|
|
|
Here is an example of a gateway router for a leaf AS with several upstreams (multihoming). This config is an extension of [BGP example 1](BGP_example_1). We cannot use the default route locally, we import routes from BGP and use BGP to choose between upstreams for each prefix - some networks are closer using bgp_abc, other using bgp_def. But we don't want all these routes received from BGP (cca 300k routes) export to the OSPF. Therefore, we propagate the default route (from static_ospf protocol) to the OSPF protocol (it does not matter that the default route is an unreachable route, other OSPF routers that receive it will compute _via_ according to the shortest path to this gateway).
|
|
|
|
|
|
|
|
This config should be extended to contain proper import filters for bgp protocols to prevent upstreams to send us some bogus routes. For details see the [BGP filtering](BGP_filtering) for more examples.
|
|
|
|
|
|
|
|
log syslog all;
|
|
|
|
|
|
|
|
router id A.B.C.D;
|
|
|
|
|
|
|
|
protocol device {
|
|
|
|
scan time 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
protocol kernel {
|
|
|
|
export all;
|
|
|
|
scan time 15;
|
|
|
|
}
|
|
|
|
|
|
|
|
protocol static static_bgp {
|
|
|
|
import all;
|
|
|
|
|
|
|
|
route A.B.C.0/24 reject;
|
|
|
|
route D.E.F.0/24 reject;
|
|
|
|
}
|
|
|
|
|
|
|
|
protocol static static_ospf {
|
|
|
|
import all;
|
|
|
|
|
|
|
|
route 0.0.0.0/0 reject;
|
|
|
|
}
|
|
|
|
|
|
|
|
protocol bgp bgp_abc {
|
|
|
|
import all;
|
|
|
|
export where proto = "static_bgp";
|
|
|
|
|
|
|
|
local as XXXX;
|
|
|
|
neighbor W1.X1.Y1.Z1 as YYYY;
|
|
|
|
}
|
|
|
|
|
|
|
|
protocol bgp bgp_def {
|
|
|
|
import all;
|
|
|
|
export where proto = "static_bgp";
|
|
|
|
|
|
|
|
local as XXXX;
|
|
|
|
neighbor W2.X2.Y2.Z2 as ZZZZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
protocol ospf {
|
|
|
|
import all;
|
|
|
|
export where proto = "static_ospf";
|
|
|
|
|
|
|
|
...
|
|
|
|
} |