Client VPN (Nord) - Migrating from IKEv2/IPSEC to Wireguard

Hey Folks,

I was looking for some feedback on moving from IPSEC to Wireguard when using the VPN as a client.

I have my Mikrotik acting as an IKEv2 client, with perma-vpn to Nord (with associated blackhole config)

This has been working well for a while, but I occasionally get issues where the tunnel will hang and will need me to flush SAs to restore service - this is becoming bothersome of late

I am currently running v6.49.4 on a Hex S.

I can see that there is v6.49.7 but as the notes mention nothing about IPSEC, so I suspect upgrading may not help.

I have previously tried on v 7.x but the same IPSEC config that I have in v6.xx did not seem to work (it was a while ago, so I forget why exactly, and this therefore may be somewhat anecdotal). I found the Wireguard setup confusing and gave up.

Ive found a few posts - eg https://medium.com/@sruffilli/a-vpn-roadwarrior-setup-with-wireguard-and-mikrotik-routeros-6d42ca204c21 - which seem to cover this but before I undertake it it would be great to hear some success stories or any best practices.

My goal is to replicate what I have for the IPSEC setup, using Wireguard. That is quite simple:

  • ALL traffic on local subnets behind the Mikrotik MUST go over the VPN at all times
  • Traffic to be blackholed if VPN is down

If I Upgrade to v.7.6 should it be expected that my current config will remain working? My config is fairly streamlined:

[admin@MikroTik] > export hide-sensitive
# software id = RVJQ-3EWZ
#
# model = RB760iGS
/interface bridge
add name=blackhole
add admin-mac=xx:xx auto-mac=no comment=defconf name=bridge
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/ip ipsec mode-config
add name=NordVPN responder=no src-address-list=local
/ip ipsec policy group
add name=NordVPN
/ip ipsec profile
add enc-algorithm=aes-128 hash-algorithm=sha256 name=NordVPN
/ip ipsec peer
add address=xxxxx.nordvpn.com exchange-mode=ike2 name=NordVPN profile=NordVPN
/ip ipsec proposal
set [ find default=yes ] disabled=yes
add auth-algorithms=sha256 name=NordVPN pfs-group=none
/ip pool
add name=dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=dhcp disabled=no interface=bridge name=defconf
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=sfp1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=192.168.88.0
/ip dhcp-client
add comment=defconf disabled=no interface=ether1
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall address-list
add address=192.168.88.0/24 list=local
add address=192.168.88.2-192.168.88.254 list=local-range
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related \
    disabled=yes
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface-list=WAN
/ip firewall mangle
add action=mark-connection chain=forward ipsec-policy=out,ipsec new-connection-mark=ipsec
add action=mark-connection chain=forward ipsec-policy=in,ipsec new-connection-mark=ipsec
add action=mark-routing chain=prerouting new-routing-mark=via-vpn passthrough=yes src-address-list=local
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" disabled=yes ipsec-policy=out,none \
    out-interface-list=WAN
/ip ipsec identity
add auth-method=eap certificate=root.der_0 eap-methods=eap-mschapv2 generate-policy=port-strict mode-config=NordVPN \
    peer=NordVPN policy-template-group=NordVPN username=xxxxxxxxxxx
/ip ipsec policy
set 0 disabled=yes
add action=none dst-address=192.168.88.0/24 src-address=0.0.0.0/0
add disabled=yes dst-address=0.0.0.0/0 group=NordVPN proposal=NordVPN src-address=0.0.0.0/0 template=yes
add dst-address=0.0.0.0/0 group=NordVPN proposal=NordVPN src-address=0.0.0.0/0 template=yes
/ip route
add distance=1 gateway=blackhole routing-mark=via-vpn
/system logging
set 3 action=memory
add topics=ipsec

I seem to recall the issue was with the connection marking in v7?

Many Thanks

Yes straightforward.

  1. Correct wireguard settings..
  2. Firewall rules (input, forward and sourcenat)
  3. Routing ( table, route, routing rule )

Check out and especially para 7 - https://forum.mikrotik.com/viewtopic.php?t=182340

You will need to upgrade to vers 7.6
give it a try and if have issues report back with.

/export file=anynameyouwish ( minus router serial number and any public WANIP information )
and the settings vpn third party gave you ( use fake numbers or letter to represent numbers etc… )

Thanks for this, that guide is fantastic!

Sadly I have hit an issue immediately. In trying to upgrade to v7 my router did not come back to service and no amount of attempts to reset is letting me regain access to my Hex S

This is weird because:

  1. I have upgraded, and downgraded, before
  2. I’ve reset before and been able to regain access

I should have tried my spare hAP first :frowning:

Are there any changes to defaults for v7.x? I really dont understand why I can’t get access again. Ive tried setting IP manually etc

Use WinBox to connect to router’s MAC address. And when you get in, check 1) in http://forum.mikrotik.com/t/routing-mark-and-route-traffic-to-a-different-gw/160754/4

Thanks, I was able to restore access, suspected I needed Winbox, just meant using a windows machine :slight_smile: I’ve rolled back to v6 stable

I will research and test the Wireguard setup on another machine. It’s very tricky to navigate Wireguard plus the breaking changes to my current config when upgrading to V7.

The frustrating aspect of this is, is that I am not upgrading for performance..the performance is just fine via the Hex S - rather to try and solve the IPSEC SA issue once and for all! I will look to troubleshoot this aspect further in another thread though