wireguard 3 side connection

Hallo
Can i get a little help..regarding the wireguard configuration.
let’s call it real life situation!!

I have successfully connected mikrotik client(SIDE B) behind NAT (3G usb dongle)
to the wireguard mikrotik “server” (SIDE A).
and have also connected android mobile device 4G (SIDE C) to the mikrotik server(SIDE A)
endpoint address is mikrotik dns.
my ultimate goal is to connect android (SIDE C) to the mikrotik client (SIDE B) using that wireguard tunnel

with all the attempts with routing or firewall unfortunately without success.
how to actually do it this connection?
is only one wireguard enough?

Thanks in advance

Yes,
Post your config to see what you have and then I will point out the necessary adjustments.
/export file=anynameyouwish ( minus router serial number, any public WANIP information, keys etc…)

Thanks for answer
here is my topology ..
trace to 192.168.88.1 from Android Phone ends on wireguard address 192.168.100.1


Mikrotik client (B) 3G usb dongle
bridge LAN 192.168.88.1/24 network 192.168.88.0
wireguard1
192.168.100.4/24 network 192.168.100.0
Peer
Public Key=Mikrotik (A) - Key
Endpoint=ddns Mikrotik (A) mynetname.net
Endpoint Port=12321
Allowed address 192.168.100.1/32 10.11.11.0/24
Persistent Keepalive 25sec

Route list 0.0.0.0/0 - ppp-out1 (3G usb dongle)
Static 10.11.11.0/24 - 192.168.100.1

Firewall filter
input udp 12321 accept
forward udp src 10.11.11.0/24 dst 192.168.88.0/24 accept
forward udp src 192.168.88.0/24 dst 10.11.1.0/24 accept
################################################################

Mikrotik (A) “server”
bridge LAN 10.11.11.1/24 network 10.11.11.0
wireguard1
192.168.100.1/24 network 192.168.100.0
Two Peers !!
Peer_B
Public Key=Mikrotik (B) - Key
Endpoint=
Endpoint Port=
Allowed address 192.168.100.4/32 192.168.88.0/24/24
Persistent Keepalive 25sec

Peer_C
Public Key=Android Phone - Key
Endpoint=
Endpoint Port=
Allowed address 192.168.100.2/32 192.168.88.0./24 10.11.11.0/24
Persistent Keepalive=

Route list 0.0.0.0/0 - ppp-out1 VDSL
Static 192.168.88.0/24 - 192.168.100.4

Firewall filter
input udp 12321 accept
forward udp src 10.11.11.0/24 dst 192.168.88.0/24accept
forward udp src 192.168.88.0/24 dst 10.11.11.0/24 accept
###############################################################

Android Phone 3G/4G
addresses 192.168.100.2/32
DNS 8.8.8.8
Peer=Mikrotik A - Key
Allowed IP 0.0.0.0/0
Endpoint-ddns Mikrotik A mynetname.net:13231

I meant full config on MT device
/export file=anynameyouwish (minus router serial number, public WANIP informaiton, keys etc…)

(1) MT Router Client (B)

a.. the allowed IPs should be on the MT CLIENT (B) router…

Allowed address 192.168.100.0/24,10.11.11.0/24
Persistent Keepalive 25sec

b. What is with this IP route?
Static 10.11.11.0/24 - 192.168.100.1 ??

If you are either telling the local B router where to send traffic with that destination, OR, telling the local B router where to send return traffic from those users, then it should be:
add dst-address=10.11.11.0/24 gateway=wireguard1 routing-table=main

c. Can you tell me why you think you need an input chain rule for wireguard handshake on the client router ???

What you need on the Router B client is the ability to access the router for config purposes from both RouterB, RouterA and any remote admin access. So make a firewall address list called Authorized, including RouterB local LANIPs (wired or wired with static leases set), Router A local LANIPs ( wired or wired with static leases set) and any admin remote wireguard IPs ( android, laptop when remote, ipad etc.). I imagine this list will probably be the same list you can use for Router A, because regardless which Router you are physically at, you want to be able to get to the other router for config purposes AND when remote you want to be able to reach both routers. Thus on routers B and A, you should have, after the default rules..
add chain=input action=accept comment=“Admin Access” src-address-list=Authorized

