Hello,
I know there are a lot of similiar threads, but they didn't help me on my specific problem:
I can reach the router interfaces via the wireguard-IPs (192.168.1.1 and 192.168.1.5; ping/SSH/luci work without problems), but I cannot access the network behind the routers (192.168.22.0/24 and 192.168.21.0/24) or the router-IPs (192.168.22.1 and 192.168.21.1).
Do I need additional firewall-rules? I would guess not, because wg0 is part of each lan-zone.
I have setup the following:
- Router A: WAN-connection via fibre (semi-permanent IPv6, /56-prefix)
1.1etc/config/network
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.21.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wg0'
option proto 'wireguard'
option private_key '<private_key Router_A>'
option listen_port '27'
list addresses '192.168.1.1/24'
option ip6assign '64'
config wireguard_wg0
option description '<Router_B>'
option public_key '<public_key Router_B>'
option preshared_key '<preshared_key>'
list allowed_ips '192.168.22.0/24'
list allowed_ips '192.168.1.5/32'
option route_allowed_ips '1'
option endpoint_host '<wg0.router_b.mydomain.tld>'
option endpoint_port '27'
option persistent_keepalive '25'
1.2 etc/config/firewall
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
list network 'wg0'
config rule
option name 'wireguard input wg0'
option src '*'
option dest_port '27'
option proto 'udp'
option target 'ACCEPT'
1.3 IPv4-routes:
root@Router_A:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 100.84.0.1 0.0.0.0 UG 0 0 0 wan
100.84.0.0 * 255.255.0.0 U 0 0 0 wan
192.168.1.0 * 255.255.255.0 U 0 0 0 wg0
[...]
192.168.1.5 * 255.255.255.255 UH 0 0 0 wg0
[...]
192.168.21.0 * 255.255.255.0 U 0 0 0 br-lan
192.168.22.0 * 255.255.255.0 U 0 0 0 wg0
[...]
1.4. wg show
root@Garti_Router:~# wg show
interface: wg0
public key: <public_key Router_A>
private key: (hidden)
listening port: 27
peer: <public_key Router_B>
preshared key: (hidden)
endpoint: [<IPv6 Router_B>]:27
allowed ips: 192.168.22.0/24, 192.168.1.5/32
latest handshake: 1 minute, 22 seconds ago
transfer: 43.01 MiB received, 4.11 MiB sent
persistent keepalive: every 25 seconds
- Router B: WAN-connection via 4G/5G (dynamic IPv6, /64-prefix)
2.1etc/config/network
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.22.1'
option netmask '255.255.255.0'
option ip6assign '64'
list ip6class 'local'
config interface 'wg0'
option proto 'wireguard'
option private_key '<private_key Router_B>'
option listen_port '27'
list addresses '192.168.1.5/24'
option ip6assign '64'
option ip6class 'local'
config wireguard_wg0
option description 'Router_A'
option public_key '<public_key Router_A>'
option preshared_key '<preshared_key>'
list allowed_ips '192.168.21.0/24'
list allowed_ips '192.168.1.1/32'
option route_allowed_ips '1'
option endpoint_host '<wg0.router_a.mydomain.tld>'
option endpoint_port '27'
option persistent_keepalive '25'
2.2 etc/config/firewall
config zone
option name 'lan'
list network 'lan'
list network 'wg0'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config rule
option name 'wireguard wg0 input'
option src '*'
option dest_port '27'
option proto 'udp'
option target 'ACCEPT'
2.3 IPv4-routes:
root@Router_B:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.123.182.181 0.0.0.0 UG 0 0 0 wwan0
10.123.182.176 * 255.255.255.248 U 0 0 0 wwan0
192.168.1.0 * 255.255.255.0 U 0 0 0 wg0
192.168.1.1 * 255.255.255.255 UH 0 0 0 wg0
[...]
192.168.21.0 * 255.255.255.0 U 0 0 0 wg0
192.168.22.0 * 255.255.255.0 U 0 0 0 br-lan
[...]
2.4. wg show
root@Garti_Router:~# wg show
interface: wg0
public key: <public_key Router_B>
private key: (hidden)
listening port: 27
peer: <public_key Router_A>
preshared key: (hidden)
endpoint: [<IPv6 router A>]:27
allowed ips: 192.168.21.0/24, 192.168.1.1/32
latest handshake: 1 minute, 46 seconds ago
transfer: 3.56 MiB received, 37.97 MiB sent
persistent keepalive: every 25 seconds
Thanks - at least for reading,
ssdnvv