NordVPN IKEv2

Hi,

I’m very new to Microtik and trying to get a NordVPN connection up and running on my Hex following Nord’s own tutorial on the subject. I have the following config:

# jun/29/2023 20:14:41 by RouterOS 6.49.7
# software id = DNSC-DX1W
#
# model = RB750Gr3
# serial number = XXXXXXXXX
/interface bridge
add admin-mac=18:FD:74:74:08:BC auto-mac=no comment=defconf name=bridge
/interface pppoe-client
add add-default-route=yes dial-on-demand=yes disabled=no interface=ether1 \
    max-mru=1492 max-mtu=1480 name=pppoe-out1 use-peer-dns=yes user=\
    xxxxx
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip ipsec mode-config
add name=NordVPN responder=no src-address-list=local
/ip ipsec policy group
add name=NordVPN
/ip ipsec profile
add dh-group=modp3072 enc-algorithm=aes-256 hash-algorithm=sha384 name=\
    NordVPN
/ip ipsec peer
add address=uk2003.nordvpn.com exchange-mode=ike2 name=NordVPN_uk2003 \
    profile=NordVPN
/ip ipsec proposal
add auth-algorithms=sha256 enc-algorithms=aes-256-cbc name=NordVPN pfs-group=\
    none
/ip pool
add name=dhcp ranges=192.168.1.10-192.168.1.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
/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
add interface=pppoe-out1 list=WAN
/ip address
add address=192.168.1.1/24 comment=defconf interface=bridge network=\
    192.168.1.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=192.168.1.0/24 comment=defconf dns-server=192.168.1.1 gateway=\
    192.168.1.1 netmask=24
/ip dns
set allow-remote-requests=yes servers=8.8.8.8
/ip dns static
add address=192.168.1.1 comment=defconf name=router.lan
/ip firewall address-list
add address=192.168.1.0/24 list=local
/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
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 nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN src-address=!192.168.1.0/24
add action=masquerade chain=srcnat out-interface-list=WAN
/ip ipsec identity
add auth-method=eap certificate="" eap-methods=eap-mschapv2 generate-policy=\
    port-strict mode-config=NordVPN peer=NordVPN_uk2003 \
    policy-template-group=NordVPN username=xxxxxxxxxxxxxxxxxxxxxx
/ip ipsec policy
add dst-address=0.0.0.0/0 group=NordVPN proposal=NordVPN src-address=\
    0.0.0.0/0 template=yes
/system clock
set time-zone-name=Europe/Madrid
/system identity
set name=RouterOS
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN

The tunnel comes up successfully with the two SAs, and the firewall rule gets added as expected. But I end up with no internet connectivity from anywhere in the LAN. I’m guessing there’s some interaction with the PPPoE settings but I’m really a bit of a networking novice :frowning:

After reading this thread: http://forum.mikrotik.com/t/nordvpn-client-ipsec-mikrotik/163251/4 I tried disabling the fastrack firewall rule, but that doesn’t seem to have helped.

Any tips on where to look for more debugging info/what might be the problem gratefully appreciated!

Is there no internet connectivity from the router as well?

Hmm, this is less clear-cut than I realised. If I configure the ipsec mode-config to point to an address list with a single address (my test machine on the LAN), then all other machines on the LAN can access the internet fine, but from the test machine I can no longer load any web pages. However, it turns out that I can still ping 8.8.8.8, and more interestingly, I can still do

 dig @8.8.8.8 www.yahoo.com

just fine. If I set the address list of the mode-config to be the LAN address range (192.168.1.0/24) then no machines on the local network can load stuff on the internet, but everything can still ping and do DNS lookups.

I can

 /tool fetch url="https://www.bbcode.org/reference.php"

from the router just fine even when I have the full LAN address range configured to go through the ipsec tunnel.

I don’t know if it makes a difference (it shouldn’t, I don’t think) but my ISP is double-NATing me. The Microtik router is connecting via PPPoE. It feels like there’s just some daft routing/firewall interaction going on but my networking-fu is too weak to see what it is.

One possibly connected thing: my router appears to have several addresses as a function of the PPPoE setup. Here’s the routing table without any VPN enabled:

 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADS  0.0.0.0/0                          pppoe-out1                1
 1 ADC  10.6.0.7/32        10.6.0.7        pppoe-out1                0
 2 ADC  192.168.1.0/24     192.168.1.1     bridge                    0
 3 ADC  192.168.207.1/32   92.119.74.178   pppoe-out1                0

and here’s the address list

 0   ;;; defconf
     192.168.1.1/24     192.168.1.0     bridge                                                                                                                                                                                   
 1 D 92.119.74.178/32   192.168.207.1   pppoe-out1                                                                                                                                                                               
 2 D 10.6.0.7/32        10.6.0.7        pppoe-out1