d. For firewall rules I tend to be more open on the outgoing and then tight on the incoming wrt forward chain.
add chain=forward action=accept src-address=192.168.88.0/24 out-interface=wireguard1
add chain=forward action=accept in-interface=wireguard1 src-address=110.11.11.0/24 dst-address=192.168.88.0/24

e. Methinks you have an error in your firewall rules too:
forward udp src 192.168.88.0/24 dst 10.11.1.0/24 accept

(2) Wireguard Server Router (A)

a. assuming this is just a lazy typo?? ( and the lack of comma between the entities and the extra spaces )?
Allowed address 192.168.100.4/32 192.168.88**.0/24/24**

b. same comment as for router B, route should be:
add dst-address=192.168.88.0/24 gateway=wireguard1 routing-table=main

Personally to avoid confusion and always no what router I am looking at I would use different interface names for the wiregaurds.
WG-B, WG-A, WG-Server WG-Client, WG-Work, WG-Home, WG-Local, WG-Remote, lots of options LOL.

c. SAME SAME comments for input chain list to access router, here the input rule for handshake is appropriate.
With respect to firewall rules…
add chain=forward action=accept src-address=10.11.11.0/24 out-interface=wireguard1
add chain=forward action=accept in-interface=wireguard1 src-address=192.168.88.0/24 dst-address=10.11.11.0/24 comment=“allow RB users to RA subnet if required”
add chain=forward action=accept in-interface=wireguard1 src-address=192.168.100.4 dst-address=10.11.11.0/24
comment=“allow android to RA subnet if required”

The most important thing to join two clients is what I call RELAY… since its a peer to peer network the C location only reaches A, the B location only reaches A,
Thus to ensure that A and C can connect use the firewall rule.

add chain=forward action=accept in-interface=wireguard1 out-interface=wireguard1

What we are saying is that in your case Android or Location C, wants to reach 192.168.88.0. Android C device notes that allowed IPs=0.0.0.0/0 so this is permitted (as the device checks the destination addresses. The traffic is sent through the tunnel to Router A. Router A notes that 10.11.11.4 is an acceptable source for traffic (its on the allowed IPs as it checks for legit incoming sources). In effect the android traffic is now sitting at the LAN LEVEL at router A…

The router says okay I have this traffic for 192.168.88.0 destination, Hey wait, I have route for that I know where it should go, back into the tunnel towards peer B. The router checks to see if there is a bonafide dst address for this on the allowed IPs and finds yes at peerB, the final requirement is to allow that traffic from the tunnel to go to the tunnel!! Hence our relay rule!!
Would be extra handy if B and C were both routers etc…

In any case any remote wireguard device coming into Router A, will be able to reach Router B with this setup.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Okay so after reading this there is a glaring step we missed… hint reaching router B…
Well so android C has successfully travelled back into the tunnel through router A to router B with source address 192.168.100.4
Luckily we modifed the allowed IPs to include this as one of our first steps (192.168.100.0/24) …jolly good. So the wireguard code lets the traffic exit the tunnel.

But uh oh, the firewall says, who the EFF is this trying to come from wirguard to the LAN.
Thus we need to adjust the firewall rules to (on Router B)"
add chain=forward action=accept src-address=192.168.88.0/24 out-interface=wireguard1
add chain=forward action=accept in-interface=wireguard1 src-address=110.11.11.0/24 dst-address=192.168.88.0/24 comment=“allow RA users to RB subnet”
add chain=forward action=accept in-interface=wireguard1 src-address=192.168.100.4/32 dst-address=192.168.88.0/24

Hi

Sorry… I was away for a while
Thank you very much for the super detailed explanation. So not only code … but education :smiley:
works now for me.. !!!
I am delighted with wiregurad - super fast !

thank you