# OSPF Route Leaking Between VRF's

**URL:** <https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105>\
**Category:** RouterOS\
**Created:** [June 25, 2025, 5:09am UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105 "2025-06-25T05:09:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [June 25, 2025, 5:09am UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/1 "2025-06-25T05:09:11Z")

</div>

i am getting owned trying to do dynamic route leaking between vrf’s using ospf. this is routeros 7.18.  
for a basic topology:  
i have created bridge1 interface in vrf1, ip address 192.168.1.1/24  
i have created bridge2 interface in vrf2, ip address 192.168.2.1/24  
i have attached a sub-interface to bridge1, also added to vrf1, ip address 10.0.0.1/29  
i have attached a sub-interface to bridge2, in vrf2, ip address 10.0.0.2/29

now the ospf part is not that technical. the issue is, i am trying to form a neighborship on the 10.0.0.0/29 network, and failing. cause somehow, the two vlan interfaces on 10.0.0.0/29 can’t talk to each other on the ospf broadcast address.

how do i achieve this last leg? adding each sub-interface to a bridge results in nothing helpful at all. somehow, i need l2 connectivity between the two sub-interfaces.

is this doable in routeros?

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [June 25, 2025, 6:40am UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/2 "2025-06-25T06:40:25Z")

</div>

Make a network diagram and show whatever configuration you currently have so that others can jump start to check your config and might be able help you in the process, specially VRF has few quirks and limitation in Mikrotik land haha

EDIT: additional tip please define your clear goals it is somehow messed up honestly

---

<div class="post-metadata">

**Author:** ![StubArea51](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/stubarea51/32/54632_2.png) [@StubArea51](https://forum.mikrotik.com/u/StubArea51)\
**Post date:** [June 27, 2025, 12:38pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/3 "2025-06-27T12:38:04Z")

</div>

You might want to try a “hairpin” physical cable first between port in different VRFs to see if the OSPF portion will work. Not sure if routeros will form an adjacency with itself. ROSv6 had issues with this, but i’ve not tried it in ROSv7.

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 6:24pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/4 "2025-07-01T18:24:18Z")

</div>

> [@StubArea51](#):
>
> You might want to try a “hairpin” physical cable first between port in different VRFs to see if the OSPF portion will work

yes it does

> [@StubArea51](#):
>
> Not sure if routeros will form an adjacency with itself.

yes it will. thanks for dropping by 👍

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:08pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/5 "2025-07-01T19:08:25Z")

</div>

I thought the requirement is hazy when I see Kevin reply and re-read it was me who doesn’t understand the question and I try to lab it yeah it works it form an adjacency to it’s own now my question is what is the circumstance that you are doing this in real world setting? I really enjoy it looking forward to hear from both of you 🙂

 ![image](https://data-discourse.cdn.mikrotik.com/original/3X/b/7/b77c326d9e8bd91f857f648036e6a23c488a2040.png)

 ![image](https://data-discourse.cdn.mikrotik.com/original/3X/0/7/079cbf37ce72d7e681cad6e71f23791a451b02f5.png)

 ![image](https://data-discourse.cdn.mikrotik.com/original/3X/3/f/3f0cf0844d4ffeee4d850b84a2e5d01ef4dc7c12.png)

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:24pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/6 "2025-07-01T19:24:18Z")

</div>

I think I got one scenario if you are an SP and want to provide multitenancy for customers 🙂 hahaha or you want to create an isolated lab the possibility is endless.

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 7:25pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/7 "2025-07-01T19:25:11Z")

</div>

> [@loloski](#):
>
> now my question is what is the circumstance that you are doing this in real world setting?

fell free to laugh, but basically, bgp-vpn is still above my head as i’m learning networking, and a physical cable to do ospf isn’t. so there you go 🙂

and basically, it’s as the title suggets, i was trying to get an easier way to do route leaking between vrfs. a hairpin cable on the appliance might be amusing, but it gets the job done until i learn to do better.

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:27pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/8 "2025-07-01T19:27:48Z")

</div>

Don’t get me wrong, I really enjoy this thread because it’s broaden my horizon I laugh not because of you it’s me who didn’t think outside of the box, I’m sorry if you feel offended i didn’t mean to, peace out!

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 7:31pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/9 "2025-07-01T19:31:51Z")

</div>

> [@loloski](#):
>
> I’m sorry if you feel offended i didn’t mean to, peace out!

no worries! maybe you could even help me with the correct syntax for only advertising only certain routes into vrf1 😁 cause right now, ospf is advertising everything and not obeying my filter rule of  
`if (dst == 10.1.60.0/23) { accept;} else{reject;} ` for some reason. i’m trying to do Out-Filter with it.

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:32pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/10 "2025-07-01T19:32:59Z")

</div>

VRF route leaking is freaking awesome if you grasp the concept, it was really confusing at first but this is very powerful if you want to slice and dice the hardware

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 7:33pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/11 "2025-07-01T19:33:22Z")

</div>

it’s a must if you want to slice and dice hardware.

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:34pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/12 "2025-07-01T19:34:38Z")