It’s not clear to me how i have a public address of 92.119.74.178 attached to a private network block (192.168.207.1). I have no idea what the 10.6.0.7 address is about. I can’t ping or traceroute that. It doesn’t seem to affect anything.

Do lan machines resolve dns when pointed to the dns server running on the router after ipsec is established? Can they reach router at all?

What are the policies and nat rules that are added after ipsec is established?

Local machines can talk to the router just fine - I can access the web interface and resolve DNS against the router’s DNS server.

Here’s the output of “/ip ipsec policy print” once the ipsec is established:

#      PEER                             TUNNEL SRC-ADDRESS                   DST-ADDRESS                   PROTOCOL   ACTION  LEVEL    PH2-COUNT
 0 T  *                                         ::/0                          ::/0                          all       
 1 T                                            0.0.0.0/0                     0.0.0.0/0                     all       
 2 DA  NordVPN-uk2216                   yes     10.6.0.7/32                   0.0.0.0/0                     all        encrypt unique          1

and here’s “/ip firewall nat print”

Flags: X - disabled, I - invalid, D - dynamic 
 0  D ;;; ipsec mode-config
      chain=srcnat action=src-nat to-addresses=10.6.0.7 src-address-list=local dst-address-list=!local 

 1    ;;; defconf: masquerade
      chain=srcnat action=masquerade src-address=!192.168.1.0/24 out-interface-list=WAN log=no log-prefix="" ipsec-policy=out,none 

 2    chain=srcnat action=masquerade out-interface-list=WAN

In case it’s relevant, here’s “/interface list member print detail”:

Flags: X - disabled, D - dynamic 
 0   ;;; defconf
     list=LAN interface=bridge dynamic=no 

 1   ;;; defconf
     list=WAN interface=ether1 dynamic=no 

 2   list=WAN interface=pppoe-out1 dynamic=no

Why is there 3 NAT rules? Specifically the 3rd rule doesn’t seem right.

Hmm, yeah, that does seem wrong now that I look it again. The one that looks wrong to me is actually the 2nd one - because it has a “!” at the front, which doesn’t make sense to me. I have updated them and now I have this:

 0  D ;;; ipsec mode-config
      chain=srcnat action=src-nat to-addresses=10.6.0.7 src-address-list=work-machine dst-address-list=!work-machine 

 1    ;;; defconf: masquerade
      chain=srcnat action=masquerade src-address=192.168.1.0/24 out-interface-list=WAN log=no log-prefix="" ipsec-policy=out,none

It still works correctly without the ipsec enabled (in which case obviously the first NAT rule above disappears), but sadly it still doesn’t work with ipsec enabled :frowning:

The other thing that seemed a bit odd was the fact that both ether1 and pppoe-out1 were part of interface-list “WAN” which seems a bit misleading given that the default masquerade NAT rule references this as out-interface-list. So I changed that to only include pppoe-out1 but I don’t think it made any difference.

One final thing that seems odd to me but might be just a misunderstanding about how this is supposed to work: when I list the active peers, the nordvpn server appears as expected, but the “dynamic address” field is empty. I would have expected this to contain the same 10.6.0.7 address that is assigned by the responder and which appears in the ipsec policy and the dynamically generated firewall NAT rule. Could this be the problem?

Could it be an MTU issue? Can you play with the ping tool using the do-not-fragment flag to discover the largest MTU that cat reach 8.8.8.8 from the work-marchine after IPsec tunnel is up?

Here is a discussion of the issue with NordVPN in more detail, specifically replies by @sindy toward the end.

Interesting! Without the tunnel I can send packets of 1450 (1478 with the frame); if I go over that it tells me the message is too long. With the tunnel enabled, the maximum I can send is 1370 (1398). If I go over that, it doesn’t give me an error, but I get no response back (100% packet loss). So maybe this is an MTU issue like you say. I will have a read through that thread and try the suggested solution

is normal MTU tunnel to be lower because of additional encapsulation/headers

Right, so in the end what worked was the change-mss mangle rule suggested in this post: http://forum.mikrotik.com/t/nordvpn-ipsec-ikev2-killswitch-for-ros6/144817/24

Now it all works, which is great. I get the Nord server public ip address from all my LAN machines. Sadly, i’m still getting geo-blocked by some of the services that I’d hoped to use. This is frustrating because using the native nordvpn client to setup a tunnel on an individual machine works fine with these services. Ah. I do appear to have a DNS leak. I have google DNS servers showing up :frowning: Thanks for all the help so far!