Anoopnk DD-WRT Novice
Joined: 07 Jun 2021 Posts: 12
|
Posted: Thu Sep 29, 2022 12:03 Post subject: high priority for custom routing policy |
|
Hi,
I'm trying to set a custom policy such that all ssh connection (port 22) always goes through WAN while other connections goes through PBR defined for each WG connection.
Problem is that Routing Policies set by WG always takes higher priority than the custom which makes no sense. How do I force to keep my custom policies to have higher priority and let the WG config work as normal?
I attach a screenshot to help you understand. If I'm making a mistake in setting it up, I wouldn't be surprised.
-----------
Netgear R6800
Firmware Version: DD-WRT v3.0-r50176 std (09/15/22)
Kernel Version: Linux 4.14.292 #2854 SMP Thu Sep 15 03:23:31 +07 2022 mips |
|
egc DD-WRT Guru
Joined: 18 Mar 2014 Posts: 12882 Location: Netherlands
|
Posted: Thu Sep 29, 2022 16:16 Post subject: |
|
One way to do that is to make your custom PBR rules after the tunnels so with the use of the Route-up script of the WG tunnel, below is just an example adapt for you own situation:
Quote: | Custom PBR script
If you want to add your custom PBR script with a lower priority (so that it is executed first) add a custom PBR script to the Route-up script of the last tunnel.
One way to do this is to add the following to Administration commands and Save as Custom.
An example of a custom PBR script is routing port 22 (SSH) always via the WAN:
#custom PBR routing table
#choose table nr
TID="table 19"
#delete before making new
while ip rule delete from 0/0 to 0/0 $TID >/dev/null 2>&1; do true; done
ip route flush $TID
#set rules
ip rule add sport 22 $TID
#set routes
ip route add default via $(nvram get wan_gateway) $TID
In the Route-up script box of the last tunnel add:
/tmp/.rc_custom
|
_________________ Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087 |
|