From 2f6913a7f2a21df502d948fceb2e6a795f836af2 Mon Sep 17 00:00:00 2001 From: Farid Musa Date: Mon, 1 Jan 2024 22:33:03 +0400 Subject: [PATCH] fix reroute rules --- start.d/secondary_ip_route.sh | 2 +- stop.d/secondary_ip_route.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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"