I would like to ask you if it’s possible to have the mikrotik router as a Wireguard server and as a Wireguard client in the same time.
Basically I have it set up as a server and it works ok to connect from android phone to a NAS behind the router.
Now I would like to add a RPI Wireguard server from another remote network and I would like to connect with the mikrotik router to that particular Wireguard server and allow connection from the webserver ip mentioned in the screenshot ( 192.168.0.20 ) to the synology nas mentioned in the screenshot ( 192.168.200.3 ). So that the synology nas collects data from the webserver api.
Please excuse my poor drawing skills
hi, thank you for the response. Unfortunately I only have a mikrotik router in the first location, and on the second location I have a raspberry pi. So maybe I misunderstood or I am too new at this
In the WireGuard world of VPN’s there is no such thing as Client/Server … WireGuard is strictly Peer to Peer … Any WireGuard Peer can communicate with any other WireGuard Peer … A Peer does not talk to itself … a Peer only communicates with it’s other permitted Peers …
So your Raspberry WireGuard Peer can establish communications with your MikroTik Peer as long as you exchange the proper keys and have the allowed addresses in place and your Firewall is correctly configured to allow the communication.
As mozerd states, connectivity is TWO WAY, peer to peer ONCE CONNECTED
For the initial handshake one side has to ACT as server and the other end a client.
For a device to be a server it has to have a reachable public IP (either direct or by port forwarding from an upstream ISP modem/router for example).
There is no reason why two publicly accessible MT routers for example couldn’t start a tunnel to the other.
I would use a different interface and different listening ports to make it clear but its possible.
As stated what has to line up are the basic requirements
necessary firewall rules (both input and forward chain)
applicable Allowed-Addresses at both ends!!
-necessary routes.
Peer to Peer means: Decentralized peer-to-peer programs (such as WireGuard) allow pushing files, which means the calling Peer initiates the data transfer rather than the receiving Peer.
No SERVER is involved … PERIOD
calling Peer receiving Peer.
ABSOLUTLY no server is involved because the communication is Decentralized where all PEERS are equal
So why does one MT device need an input chain rule!! and the other does not…
Reality is there is an initial handshake whether you like it or not. Your are confusing the OP.
I see that you have a second wireguard interface setup on the RPI, for android access probably not a bad idea but are you saying that both Devices have publicly accessible WAN IPs?
The important addition to android phone connectivity is the ability for the NAS server and the webservers to
a. be accessible via firewall rules L3
b. or do something automatically like stream or read traffic, or something at L2??
The mikrotik has a WAN IP, but the rpi does not. It’s behind a router with port forward.
For the moment my priority is to get mikrotik and rpi up and running with connection. Basically to have connectivity between the webserver and the synology nas. Android is after to make sure I have a backup connection in place.
I looked over the topic you posted but I am quite new and can’t follow it all only parts of it. That is why I tried to reach out for some support
Shouldnt be too far to get working…
It looks like you dont use vlans but multiple bridges?
(1) Please provide full config
/export file=anynameyouwish ( minus router serial # and any public WANIP information )
(2) Missing many firewall rules??
(3) Okay so where is the same rule, as below, for port 51821 ???
/ip firewall filter
add action=accept chain=input comment=“Allow Wireguard” dst-port=51820 in-interface=digi protocol=udp
Okay its below,
Nothing more than I detest than an unorganized firewall chain.
Group input chain together and forward chain together, much easier to read and troubleshoot
Why have any firewall rules, all is permitted… so the rules you made are not even necessary as there are no blocking rules.
A mess of a config… if you are truly internet facing!!
What is the purpose of this rule??
add action=masquerade chain=srcnat comment=“Hairpin NAT” connection-mark=“Hairpin NAT”
or any of your rules…’
add action=dst-nat chain=dstnat comment=“Wireguard hairpin nat” disabled=yes dst-address-list=WANs dst-port=51820 protocol=udp to-addresses=192.168.200.1 to-ports=51820
add action=masquerade chain=srcnat comment=“Wireguard piVPN” src-address=192.168.202.0/24
+++++++++++++++++++++++++
You are attempting advanced config concepts for a homeowner without having an understanding of any basics…
What is the purpose of this rule??
add action=masquerade chain=srcnat comment=“Hairpin NAT” connection-mark=“Hairpin NAT”
This was added to be able to access devices when I connect through the VPN from inside the home WLAN
I added my full config with sensitive stuff removed. I am open to critics so I can improve. And indeed I am a noob in this aspect but I am reading and trying to make it good
And not the least, thank you lots for your help. It’s much appreciated export_mikrotik.rsc (25.8 KB)