OSPF export/import default route filter problem
Hi, I have 4 routers connected like this. (10.4.4.1/24) (10.4.4.4.2/24) R1 R2 \ / \ / SWITCH / \ / \ R3 R4 (10.4.4.3/24) (10.4.4.4/24) I export a default route (0.0.0.0/0) from R1 and R2 with an ospf_metric1 = 100.. At R3, in an import filter I set the ospf_metric1 of R1's default route to 10. At R4, in an import filter I set the ospf_metric1 of R2's default route to 10. What I expect is that R3's routing table is going to contain 0.0.0.0/0 via R1. and likewise R4's routing table is going to contain 0.0.0.0/0 via R2. Unfortunately it doesn't happen and both R3's and R4's routing table has 0.0.0.0/0 via R2. Here's a config for router R1 (R2 is identical except for router id). router id 10.4.4.1 protocol kernel { export all; } protocol direct { } protocol device { scan time 10; } protocol static { route 0.0.0.0/0 via 123.123.123.1; #vtnet0 } protocol ospf { tick 2; rfc1583compat yes; export filter { if net = 0.0.0.0/0 then { ospf_metric1 = 100; accept; } reject; } area 0.0.0.0 { interface "vtnet1" { dead count 4; type broadcast; } } } Here's a config for router R3 (R4 is identical except for router id and if statement's ospf_router_id) router id 10.4.4.3 protocol kernel { export all; } protocol direct { } protocol device { scan time 10; } protocol static { } protocol ospf { tick 2; rfc1583compat yes; import filter { if ospf_router_id = 10.4.4.1 then { if net = 0.0.0.0/0 then { ospf_metric1 = 10; } } accept; } area 0.0.0.0 { interface "vtnet0" { dead count 4; type broadcast; } interface "ng*" { stub yes; } } } When I place a print statement in the import filter at the very top: import filter { print "router_id: ", ospf_router_id, " net: ", net; if ospf_router_id = 10.4.4.1 then { if net = 0.0.0.0/0 then { ospf_metric1 = 10; } } For R3 I see: router_id: 10.4.4.3 net: 10.4.4.0/24 router_id: 10.4.4.2 net: 0.0.0.0/0 router_id: 10.4.4.2 net: 10.4.4.0/24 For R4 I see: router_id: 10.4.4.4 net: 10.4.4.0/24 router_id: 10.4.4.2 net: 0.0.0.0/0 router_id: 10.4.4.2 net: 10.4.4.0/24 So router R1 (10.4.4.1) is not seen by the import filters, as such R2 is selected as the default route for both R3 and R4. How could i fix it? Thank you..
On Sat, Sep 19, 2015 at 09:09:54PM +0200, LU wrote:
Hi,
I have 4 routers connected like this.
(10.4.4.1/24) (10.4.4.4.2/24) R1 R2 \ / \ / SWITCH / \ / \ R3 R4 (10.4.4.3/24) (10.4.4.4/24)
I export a default route (0.0.0.0/0) from R1 and R2 with an ospf_metric1 = 100..
At R3, in an import filter I set the ospf_metric1 of R1's default route to 10.
At R4, in an import filter I set the ospf_metric1 of R2's default route to 10.
What I expect is that R3's routing table is going to contain 0.0.0.0/0 via R1. and likewise R4's routing table is going to contain 0.0.0.0/0 via R2.
Unfortunately it doesn't happen and both R3's and R4's routing table has 0.0.0.0/0 via R2.
Hi Unfortunately that is not how import from OSPF works in BIRD. The route is first selected inside OSPF (from possible OSPF paths) and then imported to the main table (where it is compared to routes from other protocols). Therefore setting ospf_metric1 in import filters have no relevance (unless you have multiple OSPF instances and compare routes from them in the main table). Note that being able to import all possible OSPF routes to the main table would be a nice feature, but it is not currently implemented. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Hello, So I am going to stick to the working solution by using /30 links between routers and then setting a lower metric for R3 -> R4, and R4 -> R2 which has the same effect as what I wanted to achieve. (Only disadvantage that it's more work to setup and maintain) Thank you! 2015-09-20 13:39 GMT+02:00 Ondrej Zajicek <santiago@crfreenet.org>:
On Sat, Sep 19, 2015 at 09:09:54PM +0200, LU wrote:
Hi,
I have 4 routers connected like this.
(10.4.4.1/24) (10.4.4.4.2/24) R1 R2 \ / \ / SWITCH / \ / \ R3 R4 (10.4.4.3/24) (10.4.4.4/24)
I export a default route (0.0.0.0/0) from R1 and R2 with an ospf_metric1 = 100..
At R3, in an import filter I set the ospf_metric1 of R1's default route to 10.
At R4, in an import filter I set the ospf_metric1 of R2's default route to 10.
What I expect is that R3's routing table is going to contain 0.0.0.0/0 via R1. and likewise R4's routing table is going to contain 0.0.0.0/0 via R2.
Unfortunately it doesn't happen and both R3's and R4's routing table has 0.0.0.0/0 via R2.
Hi
Unfortunately that is not how import from OSPF works in BIRD. The route is first selected inside OSPF (from possible OSPF paths) and then imported to the main table (where it is compared to routes from other protocols). Therefore setting ospf_metric1 in import filters have no relevance (unless you have multiple OSPF instances and compare routes from them in the main table).
Note that being able to import all possible OSPF routes to the main table would be a nice feature, but it is not currently implemented.
-- Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
LU -
Ondrej Zajicek