Hello ,
I am new .
I buy 2 routers hap ac2 and upgraded both to 6.45.6 os.
I try everry tutorial on the internet to set ipsec site to site but no one of this tutorial work.
So if you have time pls make a tutorial IPSEC site to site on version 6.45.6 step by step if its posible with pictures. - > talk a lot
Thank you all.
When you can start from scratch and do not need compatibility with another existing setup, do yourself a favor and skip the IPsec site-to-site tunnel setup.
It is possible to get it working but it is SO MUCH easier to do it this way:
make sure both sides have a different LAN range, not both the default 192.168.88.0/24! Change one to 192.168.188.0/24 for example.
create GRE interface at each end with IPsec secret set to the same (long random) value
add different IP address at each end in a network range that you are not yet using, like 10.0.0.1/30 and 10.0.0.2/30
add routes for the remote side that use this address as gateway, like 192.168.88.1/24 with gateway 10.0.0.1
That will just work, and it will be extendable to multiple sites and multiple network ranges, and no tricks with NAT required.
But it’s impossible to make it work, Mikrotik tutorials are always incomplete, and extremely frustrating
All I’m trying to do is a very simple VPN site-to-site with two Mikrotik routers. But the tutorial ignores Mikrotik default firewall rules. I suspect something in the default firewall configuration is blocking access, but I don’t know what.
Could you please post which lines do we have to add to obtain a working site-to-site VPN between two Mikrotik HAP AC2 routers in their default configuration??
The default firewall configurations differ for different RouterOS releases, so it is better to post the configuration export.
For IPsec itself, you have to permit, at responder side, inbound connections to UDP port 500 and for ESP if there is no NAT between the peers; if there is NAT, connections to UDP ports 500 and 4500 must be permitted and permitting ESP is not necessary.
So one or both rules below, as explained above, must be placed just before (above) the last action=drop rule in chain input: chain=input protocol=udp dst-port=500,4500 src-address=ip.of.remote.peer action=accept
chain=input protocol=ipsec-esp src-address=ip.of.remote.peer action=accept
Handling of GRE in firewall got broken by a security patch in 6.45.something, so if you don’t have a strong reason to use GRE, use an IPIP tunnel instead. It has less overhead and it causes less headache. If you don’t disable the keepalive functionality of the IPIP interface, you don’t need to add any firewall rule for the IPIP protocol; otherwise, add chain=input protocol=ipencap ipsec-policy=in,ipsec action=accept
right before or right after the rule(s) mentioned above.
Ah, yes, you forgot to exempt the traffic between 192.168.99.1 and 192.168.99.2 from the masquerade rule, so it gets src-nated and the IPsec policy cannot see it.
Add a rule src-address=192.168.99.0/30 dst-address=192.168.99.0/30 chain=src-nat action=accept before (above) the masquerade one at both devices. Then either disable the tunnel interfaces at both devices and wait 10 minutes before re-enabling them, or issue /ip firewall connection remove [find protocol=gre] (or protocol=ipencap in case of IPIP tunnel).
Yes, you’re right. Adding that rule and restarting both routers solved the problem!
I’ve been able to go back to GRE tunnels, and they work correctly too!!
I understand that GRE tunnels have more overhead than IPIP, but they support IPv6. To be honest, I don’t really need IPv6 right now, but I suppose it’s better to configure GRE tunnels to be “future proof” whenever I need IPv6 some day.
Anyway, thanks a lot. I get frustrated a lot with the current (old) Mikrotik wiki. I understand that all the information is there, but it’s spread out in different chapters and very difficult to find. It’s extraordinarily difficult for newbies!
@pe1chl, the issue was different - it’s the transport (GRE or IPIP) packets that got src-nated, not the payload ones. The transport ones are routed via the WAN before the policy diverts them.
Ok… I don’t understand why the external addresses of the GRE tunnels were set to a NAT’ed address, I always set those to the external address of the router.
Of course this method may be more convenient when the external address is not fixed.
Yes, tunnel mode of the IPsec encapsulation allows to use fixed internal addresses as GRE/IPIP endpoint ones whilst the WAN address of at least the initiator keeps changing. The price to pay is the extra IP header, consuming part of MTU, so less space in the transport packet remains for the payload.