2023.11.27

This commit is contained in:
spiritlhl 2023-11-27 15:20:49 +00:00
parent 650592023f
commit cea94a5c11
4 changed files with 33 additions and 8 deletions

View file

@ -1,5 +1,10 @@
# 更新日志
2023.11.26
- 重新计算IPV6子网的前缀适配宿主机虽然给了子网但默认的IPV6地址是随机给的非```::1```或```::a```结尾的情况
- 重新设计虚拟机/容器的IPV6网关配置逻辑适配宿主机的IPV6的gateway可能恰好是该子网第一个IPV6的情况
2023.11.25
- 放松IPV6的gateway判断条件部分宿主机的gateway直接通过```ip -6 route add default via```加上去的还行此时虽然fe80地址不通但不影响v6使用

View file

@ -13,10 +13,9 @@
## 更新
2023.11.26
2023.11.27
- 重新计算IPV6子网的前缀适配宿主机虽然给了子网但默认的IPV6地址是随机给的非```::1```或```::a```结尾的情况
- 重新设计虚拟机/容器的IPV6网关配置逻辑适配宿主机的IPV6的gateway可能恰好是该子网第一个IPV6的情况
- 完善IPV6检测机制尽量保证识别出准确的IPV6子网掩码和子网前缀且尽量保证ndp可用
[更新日志](CHANGELOG.md)

View file

@ -297,7 +297,7 @@ if grep -q "vmbr0" "/etc/network/interfaces"; then
_blue "vmbr0 already exists in /etc/network/interfaces"
_blue "vmbr0 已存在在 /etc/network/interfaces"
else
if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ]; then
if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ] && [ ! -f /usr/local/bin/pve_last_ipv6 ]; then
cat <<EOF | sudo tee -a /etc/network/interfaces
auto vmbr0
iface vmbr0 inet static
@ -307,7 +307,7 @@ iface vmbr0 inet static
bridge_stp off
bridge_fd 0
EOF
elif [ -f "/usr/local/bin/iface_auto.txt" ]; then
elif [ -f "/usr/local/bin/iface_auto.txt" ] && [ ! -f /usr/local/bin/pve_last_ipv6 ]; then
cat <<EOF | sudo tee -a /etc/network/interfaces
auto vmbr0
iface vmbr0 inet static
@ -319,6 +319,24 @@ iface vmbr0 inet static
iface vmbr0 inet6 auto
bridge_ports $interface
EOF
elif [ -f /usr/local/bin/pve_last_ipv6 ]; then
last_ipv6=$(cat /usr/local/bin/pve_last_ipv6)
cat <<EOF | sudo tee -a /etc/network/interfaces
auto vmbr0
iface vmbr0 inet static
address $ipv4_address
gateway $ipv4_gateway
bridge_ports $interface
bridge_stp off
bridge_fd 0
iface vmbr0 inet6 static
address ${last_ipv6}
gateway ${ipv6_gateway}
iface vmbr0 inet6 static
address ${ipv6_address}/128
EOF
else
cat <<EOF | sudo tee -a /etc/network/interfaces
@ -331,14 +349,14 @@ iface vmbr0 inet static
bridge_fd 0
iface vmbr0 inet6 static
address ${ipv6_address}/${ipv6_prefixlen}
gateway ${ipv6_gateway}
address ${ipv6_address}/128
gateway ${ipv6_gateway}
EOF
fi
fi
if [[ "${ipv6_gateway_fe80}" == "N" ]]; then
chattr -i /etc/network/interfaces
echo " up ip addr del $fe80_address dev $interface" >> /etc/network/interfaces
echo " up ip addr del $fe80_address dev $interface" >> /etc/network/interfaces
remove_duplicate_lines "/etc/network/interfaces"
chattr -i /etc/network/interfaces
fi

View file

@ -31,6 +31,9 @@ if [ $pct_status -eq 0 ] && [ $qm_status -eq 0 ]; then
_green "Proxmox VE已经安装无需重复安装。"
exit 1
fi
if [ ! -d /usr/local/bin ]; then
mkdir -p /usr/local/bin
fi
########## 备份配置文件