Skip to content

Instantly share code, notes, and snippets.

@tosiara
Created December 13, 2023 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tosiara/dd1a04482559b8e158abfda576912435 to your computer and use it in GitHub Desktop.
Save tosiara/dd1a04482559b8e158abfda576912435 to your computer and use it in GitHub Desktop.
conditional routing of guest network
#!/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