Junos
Highlighted
Junos

Static default route not getting ditributed via OSPF

[ Edited ]
a week ago

I have a x4 router setup with router A and B been learning default route from ISP.  These two routers then advertise default route via ospf to Router C and D. 

 

I have tried static route on A and then advertised it to C but it does not show in routing table of C. 

 

Please can someone advise. 

 

 

show configuration protocols ospf
export [ exportstatic1 ospf-default ];
area 0.0.0.0 {
interface ge-0/0/0.0;
interface ge-0/0/3.500;
interface ge-0/0/4.0;
interface ge-0/0/5.0;
interface ge-0/0/6.0;
interface ge-0/0/12.0;
interface ge-0/0/13.0;
}

 

 

show configuration policy-options
policy-statement connected-static {
term connected {
from protocol [ direct static ];
then accept;
}
then reject;
}
policy-statement exportstatic1 {
term exportstatic1 {
from protocol static;
then accept;
}
}
policy-statement none {
then reject;
}
policy-statement ospf-default {
from {
protocol static;
route-filter 0.0.0.0/0 exact;
}
then accept;
}

 

 

 

configuration routing-options static
route 10.51.178.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 10.100.71.0/24 {
next-hop 172.31.255.33;
preference 111;
}
route 10.166.0.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 10.166.1.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 10.166.4.0/25 {
next-hop 172.31.255.33;
preference 1;
}
route 10.166.11.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 10.166.12.0/23 {
next-hop 172.31.255.33;
preference 1;
}
route 172.16.71.0/24 {
next-hop 172.31.255.33;
preference 111;
}
route 172.30.0.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 172.30.1.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 172.31.40.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 172.31.41.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 172.31.42.0/24 {
next-hop 172.31.255.33;
preference 1;
}
route 192.168.99.0/25 {
next-hop 172.31.255.33;
preference 1;
}
route 0.0.0.0/0 {
next-hop 172.31.255.1;
no-install;
preference 200;

 

C router is not learning 0.0.0.0/0 coming from A however it learns all other ospf routes?

 

 

 

10 REPLIES 10
Junos

Re: Static default route not getting ditributed via OSPF

a week ago
Looks like default route active on router A is not the static default route. May be it is bgp route. If it is bgp, Change the protocol to bgp in policy match instead of static. Please share flowing command output from A

show route 0/0 exact
Thanks,
Nellikka
JNCIE x3 (SEC #321; SP #2839; ENT #790)
Please Mark My Solution Accepted if it Helped, Kudos are Appreciated too!!!
Junos

Re: Static default route not getting ditributed via OSPF

a week ago

Hi Simon,

 

Can you please share the output of "show route protocol static 0.0.0.0/0 extensive" and "show ospf database".

 

Regards,

Pradeep.

Junos

Re: Static default route not getting ditributed via OSPF

[ Edited ]
a week ago

Hi Simon,

 

You have set the route preference for 0/0 route to 200, so in case same default route is being learnt from some other protocol also, it may get preferred and the static 0/0 route may not be active on router A.

 

To verify if the the static 0/0 route is active on router A, check show route 0/0 exact output on router A.

 

If the static 0/0 route is active on router A then check if router A is advertising it in ospf via command,

show ospf database advertising-router self                >>>>>>>>  ( on router A)

 

If you are able to see the 0/0 route in above output then check on router C ospf database for the same route

show ospf database extensive .

 

Regards,

Ankur

 

 

Junos

Re: Static default route not getting ditributed via OSPF

a week ago

Thanks Ankurt.

 

A router is learning default route from ISP via BGP - and i have added static default route and exported it to ospf. 

My route table on A has default route from ISP preferred as static route is only injected into ospf therefore I set preference as 200. 

show route 0/0

inet.0: 37 destinations, 52 routes (37 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

0.0.0.0/0 *[BGP/170] 1d 03:06:32, localpref 100
AS path: ************************* I, validation-state: unverified
> to 172.31.255.1 via ge-0/0/15.0
[Static/200] 15:06:59
> to 172.31.255.1 via ge-0/0/15.0

Now problem is its not been advertised to neighbor as per your command below:

show ospf database advertising-router self 

show ospf database advertising-router self

OSPF database, Area 0.0.0.0
Type ID Adv Rtr Seq Age Opt Cksum Len
Router *10.166.9.2 10.166.9.2 0x8000003b 2026 0x22 0x46d 84
OSPF AS SCOPE link state database
Type ID Adv Rtr Seq Age Opt Cksum Len
Extern *10.51.178.0 10.166.9.2 0x80000025 2426 0x22 0x479b 36
Extern *10.100.71.0 10.166.9.2 0x80000025 2226 0x22 0x9686 36
Extern *10.166.0.0 10.166.9.2 0x80000025 1826 0x22 0x8b96 36
Extern *10.166.1.0 10.166.9.2 0x80000025 1626 0x22 0x80a0 36
Extern *10.166.4.0 10.166.9.2 0x80000025 1426 0x22 0x623b 36
Extern *10.166.11.0 10.166.9.2 0x80000025 1226 0x22 0x1205 36
Extern *10.166.12.0 10.166.9.2 0x80000025 1026 0x22 0x215 36
Extern *172.16.71.0 10.166.9.2 0x80000025 826 0x22 0x4886 36
Extern *172.30.0.0 10.166.9.2 0x80000025 626 0x22 0xaf58 36
Extern *172.30.1.0 10.166.9.2 0x80000025 426 0x22 0xa462 36
Extern *172.31.40.0 10.166.9.2 0x80000025 226 0x22 0xe9f4 36
Extern *172.31.41.0 10.166.9.2 0x80000025 26 0x22 0xdefe 36
Extern *172.31.42.0 10.166.9.2 0x80000024 2826 0x22 0xd508 36
Extern *192.168.99.0 10.166.9.2 0x80000024 2626 0x22 0xeb9a 36

 

I hope it helps  please let me know where I am going wrong?

 

 

Junos

Re: Static default route not getting ditributed via OSPF

a week ago

show route protocol static 0.0.0.0/0 extensive

inet.0: 37 destinations, 52 routes (37 active, 0 holddown, 0 hidden)
0.0.0.0/0 (2 entries, 1 announced)
TSI:
KRT in-kernel 0.0.0.0/0 -> {172.31.255.1}
Static Preference: 200
Next hop type: Router, Next hop index: 1360
Address: 0x198cf28
Next-hop reference count: 4
Next hop: 172.31.255.1 via ge-0/0/15.0, selected
Session Id: 0x0
State: <NotInstall Int Ext>
Inactive reason: Route Preference
Age: 15:13:03
Validation State: unverified
Task: RT
AS path: I

*******************************************

show ospf database

OSPF database, Area 0.0.0.0
Type ID Adv Rtr Seq Age Opt Cksum Len
Router *10.166.9.2 10.166.9.2 0x8000003b 2414 0x22 0x46d 84
Router ****************************0x80000020 2012 0x22 0xbaae 72
Router 172.31.254.2 172.31.254.2 0x80000068 2018 0x22 0xd1ce 48
Network ****************************0x8000001b 2178 0x22 0x7451 32
Network 172.31.254.2 172.31.254.2 0x8000002d 2018 0x22 0x33ea 32
Network 172.31.255.25 **************0x8000001b 2345 0x22 0xef79 32
Network 172.31.255.38 **************0x8000001b 2512 0x22 0x550b 32
OSPF AS SCOPE link state database
Type ID Adv Rtr Seq Age Opt Cksum Len
Extern *10.51.178.0 10.166.9.2 0x80000025 2814 0x22 0x479b 36
Extern 10.51.178.0 **************0x8000001d 2678 0x22 0xcb4e 36
Extern *10.100.71.0 10.166.9.2 0x80000025 2614 0x22 0x9686 36
Extern 10.100.71.0 **************0x8000001c 1845 0x22 0x1d38 36
Extern *10.166.0.0 10.166.9.2 0x80000025 2214 0x22 0x8b96 36
Extern 10.166.0.0 **************0x8000001c 1678 0x22 0x1248 36
Extern *10.166.1.0 10.166.9.2 0x80000025 2014 0x22 0x80a0 36
Extern 10.166.1.0 **************0x8000001c 1512 0x22 0x752 36
Extern *10.166.4.0 10.166.9.2 0x80000025 1814 0x22 0x623b 36
Extern 10.166.4.0 **************0x8000001c 1345 0x22 0xe8ec 36
Extern *10.166.11.0 10.166.9.2 0x80000025 1614 0x22 0x1205 36
Extern 10.166.11.0 **************0x8000001c 1178 0x22 0x98b6 36
Extern *10.166.12.0 10.166.9.2 0x80000025 1414 0x22 0x215 36
Extern 10.166.12.0 **************0x8000001c 1011 0x22 0x88c6 36
Extern *172.16.71.0 10.166.9.2 0x80000025 1214 0x22 0x4886 36
Extern 172.16.71.0 **************0x8000001c 845 0x22 0xce38 36
Extern *172.30.0.0 10.166.9.2 0x80000025 1014 0x22 0xaf58 36
Extern 172.30.0.0 **************0x8000001c 678 0x22 0x360a 36
Extern *172.30.1.0 10.166.9.2 0x80000025 814 0x22 0xa462 36
Extern 172.30.1.0 **************0x8000001c 512 0x22 0x2b14 36
Extern *172.31.40.0 10.166.9.2 0x80000025 614 0x22 0xe9f4 36
Extern 172.31.40.0 0x8000001c 345 0x22 0x70a6 36
Extern *172.31.41.0 10.166.9.2 0x80000025 414 0x22 0xdefe 36
Extern 172.31.41.0 0x8000001c 178 0x22 0x65b0 36
Extern *172.31.42.0 10.166.9.2 0x80000025 214 0x22 0xd309 36
Extern 172.31.42.0  0x8000001c 11 0x22 0x5aba 36
Extern *192.168.99.0 10.166.9.2 0x80000025 14 0x22 0xe99b 36
Extern 192.168.99.0 0x8000001b 2845 0x22 0x724c 36

Junos

Re: Static default route not getting ditributed via OSPF

a week ago

As I mentioned in my previous post, static default route is not active and bgp default route is active. So to advertise use protocol bgp in policy like below:

 

delete policy-options policy-statement ospf-default from protocol static
set policy-options policy-statement ospf-default from protocol bgp route-filter 0.0.0.0/0 exact
set policy-options policy-statement ospf-default then accept

 

or change the preference value of static default route to less than bgp route prefernce and make static default as active route.

 

 

Thanks,
Nellikka
JNCIE x3 (SEC #321; SP #2839; ENT #790)
Please Mark My Solution Accepted if it Helped, Kudos are Appreciated too!!!
Junos

Re: Static default route not getting ditributed via OSPF

a week ago

Looks like your local active 0/0 route is static with preference 200 which should be exported.

The other reason this route is not added into OSPF is because of "no-install" which will prevent it from being added into the FIB.

Can you try to remove it? 

 

https://www.juniper.net/documentation/en_US/junos/topics/reference/configuration-statement/install-e...


Mengzhe Hu
JNCIE x 3 (SP DC ENT)
Junos

Re: Static default route not getting ditributed via OSPF

a week ago

I am wrong. even no-install on static route should still be exported. As mentioned above, BGP 0/0 route is active, making that change should resolve your issue 


Mengzhe Hu
JNCIE x 3 (SP DC ENT)
Junos

Re: Static default route not getting ditributed via OSPF

a week ago

Hi Simon,

 

When we are advertising a prefix into a protocol, it will only take affect if that prefix is active route from the mentioned protocol(in the policy option). If the active route is learned via different protocol then it will not be exported.

 

There are two ways to overcome this,

1.  In the policy-option change the' from protocol' from static to bgp.

    set policy-options policy-statement ospf-default term 1 from protocol bgp

    set policy-options policy-statement ospf-default term 1 from route-filter 0.0.0.0/0 exact
    set policy-options policy-statement ospf-default term 1 then accept

2. Or remove the from protocol static option all together from the policy option and only keep route filter config.

    set policy-options policy-statement ospf-default term 1 from route-filter 0.0.0.0/0 exact
    set policy-options policy-statement ospf-default term 1 then accept

 

I hope this helps.

 

Regards,

Ankur

Junos

Re: Static default route not getting ditributed via OSPF

a week ago

Hi Simon,

 

Well others have already provided you the reasons for this behavior and proposed solutions which are feasible, I want to understand what you want to acheive here. Do you have intensions that if the ISP send a default route via BGP only then you want to advertise them to OSPF? if that is the case then the more effective way would be to use conditional policy.

 

Or is your intension is to always have a default route generated from these ASBR nodes into the OSPF domain which remain always available?

 

regards

Nischal