[SOLVED] Openwrt+Wireguard access to internet but no access to LAN

Hi all, I should introduce myself as this is my first post, however before posting I read a lot.

I have router OpenWRT on 192.168.2.0 connected to ISP router 192.168.1.0 and configured WireGuard to access internet and LAN.

What I can do:

  1. Connect successfully from MyMobile to my OpenWRT router
  2. Browse internet from the mobile passing through the configured WPN
  3. Access the OpenWRT luci interface (http://192.168.2.1)

What I cannot do:

  1. Connect to any other addresses on the LAN (192.168.2.0/24). Browser on mobile hangs with err_network_changed
  2. Cannot ping to any device on 192.168.2.0/24

In other words, MyMobile becomes part of the LAN receiving address 192.168.2.15 and let me browse the internet like it was a device in the LAN but accessing other devices in the LAN (192.168.2.0/24) besides the router itself (192.168.2.1) doesn't work.

What am I missing here? ( I am on this problem since days, now and I am calling for experts, THANKS)

Configuration follows

# ubus call system board

{
	"kernel": "6.6.73",
	"hostname": "OpenWrt",
	"system": "ARMv8 Processor rev 4",
	"model": "Xiaomi Mi Router AX3000T",
	"board_name": "xiaomi,mi-router-ax3000t",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "24.10.0",
		"revision": "r28427-6df0e3d02a",
		"target": "mediatek/filogic",
		"description": "OpenWrt 24.10.0 r28427-6df0e3d02a",
		"builddate": "1738624177"
	}
}
# cat /etc/config/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 'fd46:c72a:c628::/48'
	option packet_steering '1'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.2.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option gateway '192.168.1.1'

config device
	option name 'wan'
	option macaddr 'cc:cc:cc:cc:cc:cc'

config interface 'wan'
	option device 'wan'
	option proto 'dhcp'

config interface 'wan6'
	option device 'wan'
	option proto 'dhcpv6'

config interface 'wg0'
	option proto 'wireguard'
	option private_key 'XXX='
	option listen_port '51820'
	list addresses '192.168.2.1/24'
	option mtu '1420'

config wireguard_wg0 'wgclient'
	option description 'MyMobile1'
	option public_key 'XXX='
	option preshared_key 'XXX='
	option endpoint_host 'xxx.example.com'
	option endpoint_port '51820'
	option persistent_keepalive '25'
	option private_key 'XXX='
	list allowed_ips '192.168.2.15/32'
	option route_allowed_ips '1'

# cat /etc/config/firewall

config defaults
	option syn_flood '1'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'

config zone 'lan'
	option name 'lan'
	list network 'lan'
	list network 'wg0'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config zone 'wan'
	option name 'wan'
	list network 'wan'
	list network 'wan6'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'

config forwarding 'lan_wan'
	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 rule 'wg'
	option name 'Allow-WireGuard'
	option src 'wan'
	option dest_port '51820'
	option proto 'udp'
	option target 'ACCEPT'

config redirect
	option dest 'lan'
	option target 'DNAT'
	option name 'Wireguard-wg0'
	list proto 'udp'
	option src 'wan'
	option src_dport '51820'
	option dest_ip '192.168.2.1'
	option dest_port '51820'

Your wg interface subnet overlaps the lan:

You must use unique and non overlapping subnets.

1 Like

I feel so stupid, but actually this solves my problems (change wg0 subnet). I guess I owe you a beer! THANKS

config interface 'wg0'
	option proto 'wireguard'
	option private_key 'XXX='
	option listen_port '51820'
	list addresses '192.168.3.1/24'
	option mtu '1420'

config wireguard_wg0 'wgclient'
	option description 'MyMobile1'
	option public_key 'XXX='
	option preshared_key 'XXX='
	option endpoint_host 'xxx.example.com'
	option endpoint_port '51820'
	option persistent_keepalive '25'
	option private_key 'XXX='
	list allowed_ips '192.168.3.15/32'
	option route_allowed_ips '1'

(going to put solved in subject!)

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.