This is not the latest version of this documentation, for the one that is upto date, please see the latest version (2.6.9)
Policy-based routing (PBR) is a technique used in computer networking to control how network traffic is routed based on specific policies or criteria.
Traditionally, network traffic is routed based on the destination address in the packet header, using a routing table to determine the appropriate path to take. However, with PBR, the routing decision is based on other factors such as the source address, protocol, port number, destination address etc.
Network Settings - Routes - Policy Based
For purposes of demonstration we’re going to create 3 policy routes for 3 different devices on the LAN the above image is what our end goal should look like.
If you might’ve noticed the first policy route is not really needed, since any connections to the outside world already goes through the WAN interface.
Now coming to the second policy route, that is something we will have to specifically look out for since WWAN module is always the failover interface, it will never be used as the main gateway.
This is what the rule would look like when you’re trying to add it:
As you can see I’ve specified mullvad.net as one of my destination domains and the interface as 4G, you can specify any number of domains as you like, you need not specify each subdomain of a domain just the domain itself. For instance you do not have to give:
Instead just:
will suffice.
If you’d like you can choose from the pre-made list that we’ve setup it has a plethora of websites that are usually routed with PBR.
Network Settings - Routes - Policy Based - Use List
If you think the list is not up to date enough you can always append your own selection of domains along with it.
Moving onto the 3rd policy route, things are very similar to that of the second rule. Instead of choosing 4G as your interface you’d just choose the wireguard interface. Please note that the wireguard interface name might look something like wgc_Name instead of just Name.