IPSec and routing

Hello. I’m new to Mikrotik and asking your advice about the small issue I’m testing now. There is a problem with routing, as far as I got.

I have 2 Mikrotik routers and IPSec tunnel between them. For example.

Mikrotik1

ether-wan: 5.5.5.5
ether-lan: 192.168.1.1
network: 192.168.1.0/24

Mikrotik2

ether-wan: 6.6.6.6
ether-lan: 192.168.2.1
network: 192.168.2.0/24

This IPSec works fine. Both routers and their networks are available for each other. But… There is also the third router.

Cisco1

ether-wan: 7.7.7.7
ether-lan: 192.168.3.1
network: 192.168.3.0/24

Routing between Cisco1 and Mikrotik1 is fine, the networks are available.

The question is… How can I make routing between Cisco1 and Mikrotik2? I tried many various options but no success.

I tried to find the probem in the firewall logs of Mikrotik1. For example, what I got while pinging 192.168.2.2 from 192.168.3.2.


forward: in:ether-lan out:ether-wan, src-mac xx:xx:xx:xx:xx:xx, proto ICMP (type 8, code 0), 192.168.3.2->192.168.2.2, len 60

I’d appreciate if you could help me with advice. Thank you.

You’re silent regarding the tunnel between the Cisco and the Mikrotik 1, and also regarding the exact type of tunnel between the two Mikrotiks (i.e. bare IPsec with policies or some IPsec-encrypted tunnel like GRE or IPIP).

So if you are using IPsec policies, you have to add 192.168.1.0/24<->192.168.3.0/24 policies to both tunnels (i.e. M1-M2 and M1-C). If you are using some IPsec-encrypted tunnel, you have to add routes.

Or, if all three routers have a public IP, you can create a direct tunnel M2-C.

Thank you for the response. Everything is unfortunately more complicated and I want to simplify it to get the logic.
Mikrotik1 is virtual CHR on the host with 2 interfaces. It’s not the only gateway in its network and it has the connection with Cisco1 via fiber trunk via another Cisco2.

Cisco2

ether-wan: 5.5.5.6
ether-lan: 192.168.1.254
network: 192.168.1.0/24

Mikrotik2 is hardware and distant. All the routers have their own public static IP-addresses. Technically in the future, Mikrotik1 might be an IPSec gateway for many other Mikrotik routers: Mikrotik2, Mikrotik3 .. Mikrotikn. All I want to get how to make the proper routing between Cisco1 network and Mikrotik2 network where Mikrotik1 is the gateway.

I got from the logs that Mikrotik1 if forwarding packets from Cisco1 to Mikrotik2, but there is no ping because Mikrotik2 doesn’t respond.

OK, so there is no kind of tunnel between Cisco 1 and Mikrotik. But you still haven’t explicitly stated whether the tunnel betewen Mikrotik 2 and Mikrotik 1 is a bare IPsec one, using traffic selectors of policies to elect packets for tunneling, or whether it is the “some-other-tunnel-over-IPsec” case.

In any case - what you describe may be an issue of

  • firewall rules at Mikrotik 2 - if so, it receives the traffic from the Cisco subnets but drops it
  • missing IPsec policies or routes at Mikrotik 2 - if so, Mikrotik 2 receives the traffic and would like to respond it, but there is either no route towards the source of that traffic, so it cannot send the response at all, or there is a route (the default one) but a policy that should intercept it and redirect it to the bare IPsec tunnel is missing, so the response goes to the internet rather than back to Mikrotik 1.
  • missing routes/policies at Mikrotik 1 - you say the log shows it forwards the traffic towards Mikrotik 2 but I cannot remember any log to indicate that a packet has been sent via an IPsec SA

If the above tips still don’t help resolve it, post the exports of both Mikrotik 1’s and Mikrotik 2’s configurations, following my automatic signature below.

Yes, it’s bare IPSec-tunnel between Mikrotik1 and Mikrotik2. I think I’ve already tried everything in the last four days and found no problem in routes, firewall or policies, but it still doesn’t work as it should be. I’d rather try another solution from another manufacturer.

Thank you for the response anyway.

This kind of network is very difficult to get right using bare IPsec tunnels. A mixed manufacturer situation potentially makes it even more difficult.
When you would use GRE/IPsec or IPIP/IPsec it would be easy, also with even more sites.
However, there appear to be lots of masochistic people in the IPsec tunnel world… (there is another thread running at this time with the same topic)

Since there is no IPsec interworking between manufacturers, it must be something easy yet hard to spot. Post the actual configurations of both Mikrotiks and the actual subnets of the two Ciscos for a review. See my automatic signature below regarding obfuscation that doesn’t break consistency. And as @pe1chl says, bare IPsec may hit you many ways, so since the idea is to connect routers, not end devices, to Mikrotik 1, you should also consider IPIP or GRE over IPsec.

Thank you, buddies. Routing through GRE over IPSec works fine. It doesn’t work with pure IPSec, but now I don’t even want to know why.

Good! GRE (or IPIP) over IPsec is the way to go for tunneling over multiple hops.