Created
December 13, 2023 11:41
-
-
Save tosiara/dd1a04482559b8e158abfda576912435 to your computer and use it in GitHub Desktop.
conditional routing of guest network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
table=nordvpn | |
wifi=wlan1-2 | |
wifi_if=nordvpn | |
wg=wg0 | |
if [ "$INTERFACE" == "$wg" ]; then | |
if [ "$ACTION" == "ifup" ]; then | |
logger "NORDVPN: $INTERFACE $ACTION" | |
ip route add default dev $wg table $table proto static | |
fi | |
fi | |
if [ "$INTERFACE" == "$wifi_if" ]; then | |
if [ "$ACTION" == "ifup" ]; then | |
logger "NORDVPN: $INTERFACE $ACTION" | |
ip rule add iif $wifi lookup $table | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment