I'm using a VPS as a WireGuard server with the following script: https://github.com/Nyr/wireguard-install
My OpenWrt router is acting as a WireGuard client with IP: 10.7.0.2. I also have a phone connected via 4G through the WireGuard app IP: 10.7.0.3. I can ping my phone from any device on my LAN using that IP but not the other way round. My LAN devices use 192.168.1.x and if I try to ping any device on the LAN from the phone or from the server I get no response back.
I went through a lot of similar posts looking for the answer and have made some modifications to the server.
I added 192.168.1.0/24 to the allowed ip's list on the server config. That automatically created the following ip route on the server: 192.168.1.0/24 dev wg0 scope link
I tried changing the static route to 192.168.1.0/24 via 10.7.0.2
as recommended on another post but it made no difference.
I also have net.ipv4.ip_forward = 1
set on the server.
Server Config:
# Do not alter the commented lines
# They are used by wireguard-install
# ENDPOINT [Redacted]
[Interface]
Address = 10.7.0.1/24, fddd:2c4:2c4:2c4::1/64
PrivateKey = [Redacted]
ListenPort = 51820
# BEGIN_PEER openwrt
[Peer]
PublicKey = [Redacted]
PresharedKey = [Redacted]
AllowedIPs = 10.7.0.2/32, fddd:2c4:2c4:2c4::2/128, 192.168.1.0/24
# END_PEER openwrt
# BEGIN_PEER android
[Peer]
PublicKey = [Redacted]
PresharedKey = [Redacted]
AllowedIPs = 10.7.0.3/32, fddd:2c4:2c4:2c4::3/128
# END_PEER android
OpenWrt Client Config:
[Interface]
Address = 10.7.0.2/24, fddd:2c4:2c4:2c4::2/64
DNS = [Redacted]
[Peer]
PublicKey = [Redacted]
PresharedKey = [Redacted]
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = [Redacted]:51820
PersistentKeepalive = 25
Phone Config:
[Interface]
Address = 10.7.0.3/24, fddd:2c4:2c4:2c4::3/64
DNS = [Redacted]
PrivateKey = [Redacted]
[Peer]
PublicKey = [Redacted]
PresharedKey = [Redacted]
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = [Redacted]:51820
PersistentKeepalive = 25
OpenWrt Network:
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd4e:5e2d:ba03::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option vid '1'
option ports '0t 4 3 2'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '0t 1t'
option vid '911'
config interface 'WAN'
option device 'eth0.911'
option proto 'pppoe'
option username '[Redacted]'
option password '[Redacted]'
option ipv6 'auto'
config interface 'vpn'
option proto 'wireguard'
option private_key '[Redacted]'
list addresses '10.7.0.2/24'
list addresses 'fddd:2c4:2c4:2c4::2/64'
option peerdns '0'
list dns '[Redacted]'
config wireguard_vpn
option description 'openwrt.conf'
option public_key '[Redacted]'
option preshared_key '[Redacted]'
list allowed_ips '0.0.0.0/0'
list allowed_ips '::/0'
option persistent_keepalive '25'
option endpoint_host '[Redacted]'
option endpoint_port '51820'
OpenWrt Firewall:
config defaults
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option synflood_protect '1'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
list network 'wan'
list network 'wan6'
list network 'WAN'
config forwarding
option src 'lan'
option dest 'wan'
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option target 'ACCEPT'
option family 'ipv4'
config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-IPSec-ESP'
option src 'wan'
option dest 'lan'
option proto 'esp'
option target 'ACCEPT'
config rule
option name 'Allow-ISAKMP'
option src 'wan'
option dest 'lan'
option dest_port '500'
option proto 'udp'
option target 'ACCEPT'
config zone
option name 'vpn'
option output 'ACCEPT'
option input 'ACCEPT'
option forward 'ACCEPT'
option mtu_fix '1'
list network 'vpn'
option masq '1'
config forwarding
option src 'lan'
option dest 'vpn'
config forwarding
option src 'vpn'
option dest 'lan'