From dd655a6db9fb41620d042a0b727d6221321e31e2 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Fri, 10 Jan 2025 00:43:27 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=BF=AE=E5=A4=8D=20arch=20=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E5=8E=9F=E7=B3=BB=E7=BB=9F=E6=97=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=20ipv6=20=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/reinstall.sh b/reinstall.sh index 9b19085..8964a97 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -2373,14 +2373,17 @@ collect_netconf() { # ip -6 route show default # default via 2602:1111:0:80::1 dev eth0 metric 1024 onlink pref medium + # arch + vultr + # ip -6 route show default + # default nhid 4011550343 via fe80::fc00:5ff:fe3d:2714 dev enp1s0 proto ra metric 1024 expires 1504sec pref medium + for v in 4 6; do - if ethx=$(ip -$v route show default | awk '$4=="dev"' | head -1 | awk '{print $5}' | grep .); then - if ip -$v route show default | awk '$5=="'$ethx'"' | head -1 | grep -q .; then - eval ipv${v}_ethx="$ethx" # can_use_cloud_kernel 要用 - eval ipv${v}_mac="$(ip link show dev $ethx | grep link/ether | head -1 | awk '{print $2}')" - eval ipv${v}_gateway="$(ip -$v route show default | awk '$5=="'$ethx'"' | head -1 | awk '{print $3}')" - eval ipv${v}_addr="$(ip -$v -o addr show scope global dev $ethx | grep -v temporary | head -1 | awk '{print $4}')" - fi + if via_gateway_dev_ethx=$(ip -$v route show default | grep -Ewo 'via [^ ]+ dev [^ ]+' | head -1 | grep .); then + read -r _ gateway _ ethx <<<"$via_gateway_dev_ethx" + eval ipv${v}_ethx="$ethx" # can_use_cloud_kernel 要用 + eval ipv${v}_mac="$(ip link show dev $ethx | grep link/ether | head -1 | awk '{print $2}')" + eval ipv${v}_gateway="$gateway" + eval ipv${v}_addr="$(ip -$v -o addr show scope global dev $ethx | grep -v temporary | head -1 | awk '{print $4}')" fi done fi