Hello. I have Asus ax3000v2 Firmware Version:3.0.0.4.2024_1 (update for fresh tomato firmware its base on stock AsusWrt but with open jffs, so i a can use scripts)
I use standard Wireguard Vpn (Vpn Fusion) client from web Ui to connect vpn, its work fine, but i need some function to route my traffic only for some site or ip routing by Wireguard, and all other traffic is work with out vpn just like standard.
Any way to do this?
my experiments is:
In file system i found "/etc/wg/wgc5_route" file with route ip's "0.0.0.0/0,::/0" for put all traffic through the vpn, i try edit it and add some IP that i need, but when i start Wireguard its change again to default "0.0.0.0/0,::/0"
So maybe if change some how "0.0.0.0/0,::/0" with my IP when Wireguard is start and create route rules its works?
I try to create some crap scrip by Chat Gpt, and its works, its change IP "0.0.0.0/0,::/0" in "wgc5_route" to my IP, but only when WG is already work and ruls is create. But it doesn't take any resolts.
Wg_ublock.sh
So i try make it auto-run Main WG route script when Wireguard VPN is starting manually by create "/jffs/scripts/wan-start" script
and add in it line to run other script "start_wireguard.sh" to run main route WG script (oh lol i know its stupid)
sh /path/to/start_wireguard.sh
Of course its don't work. And i stick in this way.
So maybe some one have idea how with this crapy scripts or with out it, make the way to route Wireguard only for some IP through the vpn?
I use standard Wireguard Vpn (Vpn Fusion) client from web Ui to connect vpn, its work fine, but i need some function to route my traffic only for some site or ip routing by Wireguard, and all other traffic is work with out vpn just like standard.
Any way to do this?
my experiments is:
In file system i found "/etc/wg/wgc5_route" file with route ip's "0.0.0.0/0,::/0" for put all traffic through the vpn, i try edit it and add some IP that i need, but when i start Wireguard its change again to default "0.0.0.0/0,::/0"
So maybe if change some how "0.0.0.0/0,::/0" with my IP when Wireguard is start and create route rules its works?
I try to create some crap scrip by Chat Gpt, and its works, its change IP "0.0.0.0/0,::/0" in "wgc5_route" to my IP, but only when WG is already work and ruls is create. But it doesn't take any resolts.
Wg_ublock.sh
Code:
#!/bin/sh
WGC5_ROUTE="/etc/wg/wgc5_route" # Path to the wgc5_route file
UNBLOCK_WG_FILE="/mnt/sdb2/WG/unblock_wg.txt" # Path to the file with routes
update_wgc5_route() {
# Check the existence of files
if [ ! -f "$WGC5_ROUTE" ]; then
echo "Error: File $WGC5_ROUTE not found."
exit 1
fi
if [ ! -f "$UNBLOCK_WG_FILE" ]; then
echo "Error: File $UNBLOCK_WG_FILE not found."
exit 1
fi
# Remove the line 0.0.0.0/0,::/0 from the wgc5_route file
sed -i '/0\.0\.0\.0\/0,::\/0/d' "$WGC5_ROUTE"
# Add routes to the wgc5_route file
cat "$UNBLOCK_WG_FILE" >> "$WGC5_ROUTE"
echo "Routes added to $WGC5_ROUTE:"
cat "$UNBLOCK_WG_FILE"
}
# Check if WireGuard is running with the interface name "wgc5"
if wg show wgc5 > /dev/null 2>&1; then
echo "WireGuard is running."
update_wgc5_route
else
echo "Error: WireGuard with interface name 'wgc5' is not running. Start WireGuard first."
exit 1
fi
echo "Routes updated successfully."
So i try make it auto-run Main WG route script when Wireguard VPN is starting manually by create "/jffs/scripts/wan-start" script
and add in it line to run other script "start_wireguard.sh" to run main route WG script (oh lol i know its stupid)
sh /path/to/start_wireguard.sh
Code:
#!/bin/sh
# Path to your script
SCRIPT_PATH="/mnt/sdb2/WG/Wg_ublock.sh"
# Run the script on WireGuard startup
if [ -x "$SCRIPT_PATH" ]; then
sh "$SCRIPT_PATH"
fi
So maybe some one have idea how with this crapy scripts or with out it, make the way to route Wireguard only for some IP through the vpn?
Last edited: