[modify] make mavvlan take effect by putting this action 20s after NIC setting

This commit is contained in:
2023-08-28 11:42:13 +08:00
parent ce95c20bc4
commit 19f72612cd
2 changed files with 8 additions and 4 deletions

View File

@ -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