Manual:OSPF Forwarding Address
Lets assume that router R1 has static route to external network 192.168.0.0/24. OSPF is running between R1,R2 and R3 and static route is distributed across the OSPF network.
The problem in such setup is obvious, R2 can not reach external network directly. Traffic from R2 will be forwarded to router R1
[admin@R2] /ip route> print Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, B - blackhole, U - unreachable, P - prohibit # DST-ADDRESS PREF-SRC GATEWAY DISTANCE ... 8 ADo 192.168.0.0/24 10.1.101.10 110
Fortunately OSPF has mechanism to solve such situations. OSPF router can set forwarding-address to something other than itself which indicates that alternate nexthop is possible. Mostly forwarding address is set to 0.0.0.0 suggesting that the route is reachable only via the advertising router.
Forwarding address is set in LSA, if following conditions are met:
- OSPF must be enabled on next-hop interface
- Interface is not passive
- Interface is not p2p or p2mp
- Next-hop address falls into network provided in ospf networks
So knowing conditions, we can make router R1 to set forwarding address. We simply need to add 10.1.101.0/24 network to OSPF networks in router's R1 configuration:
/routing ospf network add network=10.1.101.0/24 area=backbone
Now lets verify that forwarding address is actually working:
[admin@R2] /ip route> print Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, B - blackhole, U - unreachable, P - prohibit # DST-ADDRESS PREF-SRC GATEWAY DISTANCE ... 8 ADo 192.168.0.0/24 10.1.101.1 110
On all OSPF routers you will see LSA set with forwarding address other than 0.0.0.0
[admin@R2] /routing ospf lsa>print detail instance=default area=external type=as-external id=192.168.0.0 originator=10.1.101.1 sequence-number=0x80000073 age=16 checksum=0x8510 options="E" body= netmask=255.255.255.0 forwarding-address=10.1.101.1 metric=30 route-tag=0x0 type1