Trying to connect two remote LANs via wireguard.
following advice for another thread, I'm not specifying gateways anywhere (apart from the main WAN's GW)
there's a large site (10.0.1.0/24) with a E8450 (UBI), and a small site (10.0.2.0/24) with a UniFi AC Pro. both on 23.05.5. They are setup the same, only the large site have individual physical ports, and the small have the weird unifi ap single logical port with vlans for two physical ports. But apart from that, same.
tunnels start fine. wg show
shows the peers and handshake times OK.
both /etc/config/network entries look like (i name things xLarge and xSmall to differentiate them)
config interface 'wgLarge'
option proto 'wireguard'
option private_key ...
option listen_port '51820'
list dns '10.0.2.1' # small LAN modem
option delegate '0'
option dns_metric '9'
config wireguard_wgLarge
option description 'wgSmallpeer'
option public_key ...
option preshared_key ...
option route_allowed_ips '1'
list allowed_ips '10.0.2.0/24' # small lan
option endpoint_host '1.2.3.4'
option endpoint_port '51820'
config device
option name 'wgLarge'
option ipv6 '0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '10.0.1.1' # large lan
The other lan is the same, but replace Large<->Small and 10.0.1.*
<->10.0.2.*
after wg peers handshake:
openwrt-large-lan# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 wan
10.0.1.0 * 255.255.255.0 U 0 0 0 br-lan
10.0.2.0 * 255.255.255.0 U 0 0 0 wgLarge
1.2.3.4 192.168.1.1 255.255.255.255 UGH 0 0 0 wan
192.168.1.0 * 255.255.255.0 U 0 0 0 wan
10.99.3.0 * 255.255.255.0 U 0 0 0 br-guest
openwrt-large-lan# wg show
interface: wgLarge
public key: large....=
private key: (hidden)
listening port: 51820
peer: small...=
preshared key: (hidden)
endpoint: 1.2.3.4:51820
allowed ips: 10.0.2.1/24
transfer: 0 B received, 25.44 KiB sent
(large also has a guest network that small doesn't have)
openwrt-small-lan# # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0.2
10.0.1.0 * 255.255.255.0 U 0 0 0 wgSmall
192.168.1.1 * 255.255.255.0 U 0 0 0 eth0.2
10.0.2.0 * 255.255.255.0 U 0 0 0 br-lan
22.22.22.22 192.168.1.1 255.255.255.255 UGH 0 0 0 eth0.2
openwrt-small-lan# wg show
interface: wgSmall
public key: small....=
private key: (hidden)
listening port: 51820
peer: large...=
preshared key: (hidden)
endpoint: 22.22.22.22:51820
allowed ips: 10.0.1.0/24
latest handshake: 48 minutes, 39 seconds ago
transfer: 2.54 MiB received, 4.05 MiB sent
So far so good... but now the weird part:
if I ping (all modems have the default firewall rules to allow icmp, also on both the wg* interface is assigned to the LAN zone) from:
- large -> small: timesout
- small -> large: works
- client on large LAN -> small: works!
why wile on large, 10.0.1.1, i cannot ping 1.0.2.1, but a client on it's wifi network can? traceroute didn't help at all, it just goes on forever.
edit:
just noticed the client on large LAN -> small connection works only when the small lan have data going trhu the tunnel
so, from a client (e.g. 10.0.1.133):
client@large# $ tracepath -n 10.0.2.1
1?: [LOCALHOST] pmtu 1500
1: 10.0.1.1 0.468ms
1: 10.0.1.1 0.369ms
2: 10.0.1.1 0.372ms pmtu 1420
2: no reply
3: no reply
4: no reply
5: no reply
6: no reply
7: no reply
8: no reply
^C
But if I ssh to modem at small lan, and ping 10.0.1.1 (i.e. send data trhu the already active wg tunnel),
client@large# $ tracepath -n 10.0.2.1
1?: [LOCALHOST] pmtu 1500
1: 10.0.1.1 0.548ms
1: 10.0.1.1 0.367ms
2: 10.0.1.1 0.361ms pmtu 1420
2: 10.0.2.1 48.496ms reached
Resume: pmtu 1420 hops 2 back 2
But, from modem at large (10.0.1.1) i get no connection at all, even after "activating" it on the other side, which seems to work for the clients, which send data trhu the modem 10.0.1.1... i'm lost on this.