Wireguard Server: No Acesss The Local Network / Internet


I've a NanoPi NEO2 SBC running LuCI openwrt-22.03 branch (git-22.288.45147-96ec0cd) / OpenWrt 22.03.2 r19803-9a599fee93. This is a cheap ARM board that has one gigabit Ethernet port and I've it setup as DHCP and DNS server for my network. The router ISP works as gateway.

  • OpenWrt/ARM (DHCP/DNS Server):
  • ISP Router (Gateway):

I've setup a WG "server" using the GUI and I'm able to connect my phone to it. The phone is able access the OpenWrt interface but it can't access any other on the network and/or the Internet.

Network config:

# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr ''
        option netmask ''

config globals 'globals'
        option ula_prefix 'fdb0:01c0:5208::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'
        option ipv6 '0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ip6assign '60'
        option delegate '0'
        list ipaddr ''
        option gateway ''
        option broadcast ''

config device
        option name 'eth0'
        option ipv6 '0'

config interface 'VPN'
        option proto 'wireguard'
        option private_key '...'
        option listen_port '41390'
        option mtu '1200'
        option peerdns '0'
        list dns ''
        option delegate '0'
        list addresses ''

config wireguard_VPN
        option description 'iPhone'
        option public_key '...'
        option private_key '...'
        option preshared_key '...'
        option route_allowed_ips '1'
        option persistent_keepalive '600'
        list allowed_ips ''

config device
        option name 'VPN'
        option ipv6 '0'

Client config:

As I said the phone connects just fine:

# wg show
interface: VPN
  public key: ......
  private key: (hidden)
  listening port: 41390

peer: ......
  preshared key: (hidden)
  endpoint: ....:33817
  allowed ips:
  latest handshake: 41 seconds ago
  transfer: 14.21 KiB received, 12.70 KiB sent
  persistent keepalive: every 10 minutes

The current routing table:

# ip route show
default via dev br-lan dev br-lan scope link  src dev VPN scope link  src dev VPN scope link

This looks to me like some routing problem but since this isn't a standard setup where the OpenWrt box also acts as gateway I'm not sure.

Thank you.

There are two ways to handle this:

  1. if your main router supports it, add a static route to its routing table: via


  1. put the Wireguard network it its own firewall zone and (input, output, and forward = accept), with masquerading enabled. Then allow forwarding from this new zone > lan.
1 Like

I started with option 2 because the ISP router doesn't allow for custom routes and it worked just fine.

I was a bit unhappy with the blunt masquerading and traffic forwarding (makes it impossible to keep IPs intact) so I ended up with a slightly different config. The following config works because my OpenWrt device doesn't have a WAN port, everything is considered LAN.

  1. Firewall NAT rules to allow traffic from any VPN client to reach the LAN and to masquerade anything that needs to be sent to the gateway/internet:

This way I can for instance ping computer on the local network from the VPN and have the source IP intact:

  1. Now in order to allow the reverse (communication from computers on the local network to the VPN devices), I added the option 121 to the DHCP on the LAN interface:
dhcp.lan.dhcp_option='6,' '121,,' '3,'

This pushes a custom route to the DHCP clients:

IPv4 Route Table
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
     25     26

Thank you for the help!

1 Like

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