Allowing LAN access with VPN server

Hi all,
I'm a recent convert to openwrt and my set up is as follows:

On my windows laptop with Wireguard client, I can connect to luci (192.168.1.1) and the internet, however I cannot connect to my printer's web server (nor ping its IP). When I tracert 192.168.1.66, it stops at 192.168.9.1 (the wireguard interface wg0).

I initially followed the Wireguard server instructions, and then have been following different bits of advice from forum threads which has got me to this point. Currently, I'm out of ideas and not sure what more to do.

I'd be grateful if someone could let me know what is the next step to solving this. I've done screenshots of various config, but let me know if there is something else you need.

Many thanks!

etc/config/firewall

config rule 'wg'
	option name 'Allow-WireGuard'
	option src 'wan'
	option dest_port '51820'
	option proto 'udp'
	option target 'ACCEPT'

We need to see the complete files (please follow the directions below, images are not as easy to work with).

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/firewall

Also please include the wg configuration from your windows laptop.

Apologies. Here are the copied config. Let me know if I have included something I shouldn't have.

/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 '<REDACTED>'

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 interface 'WAN'
	option proto 'dhcp'
	option device 'eth1'

config interface 'wg0'
	option proto 'wireguard'
	option private_key '<REDACTED>'
	option listen_port '51820'
	list addresses 'fdf1:7610:d152:3a9c::1/64'
	list addresses '192.168.9.1/24'

config wireguard_wg0 'wgclient'
	option description 'A21s'
	option route_allowed_ips '1'
	option public_key '<REDACTED>'
	list allowed_ips '192.168.1.1/24'
	list allowed_ips '192.168.9.1/24'

config wireguard_wg0
	option description 'legion'
	option route_allowed_ips '1'
	option public_key '<REDACTED>'
	list allowed_ips '192.168.9.1/24'
	list allowed_ips '192.168.1.1/24'

config interface 'tun0'
	option device 'tun0'
	option proto 'none'
	option defaultroute '0'

/etc/config/firewall

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

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

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

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 src_ip 'fc00::/6'
	option dest_ip 'fc00::/6'
	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
	option name 'Support-UDP-Traceroute'
	option src 'wan'
	option dest_port '33434:33689'
	option proto 'udp'
	option family 'ipv4'
	option target 'REJECT'
	option enabled '0'

config include
	option path '/etc/firewall.user'

config rule 'wg'
	option name 'Allow-WireGuard'
	option src 'wan'
	option dest_port '51820'
	option proto 'udp'
	option target 'ACCEPT'

Windows laptop WG config

[Interface]
PrivateKey = <REDACTED>
Address = 192.168.9.3/32
DNS = 192.168.1.1

[Peer]
PublicKey = <REDACTED>
AllowedIPs = 0.0.0.0/1, 128.0.0.0/1
Endpoint = <REDACTED>:51820

A few things...

You don't appear to have any IPv6 stuff happening in your config, so remove the IPv6 from the WG interface as it is not useful.

For each of your WG remote peers ('clients'), give them a unique /32 address in the 192.168.9.0/24 network, and remote the 192.168.1.1/24 addresses.

and so on for the other peers.

On the remote peer (client side), make sure that the address of the interface matches that of the wg peer definition in the router's config. 1921.68.9.3/32 is fine as long as it is consistent with the peer's config in the router.

For the allowed IPs in the remote peer (laptop), you can just use 0.0.0.0/0 instead of breaking them up (should the same effect, but it is just cleaner). This is what you will do if you want all traffic to pass through the tunnel. If you're aiming to only force the traffic for the LAN (i.e. remote access/admin of that network), just set this to 192.168.1.0/24 and 192.168.9.0/24

Ok, many thanks. So I have removed the IPv6 from wg0 and updated addresses as suggested.

Changes in /etc/config/network

config interface 'wg0'
	option proto 'wireguard'
	option private_key '<REDACTED>'
	option listen_port '51820'
	list addresses '192.168.9.1/24'

config wireguard_wg0 'wgclient'
	option description 'A21s'
	option route_allowed_ips '1'
	option public_key '<REDACTED>'
	list allowed_ips '192.168.1.1/24'
	list allowed_ips '192.168.9.2/32'

