How to Configure a WireGuard VPN Connection to NordVPN on a Mikrotik Router Running ROS v7.x

@anav
Hey can I get some help as well please?

Im really noob and Im really lost what I`m missing in this guide.

The is that traffic will not go trough the VPN if I change my WAN to the VPN in Interface List I have internet on my router but no internet on my PC.

Here is the information for the VPN that I`m trying to connect to too:

[Interface]

Device: Master Tuna

PrivateKey = *******************&=
Address = 10.74.219.199/32,fc00:bbbb:bbbb:bb01::b:dbc6/128
DNS = 100.64.0.7

[Peer]
PublicKey = JEDqyG7iGjy/rYsE/9H7y0Sz8Sl+KWYYUvkPG7NnCjk=
AllowedIPs = 0.0.0.0/0,::0/0
Endpoint = 193.19.207.225:51820

Myconf.rsc (7.9 KB)

  1. An important step is to ensure you sourcenat your local users going to MULLVAD (oops discovered its only one address, something you failed to mention!!!). Remember they are expecting to ONLY see an IP of 10.74.219.199. Therefore add the following:

EDIT: Not required, I see later on down you made a separate entry for source nat for wireguard and thats fine too!! Well done.

  1. Change your persistent keep alive to something like 30s, 5s is unnecessarily short.

  2. Not sure why your ip address ( in wrong format anyway ) is so different from your assigned address, (why the heck did use 10.5.0.2?? Fix your VPN address setting to the following:
    /ip address
    add address=192.168.88.1/24 comment=defconf interface=bridge network=
    192.168.88.0
    add address=10.74.219.2/24 interface=wg-Mullvad network=10.74.219.0

  3. Assuming you want all users to go out MULLVAD?? okay now I see its only one address, so do this:

  4. Change your dns settings to
    /ip dns
    set servers=8.8.8.8,1.1.1.1,100.64.07

  5. Remove the static IP DNS setting completely.

  6. Why is this rule here… there is no such subnet???
    add address=192.168.1.0/24 list=access_vpn ???

  7. This is just plain wrong, you are using mullvad not nordvpn LOL
    /ip firewall mangle
    add action=change-mss chain=forward comment=
    “Clamp MSS to PMTU new-mss=clamp-to-pmtu out-interface=wg-nordvpn”
    protocol=tcp tcp-flags=syn

In any case use the following instead:
/ip firewall mangle
*add action=change-mss chain=forward new-mss=1380 out-interface=wg-Mullvad protocol=tcp *
tcp-flags=syn tcp-mss=1381-65535

  1. As far as IP routes go, Im assuming you elected to go with default route=yes on the IP DHCP settings that are set to ether1, as I see no actual routes for local traffic,

When creating the wireguard address, the router creates a route for wireguard traffic, but we still need to make one for the special table, which we use to send people directly out wg vice the local WAN, However its a different table from MAIN table, and thus your use of distance difference makes no sense. Only valid for same table!!

/ip route
add dst-address=0.0.0.0/0 gateway=wg-Mullvad routing-table=private_route

What is missing is ensuring that the router knows where to send your DNS requests so an additional route is required:
/ip route
add dst-address=100.64.0.7 gateway=wg-Mulvad routing-table=main

  1. Your routing rules should look like the following
    /routing rule
    add action=lookup-only-in-table dst-address=192.168.88.0/24 table=main
    add action=lookup-only-in-table src-address=192.168.88.100 table=private_route

  2. Lastly before firewall rules, lets ensure your user gets directed for DNS to mullvad, no leakage out local WAN
    /ip firewall nat
    add chain=dstnat action=dst-nat in-interface-list=LAN src-address=192.168.88.100 dst-port=53
    protocol=udp to-address=100.64.0.7
    add chain=dstnat action=dst-nat in-interface-list=LAN src-address=192.168.88.100 dst-port=53
    protocol=tcp to-address=100.64.0.7

  3. FW Rules…
    /ip firewall filter
    add action=accept chain=input connection-state=established,related,untracked
    add action=drop chain=input connection-state=invalid
    add action=accept chain=input protocol=icmp
    add action=accept chain=input 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=fasttrack-connection chain=forward connection-state=established,related
    add action=accept chain=forward connection-state=established,related,untracked
    add action=drop chain=forward connection-state=invalid
    add action=accept chain=forward comment=“internet traffic” in-interface-list=LAN out-interface-list=WAN src-address=!192.168.88.100
    add action=accept chain=forward comment=“out wireguard” src-address=192.168.88.100 out-interface=wg-Mullvad
    add action=drop chain=forward comment=“drop all else”

Hey @anav
I can’t thank you enough for your invaluable assistance.
To respect your time, I started fresh and implemented your recommended configurations.

I successfully set up both NordVPN and Mullvad. I’ve attached the configuration files for your reference.

I bypassed this step since you asked (why the heck did use 10.5.0.2??)
Assign an IP Address to the Interface

/ip address add address=10.5.0.2 interface=wg-nordvpn network=10.5.0.0

Results:

NordVPN: The connection is established, and my machine has internet access. However, websites (WWW) are not loading, though everything else appears to be functioning well.

Mullvad: The tunnel is connected with a successful handshake, but I’m unable to access the internet through this interface despite my efforts. I reached out to Mullvad’s support, but they were unable to assist further due to their unfamiliarity with MikroTik.

Here is the information for Mullvad just for the sake of someone more experinced confirm if this will work with Mikrotik or not.

It is a month subscribsion, so I`m not worried to share the private key.

PrivateKey = mOHy7pucd/cleTMlrI3DewIBww6B+GLowwJUpylaLVY=
Address = 10.74.219.199/32,fc00:bbbb:bbbb:bb01::b:dbc6/128
DNS = 100.64.0.7

[Peer]
PublicKey = JEDqyG7iGjy/rYsE/9H7y0Sz8Sl+KWYYUvkPG7NnCjk=
AllowedIPs = 0.0.0.0/0,::0/0
Endpoint = 193.19.207.225:51820

I feel I’m nearly there lol
Please let me know if I shall open a new topic, so we don`t flood this one.

Thank you once more.
Mullvad.rsc (9.1 KB)
NordVPN_conf.rsc (8.7 KB)

@Bulgaristan are you configuring Mullvad or NordVPN? As I see @anav asked why did you use 10.5.0.2 for Mullvad. They are not same VPN services. NordVPN uses 10.5.0.2 IP for local tunnel interface.

Here is example from my Mac when NordVPN client app is connected (utun6 is its interface):

$ netstat -r
Routing tables

Internet:
Destination        Gateway            Flags               Netif Expire
default            10.5.0.2           UGScg               utun6       
default            192.168.97.1      UGScIg                en0       
10.5.0.2           10.5.0.2           UHr                 utun6       
10.5.0.2/32        link#28            UCS                 utun6

$ ifconfig -v utun6
utun6: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1420 index 28
	eflags=1002080<TXSTART,NOAUTOIPV6LL,ECN_ENABLE>
	xflags=4<NOAUTONX>
	inet 10.5.0.2 --> 10.5.0.2 netmask 0xffff0000
	generation id: 64
	link quality: -1 (unknown)
	state availability: 0 (true)
	scheduler: FQ_CODEL 
	qosmarking enabled: no mode: none
	low power mode: disabled
	multi layer packet logging (mpklog): disabled
	routermode4: disabled
	routermode6: disabled

Hi Optio,
I’m diving into learning MikroTik and decided to experiment with both NordVPN and Mullvad to get the hang of things. I followed a Mullvad WireGuard guide and grabbed a license to play around with it, which has been fun!

I’ve had more success with NordVPN so far—it’s up and running, and I’m just one step away from getting web access (WWW) working, which feels like progress!

On the other hand, Mullvad has me stumped. The tunnel connects fine with a proper handshake, but no traffic seems to go through it, and was curious about it.

I`ll add /ip address add address=10.5.0.2 interface=wg-nordvpn network=10.5.0.0 and test :slight_smile:

I’m keeping things simple to build my MikroTik skills, so any insights you have would be awesome.

Thanks for the help!

hello,

I have a situation here. I will try to describe as possible as I can.
me and my friend runs netflix from turkey and getting those funny emails to temporarily change the household. we successfully implemented wireguard from our machines he is tr63.nordvpn.com I am on tr57.nordvpn.com. this method above gave us same keys, same ports different endpoints. so we tried to use it to same end point with his machine has 10.5.0.2 and mine 10.5.0.3 (which to different servers both ip works) but once we change endpoint to the same. everything goes to cactus, no vpn works properly.

is there a way to get diferrnet keys for same server? (the nordVPN account is his so we share one of his 10 active connections)

thank you for help

@Bulgar . sorry can only help with full information, aka the mulvad information provided minuse key and actual endpoint address of course.
And your config

/export file=anynameyouwish ( minus router serial number, any public WANIP information, keys )

@scruffy Typically the issue is one account=onewireguard ip address.

You need to find a 3rd party provider that provides multiple IP addresses and then maybe its possible.
The best way is to rent VPS in the cloud install CHR on it, and then all users go through same CHR public IP to get to the internet. Pick a the VPS server in the location required.

NordVPN have Meshnet feature where multiple devices can be connected over VPN using same account, but I never tried to configre that on Mikrotik. API requests from NordVPN app needs to be sniffed to figure out how to fetch wireguard keys and which IP to use per device.

Also solution can be that on one MT device which is not behind NAT (but maybe it is not mandatory if is possible to use BTH for this) setup NordVPN WG client peer and addditional WG server peer on which other devices connects and connections are routed over NordVPN WG - that works, I have such setup.

Hi Im trying to get this working. I have a linux machine and installed wireguard and nordvpn. I have connected. recived public-key from server and from peer. when I move the settings to mikrotik I dont see any RX traffic. Someone who can help me?

Not a clue of what you are doing
a. identify devices/users
b. identify what traffic they need
c. draw a network diagram
d. provide config

Many thanks for sharing this, it got me up and running :grinning_face:

One question: how do I use the API to find other servers?

Thanks again.

I’ll get the hang of posting on here soon, I promise!!!

See here NordVPN slow performance - #15 by optio

Many thanks!

Good write up. One important clarification for anyone following this: NordVPN WireGuard on MikroTik works, but it is unsupported and relies on extracting keys from a Linux client. Keys can be rotated or invalidated by NordVPN at any time.

Also, the kill switch logic is correct, but only effective if no fallback default route exists for the marked traffic. Make sure policy rules are strict, otherwise traffic can still leak via main.

If people want a supported setup, IKEv2 is still the only officially supported option on MikroTik.

I f anyone can clarify the following:

after the command “sudo wg show nordlynx” i get the following output

nordlynx
public key: ********************************************
private key: (hidden)
listening port: 49101
fwmark: 0xe1f1

peer: ********************************************
endpoint: 89.33.246.27:51820
allowed ips: 0.0.0.0/0
latest handshake: 29 seconds ago
transfer: 108.19 KiB received, 113.86 KiB sent
persistent keepalive: every 25 seconds

Can anyone tell me if I should be using the “Public key” or the “peer” value.

both are 44 chars long.

Thanks in advance

You need the following keys in the following RouterOS Menus:

/interface/wireguard/peers
public-key = NordLynx "Peer"

/interface/wireguard
private-key = NordLynx "Private Key"