DEV Community

Mehdi mFat
Mehdi mFat

Posted on

How to bypass wireguard client for local network on openwrt

Assuming your local network is 192.168.0.0/24, you should do this:

nano /etc/config/network

and add the following to your wireguard peer config section:

        list allowed_ips '0.0.0.0/1'
        list allowed_ips '128.0.0.0/2'
        list allowed_ips '192.0.0.0/9'
        list allowed_ips '192.128.0.0/11'
        list allowed_ips '192.160.0.0/13'
        list allowed_ips '192.168.1.0/24'
        list allowed_ips '192.168.2.0/23'
        list allowed_ips '192.168.4.0/22'
        list allowed_ips '192.168.8.0/21'
        list allowed_ips '192.168.16.0/20'
        list allowed_ips '192.168.32.0/19'
        list allowed_ips '192.168.64.0/18'
        list allowed_ips '192.168.128.0/17'
        list allowed_ips '192.169.0.0/16'
        list allowed_ips '192.170.0.0/15'
        list allowed_ips '192.172.0.0/14'
        list allowed_ips '192.176.0.0/12'
        list allowed_ips '192.192.0.0/10'
        list allowed_ips '193.0.0.0/8'
        list allowed_ips '194.0.0.0/7'
        list allowed_ips '196.0.0.0/6'
        list allowed_ips '200.0.0.0/5'
        list allowed_ips '208.0.0.0/4'
        list allowed_ips '224.0.0.0/3'
        option route_allowed_ips '1
Enter fullscreen mode Exit fullscreen mode

You can calculate allowed IPs using the following calculators:

Wireguard's AllowedIPs calculator
by Savely Krasovsky's

Pro Custodibus calculator

Top comments (0)