From 19f72612cdf81ecd964a1e129cde1c4d6a680159 Mon Sep 17 00:00:00 2001 From: gitea Date: Mon, 28 Aug 2023 11:42:13 +0800 Subject: [PATCH] [modify] make mavvlan take effect by putting this action 20s after NIC setting --- update/init.sh | 5 +++-- update/macvlan.sh | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/update/init.sh b/update/init.sh index a99de64..8299686 100644 --- a/update/init.sh +++ b/update/init.sh @@ -5,12 +5,13 @@ /usr/bin/bash /opt/scripts/update/calibre.sh mv /opt/wd/99-Temp/shutdown /opt/wd/99-Temp/shutdown.old #============================================================================== -/usr/bin/bash /opt/scripts/update/macvlan.sh -#============================================================================== ip link set enp1s0 promisc on ip link set enp2s0 promisc on ip link set wlx90de80ca01ec promisc on #============================================================================== +sleep 20 +/usr/bin/bash /opt/scripts/update/macvlan.sh +#============================================================================== /usr/bin/bash /opt/scripts/update/jekyll_update.sh # /usr/bin/mount -t ext4 -w UUID="b7c2c4b8-bfde-479b-80bb-655432a433b8" /opt/wd diff --git a/update/macvlan.sh b/update/macvlan.sh index ef49b55..486608c 100644 --- a/update/macvlan.sh +++ b/update/macvlan.sh @@ -1,6 +1,9 @@ #!/bin/bash -gateway=`ip route | head -n 1 | grep -Eow '([0-9]{1,3}.){3}[0-9]{1,3}'` +for i in `seq 3`; do + gateway=`ip route | head -n 1 | grep -Eow '([0-9]{1,3}.){3}[0-9]{1,3}'` + [[ $gateway == '' ]] && { sleep 3; continue; } +done [[ $gateway == '' ]] && exit 9 num1=`echo $gateway | awk -F '.' '{print $1}'` @@ -16,7 +19,7 @@ done ip link add main2wrt link enp1s0 type macvlan mode bridge ip addr add $IP dev main2wrt ip link set main2wrt up -ip route add $IP dev main2wrt +ip route add 192.168.10.123 dev main2wrt ip link set main2wrt promisc on