OPNsense Forum

English Forums => Virtual private networks => Topic started by: Friend4all on March 25, 2025, 06:01:21 AM

Title: Wireguard routes
Post by: Friend4all on March 25, 2025, 06:01:21 AM
How do I create routes through wg tunnel?
Here is my network:

                                                                             ISP1                       
             /-----10.2.2.0/24 (wg)------\            |
10.10.20.0/24 ---10.50.50.0/24  ---   10.10.10.0/24 - 172.16.100.0/24
   LAN3                           ISP2                         LAN1                  LAN2

I have working wg tunnel through ISP2, and I have access from LAN3 to LAN1 and back. But I need acces from LAN3 to LAN2
In allowed IP on LAN3 router I have 10.2.2.0/24(tunnel address), 10.10.10.0/24 and 172.16.100.0/24 (route for 10.10.10.0/24 created by wg, but no routes for 172.16.100.0/24)
on LAN1 I have 10.2.2.0/24 and 10.10.20.0/24. for LAN2 there is static route (172.16.100.0/24 via 10.10.10.30) on router LAN1 (there is no problem with routing between LAN1 and LAN2)
Title: Re: Wireguard routes
Post by: Patrick M. Hausen on March 25, 2025, 07:10:32 AM
Place the respective remote networks into the "AllowedIPs" field on each side.
Title: Re: Wireguard routes
Post by: Friend4all on March 25, 2025, 07:58:38 AM
Quote from: Patrick M. Hausen on March 25, 2025, 07:10:32 AMPlace the respective remote networks into the "AllowedIPs" field on each side.
I have done that (on LAN3 router there is 10.2.2.0/24,10.10.10.0/24 and 172.16.64.0/24, on LAN1 there is 10.2.2.0/24,10.10.20.0/24). didnt work
Title: Re: Wireguard routes
Post by: Patrick M. Hausen on March 25, 2025, 08:13:15 AM
Type

wg
netstat -rn

If the routes are there, probably firewall rules are missing.
Title: Re: Wireguard routes
Post by: Friend4all on March 25, 2025, 08:39:56 AM
I removed networks from allowedIP, then added them again, and now routes work. Thanks