OpenWRT - VPN Policy Routing in Detail & Case Study @VanTechCorner
OpenWRT - VPN Policy Routing in Detail & Case Study  @VanTechCorner
Uploaded October 2021 | Updated November 2026, 1 day ago
In this video, we will talk about VPN Policy Routing on OpenWRT. I will walk you through the installation, configuration of the vpn-policy-routing package using LuCI Web UI. In order to use dnsmasq’s ipset support, you will need to remove dnsmasq (which was come with OpenWRT) and install dnsmasq-full.
With vpn-policy-routing, we can configure the routing based on Policy, this is straightforward: fill in the source or destination port and IP address, and define the gateway interface and you are good to go.
For further configuration, we can use the Custom User File. I have created 2 different routing scenarios for this:
- Scenario 1: Only Facebook traffic will be routed through the VPN tunnel (wireguard), the rest of network traffic is routed through the WAN interface
- Scenario 2: All traffic will be routed through the VPN tunnel (wireguard), except local traffic (traffic to my local country).
For the above routing scenarios, I use the IP list (which was filtered from AS IP address prefix). Normally, these information can be obtained from the peering information page of the service provider (for example FB or Netflix).
You can find the IP List & Custom User File here -github.com/vantechcorner/OpenWRT-VPN-Policy-Based-Routing

Video timeframe:

00:00 - VPN Policy Routing on OpenWRT & Network Diagram
01:34 - Device & VPN Setup Overview (Habanero DVK running Wireguard)
02:07 - Install Packages - vpn-policy-routing, luci-app-vpn-policy-routing and dnsmasq-full
02:56 - VPN Policy Routing Overview on LuCI
03:33 - Policies - Routing based on Source, Destination IP and Port
06:12 - Custom User File - Routing based on IP Address List and AS Number
08:25 - Create a IP Address list from AS number
10:06 - Upload IP List & Custom User File to the router with WinSCP
11:03 - Scenario 1 - Only Facebook traffic through VPN, the rest through WAN
16:49 - Scenario 2 - All traffic through VPN, except traffic to my local country
21:57 - Thing to notice regarding VPN-Policy-Routing

Other resources:
- OpenWRT Wireguard Client setup - youtu.be/0_zQAp3V18c
- OpenWRT OpenVPN Client setup - youtu.be/WRWZmcKejhg
- VPN Policy Routing Docs - docs.openwrt.melmac.net/vpn-policy-routing

Good luck and see you all in the next video!
OpenWRT - VPN Policy Routing in Detail & Case StudyOpenWRT 10 Gbps - Install & Testing the Dell QLogic 57810 Dual Port 10 Gb Network AdapterOpenWRT - Install OpenWRT on the TP- Link TL-MR6400 4G LTE WiFi RouterReplace ISP ONT/ONU - Ubiquiti UFiber LOCO - Overview & ConfigurationOpenWRT - Intel N5105 Router PC WiFi Module Install & Configuration (QCA9880)OpenWRT - Xiaomi Wi-Fi 6 Router CR6608 Unboxing & Quick Speed TestPPPoE with VLAN is working fine on the BPI-R4 with OpenWrt 25 RC4.OpenWRT - WAN & LAN on Single Network Interface device with VLANOpenWRT - File Sharing Server on OpenWRT with Samba4 (SMB)Mercury SE106 2.5GbE Switch Unboxing - Budget-Friendly 2.5 Gigabit NetworkingOpenWRT 21.02 - Configure IPTV / UDP MulticastOpenWRT - Captive Portal - WiFi Splash Page
Van Tech Corner |

OpenWRT - VPN Policy Routing in Detail & Case Study

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER