diff --git a/start.d/secondary_ip_route.sh b/start.d/secondary_ip_route.sh index 3ea1d74..5043d5a 100644 --- a/start.d/secondary_ip_route.sh +++ b/start.d/secondary_ip_route.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -ex -default_iface=$(ip route | grep default | awk '{print $5}') +default_iface=$(ip route | grep default | head -n 1 | awk '{print $5}') iptables -t nat -I POSTROUTING -s "$OVPN_NET_SUBNET" -o "$default_iface" -j SNAT --to-source "$OVPN_PUBLIC_IP" diff --git a/stop.d/secondary_ip_route.sh b/stop.d/secondary_ip_route.sh index 8b4bae7..816a3fa 100644 --- a/stop.d/secondary_ip_route.sh +++ b/stop.d/secondary_ip_route.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -ex -default_iface=$(ip route | grep default | awk '{print $5}') +default_iface=$(ip route | grep default | head -n 1 | awk '{print $5}') iptables -t nat -D POSTROUTING -s "$OVPN_NET_SUBNET" -o "$default_iface" -j SNAT --to-source "$OVPN_PUBLIC_IP"