From c47aa6fa382e0015f210eea739fcc73044a291af Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Tue, 30 May 2023 22:19:52 +0800 Subject: [PATCH] Update build_nat_network.sh --- scripts/build_nat_network.sh | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/scripts/build_nat_network.sh b/scripts/build_nat_network.sh index 348d76e..b43f437 100644 --- a/scripts/build_nat_network.sh +++ b/scripts/build_nat_network.sh @@ -43,20 +43,22 @@ else fi gateway=$(ip route | awk '/default/ {print $3}') -# 获取母鸡子网前缀 -SUBNET_PREFIX=$(ip -6 addr show | grep -E 'inet6.*global' | awk '{print $2}' | awk -F'/' '{print $1}' | head -n 1 | cut -d ':' -f1-5): +# # 获取母鸡子网前缀 +# SUBNET_PREFIX=$(ip -6 addr show | grep -E 'inet6.*global' | awk '{print $2}' | awk -F'/' '{print $1}' | head -n 1 | cut -d ':' -f1-5): +# # 提取IPV6地址 +# content=$(cat /etc/network/interfaces.d/50-cloud-init) +# ipv6_line=$(echo "$content" | grep "address 2a12:bec0:150:1a::a/64") +# ipv6_address=$(echo "$ipv6_line" | awk '{print $2}') +# # 检查是否存在 IPV6 +# if [ -z "$SUBNET_PREFIX" ]; then +# _red "无 IPV6 子网,不进行自动映射" +# else +# _blue "母鸡的IPV6子网前缀为 $SUBNET_PREFIX" +# fi -# 提取IPV6地址 -content=$(cat /etc/network/interfaces.d/50-cloud-init) -ipv6_line=$(echo "$content" | grep "address 2a12:bec0:150:1a::a/64") -ipv6_address=$(echo "$ipv6_line" | awk '{print $2}') - -# 检查是否存在 IPV6 -if [ -z "$SUBNET_PREFIX" ]; then - _red "无 IPV6 子网,不进行自动映射" -else - _blue "母鸡的IPV6子网前缀为 $SUBNET_PREFIX" -fi +# iface vmbr0 inet6 static +# address $ipv6_address +# gateway ${SUBNET_PREFIX}1 # 录入网关 cp /etc/network/interfaces /etc/network/interfaces.bak @@ -71,9 +73,6 @@ iface vmbr0 inet static bridge_ports $interface bridge_stp off bridge_fd 0 -iface vmbr0 inet6 static - address $ipv6_address - gateway ${SUBNET_PREFIX}1 EOF fi if grep -q "vmbr1" /etc/network/interfaces; then