2023.08.26

This commit is contained in:
spiritlhl 2023-08-26 14:57:56 +00:00
parent 7d8b6bd3d0
commit 0d1cc0efa7
3 changed files with 35 additions and 6 deletions

View file

@ -16,6 +16,7 @@
2023.08.26
- 修复开设NAT网关时vmbr0如果不存在就去补全时的漏洞尝试支持第一第二步安装PVE不使用本仓库脚本的PVE创建NAT网关
- 给IPV6的识别增加ping检测如果ping不通当作IPV6不通避免有的商家设置的IPV6本身就有问题根本用不了还配置导致安装出问题
[更新日志](CHANGELOG.md)

View file

@ -1,7 +1,7 @@
#!/bin/bash
# from
# https://github.com/spiritLHLS/pve
# 2023.08.18
# 2023.08.26
# 用颜色输出信息
_red() { echo -e "\033[31m\033[01m$@\033[0m"; }
@ -157,6 +157,22 @@ if command -v lshw >/dev/null 2>&1; then
if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ]; then
:
else
while true; do
if ping -c 1 -6 -W 3 $ipv6_address >/dev/null 2>&1; then
echo "IPv6 address is reachable."
else
echo "IPv6 address is not reachable. Setting to empty."
echo "" > /usr/local/bin/pve_check_ipv6
fi
if ping -c 1 -6 -W 3 $ipv6_gateway >/dev/null 2>&1; then
echo "IPv6 gateway is reachable."
else
echo "IPv6 gateway is not reachable. Setting to empty."
echo "" > /usr/local/bin/pve_ipv6_gateway
fi
done
ipv6_address=$(cat /usr/local/bin/pve_check_ipv6)
ipv6_gateway=$(cat /usr/local/bin/pve_ipv6_gateway)
_green "The following IPV6 information is detected for this machine:"
_green "检测到本机的IPV6信息如下"
_green "ipv6_address: ${ipv6_address}"

View file

@ -1,7 +1,7 @@
#!/bin/bash
# from
# https://github.com/spiritLHLS/pve
# 2023.08.23
# 2023.08.26
########## 预设部分输出和部分中间变量
@ -802,15 +802,27 @@ if [ ! -f /usr/local/bin/pve_ipv6_prefixlen ] || [ ! -s /usr/local/bin/pve_ipv6_
fi
if [ ! -f /usr/local/bin/pve_ipv6_gateway ] || [ ! -s /usr/local/bin/pve_ipv6_gateway ] || [ "$(sed -e '/^[[:space:]]*$/d' /usr/local/bin/pve_ipv6_gateway)" = "" ]; then
ipv6_gateway=$(ip -6 route show | awk '/default via/{print $3}' | head -n1)
# ip -6 route show | awk '/default via/{print $3}' | head -n1
# if is_private_ipv6 "$ipv6_gateway"; then # 由于是内网IPV6地址不设置V6地址
# ipv6_gateway=""
echo "$ipv6_gateway" >/usr/local/bin/pve_ipv6_gateway
# fi
fi
ipv6_address=$(cat /usr/local/bin/pve_check_ipv6)
ipv6_prefixlen=$(cat /usr/local/bin/pve_ipv6_prefixlen)
ipv6_gateway=$(cat /usr/local/bin/pve_ipv6_gateway)
while true; do
if ping -c 1 -6 -W 3 $ipv6_address >/dev/null 2>&1; then
echo "IPv6 address is reachable."
else
echo "IPv6 address is not reachable. Setting to empty."
echo "" > /usr/local/bin/pve_check_ipv6
fi
if ping -c 1 -6 -W 3 $ipv6_gateway >/dev/null 2>&1; then
echo "IPv6 gateway is reachable."
else
echo "IPv6 gateway is not reachable. Setting to empty."
echo "" > /usr/local/bin/pve_ipv6_gateway
fi
done
ipv6_address=$(cat /usr/local/bin/pve_check_ipv6)
ipv6_gateway=$(cat /usr/local/bin/pve_ipv6_gateway)
# 检查50-cloud-init是否存在特定配置
if [ -f "/etc/network/interfaces.d/50-cloud-init" ]; then