Use hotplug iface to up ipsec when WAN connect

Dear all,
I want to konw how to use hotplug iface to up my ipsec vpn when WAN was connected.
I want to automatically execute the following command as follow.

Thanks a lot!

For example

/etc/init.d/ipsec enable
/etc/init.d/xl2tpd enable
/etc/init.d/ipsec restart
/etc/init.d/xl2tpd restart
ipsec restart
ipsec up L2TP-PSK
ipsec statusall
echo "c strong-vpn" > /var/run/xl2tpd/l2tp-control

https://openwrt.org/docs/guide-user/base-system/hotplug

1 Like