Community discussions

MikroTik App
 
ThoKoch
just joined
Topic Author
Posts: 3
Joined: Wed Nov 17, 2021 2:00 am

Wireguard VPN routing

Sat Nov 20, 2021 3:43 pm

I have 3 MTs connect via Wireguard(WG) (all setup and nicely working), using RouterOS v7.1rc6
RT 1: 192.168.88.1/24 (plus 10.0.0.1/24 for WG)
RT 2: 192.168.89.1/24 (plus 10.0.0.2/24 for WG)
RT 3: 192.168.90.1/24 (plus 10.0.0.3/24 for WG)

Routing between the 3 routers is nicely working over WG, I connect to all of the routers, I can ping and manage (HTTP, shh etc.) them from the other networks (no firewalls between activated).

I would like to route all outbound traffic
  • from 192.168.89.128 through RT 1 (192.168.88.1) using NAT and
    from 192.168.90.129 through RT 3 (192.168.90.1) using NAT.
All other traffic on 192.168.89.1/24 should use the normal route.
IP addresses would be hard coded in the device or via permanent DHCP addresses.

In IPsec on an AVM FritzBox (FB) I am doing this by simply adding permit ip 192.168.89.128 255.255.255.255 any in the configuration and I am done (though the FB is super slow for VPN/IPSec).
I have seen a couple of ideas but they seem to use the HW port for deciding which pass to use.

What would be the easiest and most flexible way to implement an IP based outbound routing via different GW in different subnet using NAT in this setup?
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19325
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Wireguard VPN routing

Mon Nov 22, 2021 2:50 pm

Sounds like a case where you need to do two things...
a. ensure 192.168.189.128 is routed through the WIREGUARD Tunnel
b. at the 192.168.188.1 router, internet traffic is routed back through the tunnel to 192.168.189.128

On the 189 Router
I would probably accomplish a. with a destination route and route rule
dst address=0.0.0.0 gateway=wgtunnel_to_188 route-mark=use188internet
route rule
source-address=192.168.189.128
action: lookup only in table
table=use188internet

Who is online

Users browsing this forum: almdandi, MarkusT and 65 guests