OSPF between VyOS and Mikrotik via Wireguard

Hello everyone. I need help. I have a VyOS which is receiving multiple tunnels. The task is to connect another Mikrotik there. I have successfully established a connection through wireguard. Routers ping each other. VyOS sees the neighbor. Mikrotik sends Hello every two seconds. But it does not receive Hello in response. And neighborly relations are not established. On Mikrotik, all traffic through the Wireguard interface is completely open. On VyOS, no firewall rule is bound to the wireguard interface.
I tried the point -to-point network option and tried the broadcast network option. It did not help establish the neighborhood. Please check the configuration and point me to the error:

set interfaces wireguard wg01 address ‘10.1.0.1/30’
set interfaces wireguard wg01 description ‘VPN-to-wg02’
set interfaces wireguard wg01 ip ospf authentication plaintext-password ‘ospf’
set interfaces wireguard wg01 ip ospf bfd
set interfaces wireguard wg01 ip ospf cost ‘10’
set interfaces wireguard wg01 ip ospf dead-interval ‘6’
set interfaces wireguard wg01 ip ospf hello-interval ‘2’
set interfaces wireguard wg01 ip ospf network ‘point-to-point’
set interfaces wireguard wg01 ip ospf priority ‘0’
set interfaces wireguard wg01 ip ospf retransmit-interval ‘5’
set interfaces wireguard wg01 ip ospf transmit-delay ‘1’
set interfaces wireguard wg01 peer to-wg02 allowed-ips ‘192.168.5.0/24’
set interfaces wireguard wg01 peer to-wg02 allowed-ips ‘10.1.0.0/30’
set interfaces wireguard wg01 peer to-wg02 pubkey ‘xxxxxxxxxxxxxxxxxxxxxxx=’
set interfaces wireguard wg01 port ‘51820’
set policy route-map CONNECT rule 10 action ‘permit’
set policy route-map CONNECT rule 10 match interface ‘wg01’
set protocols ospf passive-interface-exclude ‘wg01’
set protocols static interface-route 192.168.5.0/24 next-hop-interface wg01

VyOS sets the interface-type to ptp automatically on wireguard interfaces.
RouterOS does not.

Try this:

/routing ospf interface-template
add area=ospf-area-1 interfaces=wg1 type=ptp

I am using 0.0.0.0/0 as allowed IPs, because I dont know what networks I will receive from the other end. I am not sure, but maybe you need to add the multicast addresses to allowed-IPs, because otherwise wireguard wont be allowed to send packets with ospf-multicast address out of that wireguard interface.

Thanks a lot for the tip. Indeed, there was not enough broadcast address on both ends of the tunnel. I did two things:
1.allowed both sides of the “allow-network” 224.0.0.5/32
2.network type chose “broadcast” from two sides
and my Mikrotik saw a neighbor.
In this case, both routers have Neighbor status in “2-Way/DROther” state. But dynamical routes do not distribute :frowning:
If I set the network type to “point-to-point” on both sides, the storm starts at both router: dynamic routes appear and disappear, ping to WAN and ping to the ospf-Peer disappears and resumes. But the Neighbor status excellen - “Full DROther” :slight_smile:
Thus, the question is: How to fix the storm?

I think you should be using `“allow-network” 224.0.0.4/30`` , it’s because ospf use 224.0.0.5 and 224.0.0.6 or you can configure “allow-network” 0.0.0.0/0. Please it’s possible to check if both have the same area (0.0.0.0 in your case) and if there aren’t any fw rules that block this traffic.

Do you get a default route from the other side? It might effectively kill the tunnel. Then OSPF default route disappears, and tunnel will re-establish. And on and on 


Thanks, I’ve corrected the error. But it didn’t solve the problem.

No I don’t. Only 10.x.x.x and 172.x.x.x

I am sorry. I distributed “Static” and “Connected” routes at my OSPF-Instance in Redistributed section of Mikrotik. That was the problem with the neighborhood drop. I checked the “VPN” checkbox instead and it worked.
Thank you all for your participation and replies.

Finally, allowed-networks on WireGuard-interface of my Mikrotik look like this:
10.1.0.0/30 - wireguard
224.0.0.4/30 - broadcast
172.20.0.0/24 - branch offices

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.