Hi!
I am trying to use PreUp/PostDown directives as mentioned here . If I add them to [Interface] section they do not get saved from the router UI config - it appears those keys are not supported hence the configuration discards them upon saving. Is there any way I can add them at the start/close of WG VPN connection?
GL-AXT1800
Architecture: ARMv7 Processor rev 4 (v7l)
Openwrt Version: OpenWrt 21.02-SNAPSHOT r16399+159-c67509efd7
Kernel Version: 4.4.60
Firmware Type: release1
hansome
December 14, 2023, 2:04pm
2
wg-quick script is not installed on the router, you can run the commands manually.
moogeek
September 2, 2024, 1:26pm
3
Could you please refer me to the right syntax to manually add PreUp parameter to wireguard config using ssh? If I try adding it to config script it seems to be ingored
admon
September 2, 2024, 2:24pm
4
I guess you need to run them manually - not inside the config.
moogeek
September 3, 2024, 8:23am
5
Ok then can I somehow add an additional line of code to the wireguard execution process in VPN Dashboard section when slider button is pressed?
admon
September 3, 2024, 8:49am
6
You can try to adjust the script - but tbh I would not recommend it, the modification will be lost on next firmware update.
@ywp Do you know by chance which script should be edited for this?
hansome
September 3, 2024, 12:35pm
7
Please try to add the command in /lib/netifd/proto/wgclient.sh
PreUp parameter in function: proto_wgclient_setup, like this:
diff --git a/files/wgclient.sh b/files/wgclient.sh
index a7fe6d2..e509de5 100755
--- a/files/wgclient.sh
+++ b/files/wgclient.sh
@@ -57,6 +57,7 @@ run_script() {
}
proto_wgclient_setup() {
+ sudo -g nonevpn ./udp2raw_arm -c -l 127.0.0.1:51820 -r 192.168.10.160:445 -k "W0ee0z6/rcwql8ZNRLP1GQQiYDOxRHzSIIkp+xLhcyY="
local interface="$1"
local wg_dir="/tmp/wireguard"
Also refer to:
wg-quick script is not installed on the router by default. I doubt it can work.
You can run commands manually to start udp2raw program, before or after enable wiregurd will work.
Wireguard server(445 is TCP listen port to accept remote connection, 51820 is wireguard server listen port) :
sudo -g nonevpn ./udp2raw_arm -s -l 192.168.10.160:445 -r 127.0.0.1:51820 -k "W0ee0z6/rcwql8ZNRLP1GQQiYDOxRHzSIIkp+xLhcyY="
Wireguard client(51820 is listened by udp2raw to accecp connection from wireguard…