config wireguard_wg0
	option description 'legion'
	option route_allowed_ips '1'
	option public_key '<REDACTED>'
	list allowed_ips '192.168.1.1/24'
	list allowed_ips '192.168.9.3/32'

However, I'm still seeing the same behaviour... I can access 192.168.1.1 and the internet, however, I can't access the printer web server or ping it. Doesn't get further than 192.168.9.1

remove the 192.168.1.1/24 addresses from the wg configs.

I've removed those now, but still seeing the same behaviour.

Changes in /etc/config/network

config interface 'wg0'
	option proto 'wireguard'
	option private_key '<REDACTED>'
	option listen_port '51820'
	list addresses '192.168.9.1/24'

config wireguard_wg0 'wgclient'
	option description 'A21s'
	option route_allowed_ips '1'
	option public_key '<REDACTED>'
	list allowed_ips '192.168.9.2/32'

config wireguard_wg0
	option description 'legion'
	option route_allowed_ips '1'
	option public_key '<REDACTED>'
	list allowed_ips '192.168.9.3/32'

Is it default behaviour that devices on the 192.168.9.0 network should be able to connect to 192.168.1.0, or is it something that I may have missed? Any other settings I can share that could help?

Try restarting the router, just in case something hasn't applied properly.

If that doesn't work, set your wg0 interface in another firewall zone -- create a vpn zone, for example, with input = accept, output = accept, forward = drop. Then allow forwarding from the vpn zone to the lan zone.

So, I've added the new firewall zone, and seeing the same behaviour, however, I'm not 100% sure if I need to change some of the other settings. I created it using luci and kept the defaults, just changing the accept, accept, drop and then adding the wan and lan to forward destination.
Is there anything else I should be changing?

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

config forwarding
	option src 'wg'
	option dest 'lan'

config forwarding
	option src 'wg'
	option dest 'wan'

So far, everything looks right.

Do you have another device on the LAN that you can try pinging and/or connecting to? It is possible that the printer is not accepting connections from outside the subnet that is uses for its connection. (while you're at it, it would be a good idea to make sure you can connect to the device from another host on the same network -- just a quick sanity check to make sure it is still functioning properly).

So I can ping one of the Tenda MW5Gs (mesh access point, in bridge mode). Also can ping the TV. So, it must be the printer. (As an aside, I had to get their IPs from the devices themselves, as they don't appear in the DNS / DHCP page in luci. Is that normal?)

I can ping the printer from within the same 192.168.1.x LAN yes.

I did have a look earlier if there was an option for accepting connections from outside the network, but nothing jumped out immediately. I'll look again. There's no other way around it presumably?

PS. Thank you so much for your help. It's so nice to go through it all with someone! I've got so much to learn.

Yes, sounds like the printer is the issue. How is it setup on the network -- does it use a static IP or a DHCP supplied address?

The DHCP leases are stored in RAM. When you rebooted the router earlier, that would have cleared the lease information. It will repopulate as the leases come up for renewal.

Can you show screenshots of the printer's network configuration as well as any security settings and/or any other config options that might be relevant.

Definitely looking promising as I've just spotted "Restricted server list" which appears to do what we need. I've added 192.168.9.0/24 but no luck so far. Will try a few more options and restart the printer physically just in case. There's quite a few options I don't understand yet, but have tracked down the manual.
Up to now I've set the static IP on the printer itself rather than DHCP. But I'm not sure why enable Auto IP is enabled. (Presumably it ignores that, as it takes the static I've set)

Printer manuals:
http://support.lexmark.com/index?locale=EN&page=product&userlocale=EN_UK&productCode=LEXMARK_CS720#2

Web server section:
https://publications.lexmark.com/publications/Embedded_Web_Server/AG/html/en/index.html

In the dropdown below the restricted sever list, what else is there in the list?

Can you find the location where you have set the IP manually (if different than this page) and provide screenshots? If it is on this page, uncheck auto IP and let's see what the network configuration options look like (screenshot).

We're in business! Great call!
You were bang on the money about the static IP page.
Weirdly, it was just an unassuming hyperlink "set static IP address". However, when I clicked it, I had IP, mask, and gateway inputs. And the gateway was wrong! It was set to my previous BT 192.168.1.254 router address.


Thanks so much! It's a game changer for me!

That was precisely what I was thinking! Glad it is working now.

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