</div>

> [@ptsch](#):
>
> if (dst == 10.1.60.0/23) { accept;} else{reject;}

is this exact match or you might need dst in ? what you are trying to achieved?

if I were you i’ll go this way

if (dst == 10.1.60.0/23) { reject; } accept;

so if doesn’t match your criteria no harm done it will announce the prefix, it was easier to debug this way

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 7:40pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/13 "2025-07-01T19:40:19Z")

</div>

> [@loloski](#):
>
> what you are trying to achieve

i am trying to only advertise exactly that route into vrf1, from the main ospf area.

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 7:47pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/14 "2025-07-01T19:47:33Z")

</div>

> [@loloski](#):
>
> so if doesn’t match your criteria no harm done it will announce the prefix, it was easier to debug this way

i need that flipped though. i only want that one network advertised.

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:49pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/15 "2025-07-01T19:49:46Z")

</div>

> [@loloski](#):
>
> if (dst == 10.1.60.0/23) { reject; } accept;

# try this first

if (dst in 10.1.60.0/23) { accept; } reject;

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 7:53pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/16 "2025-07-01T19:53:17Z")

</div>

> [@loloski](#):
>
> if (dst in 10.1.60.0/23) { accept; } reject;

absolutely nothing happens with i apply it to an instance as a filter-out rule, nor if i apply it to an instance as a filter-in rule.

i wonder if it’s because i’m using ospf to have the router peer with itself and something is going wonky.

or maybe it has something to do with going interarea?

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:54pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/17 "2025-07-01T19:54:29Z")

</div>

> [@loloski](#):
>
> 10.1.60.0/23

I will reproduce your issue and update you once i have something

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 7:56pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/18 "2025-07-01T19:56:34Z")

</div>

> [@loloski](#):
>
> if (dst in 10.1.60.0/23) { accept; } reject;

ok i also applied the rule to a second router in a totally different area, as a filter-in rule, and it had no effect.

---

<div class="post-metadata">

**Author:** ![loloski](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/loloski/32/55501_2.png) [@loloski](https://forum.mikrotik.com/u/loloski)\
**Post date:** [July 1, 2025, 7:59pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/19 "2025-07-01T19:59:42Z")

</div>

> **[Virtual Routing and Forwarding - VRF - RouterOS - MikroTik Documentation](https://help.mikrotik.com/docs/spaces/ROS/pages/328206/Virtual+Routing+and+Forwarding+-+VRF#VirtualRoutingandForwardingVRF-DynamicVrf-Literouteleaking)**

Did you read this?

---

<div class="post-metadata">

**Author:** ![ptsch](https://forum.mikrotik.com/letter_avatar/ptsch/32/6_449c533f586939b6e5f246632a46421f.png) [@ptsch](https://forum.mikrotik.com/u/ptsch)\
**Post date:** [July 1, 2025, 8:01pm UTC](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105/20 "2025-07-01T20:01:58Z")

</div>

yes. the vrf part is working. i have traffic flow everywhere.

it’s the route filtering i am having a problem with. and even watching the official mikrotik youtube on ospf, and following the route filtering section, i’m not having any luck.

[Next page](https://forum.mikrotik.com/t/ospf-route-leaking-between-vrfs/262105.md?page=2)
