diff --git a/CHANGELOG.md b/CHANGELOG.md index eba0428..15b6015 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 +2023.08.26 + +- 修复开设NAT网关时,vmbr0如果不存在就去补全时的漏洞,尝试支持第一第二步安装PVE不使用本仓库脚本的PVE创建NAT网关 +- 给IPV6的识别增加ping检测,如果ping不通当作IPV6不通,避免有的商家设置的IPV6本身就有问题根本用不了还配置,导致安装出问题 + 2023.08.23 - ndppd增加ARM架构的支持 diff --git a/README.md b/README.md index e1f2c5a..186a8ff 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,9 @@ ## 更新 -2023.08.26 +2023.08.27 -- 修复开设NAT网关时,vmbr0如果不存在就去补全时的漏洞,尝试支持第一第二步安装PVE不使用本仓库脚本的PVE创建NAT网关 -- 给IPV6的识别增加ping检测,如果ping不通当作IPV6不通,避免有的商家设置的IPV6本身就有问题根本用不了还配置,导致安装出问题 +- 将删除物理网关的操作移动到创建vmbr0之前,而不是原来的创建vmbr1之前 [更新日志](CHANGELOG.md) diff --git a/scripts/build_nat_network.sh b/scripts/build_nat_network.sh index bf1c4b1..c40e55d 100644 --- a/scripts/build_nat_network.sh +++ b/scripts/build_nat_network.sh @@ -357,26 +357,28 @@ if [ -f "/usr/local/bin/ndpresponder" ]; then fi # 删除可能存在的原有的网卡配置 -cp /etc/network/interfaces /etc/network/interfaces_nat.bak -chattr -i /etc/network/interfaces -input_file="/etc/network/interfaces" -output_file="/etc/network/interfaces.tmp" -start_pattern="iface lo inet loopback" -end_pattern="auto vmbr0" -delete_lines=0 -while IFS= read -r line; do - if [[ $line == *"$start_pattern"* ]]; then - delete_lines=1 - fi - if [ $delete_lines -eq 0 ] || [[ $line == *"$start_pattern"* ]] || [[ $line == *"$end_pattern"* ]]; then - echo "$line" >>"$output_file" - fi - if [[ $line == *"$end_pattern"* ]]; then - delete_lines=0 - fi -done <"$input_file" -mv "$output_file" "$input_file" -chattr +i /etc/network/interfaces +if [ ! -f /etc/network/interfaces_nat.bak ]; then + cp /etc/network/interfaces /etc/network/interfaces_nat.bak + chattr -i /etc/network/interfaces + input_file="/etc/network/interfaces" + output_file="/etc/network/interfaces.tmp" + start_pattern="iface lo inet loopback" + end_pattern="auto vmbr0" + delete_lines=0 + while IFS= read -r line; do + if [[ $line == *"$start_pattern"* ]]; then + delete_lines=1 + fi + if [ $delete_lines -eq 0 ] || [[ $line == *"$start_pattern"* ]] || [[ $line == *"$end_pattern"* ]]; then + echo "$line" >>"$output_file" + fi + if [[ $line == *"$end_pattern"* ]]; then + delete_lines=0 + fi + done <"$input_file" + mv "$output_file" "$input_file" + chattr +i /etc/network/interfaces +fi # 已加载网络,删除对应缓存文件 if [ -f "/etc/network/interfaces.new" ]; then diff --git a/scripts/install_pve.sh b/scripts/install_pve.sh index a62541b..258327d 100644 --- a/scripts/install_pve.sh +++ b/scripts/install_pve.sh @@ -802,9 +802,9 @@ 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) - if [[ "${ipv6_gateway: -2}" == "::" ]]; then - ipv6_gateway="${ipv6_gateway}0000" - fi + # if [[ "${ipv6_gateway: -2}" == "::" ]]; then + # ipv6_gateway="${ipv6_gateway}0000" + # fi echo "$ipv6_gateway" >/usr/local/bin/pve_ipv6_gateway fi ipv6_address=$(cat /usr/local/bin/pve_check_ipv6) @@ -1205,7 +1205,7 @@ iface vmbr0 inet static bridge_fd 0 iface vmbr0 inet6 static - address ${ipv6_address_without_last_segment}/128 + address ${ipv6_address_without_last_segment}:1/128 gateway ${ipv6_gateway} EOF fi @@ -1239,6 +1239,28 @@ if [ ! -s "/etc/resolv.conf" ]; then fi fi +# 删除可能存在的原有的网卡配置 +cp /etc/network/interfaces /etc/network/interfaces_nat.bak +chattr -i /etc/network/interfaces +input_file="/etc/network/interfaces" +output_file="/etc/network/interfaces.tmp" +start_pattern="iface lo inet loopback" +end_pattern="auto vmbr0" +delete_lines=0 +while IFS= read -r line; do + if [[ $line == *"$start_pattern"* ]]; then + delete_lines=1 + fi + if [ $delete_lines -eq 0 ] || [[ $line == *"$start_pattern"* ]] || [[ $line == *"$end_pattern"* ]]; then + echo "$line" >>"$output_file" + fi + if [[ $line == *"$end_pattern"* ]]; then + delete_lines=0 + fi +done <"$input_file" +mv "$output_file" "$input_file" +chattr +i /etc/network/interfaces + # 安装必备模块并替换apt源中的无效订阅 cp /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak # echo "deb http://download.proxmox.com/debian/pve $(lsb_release -sc) pve-no-subscription" > /etc/apt/sources.list.d/pve-enterprise.list