From 8ce39caf3afe02f7fd0e0e012dd4fc842bd4dff2 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Wed, 23 Aug 2023 00:01:52 +0000 Subject: [PATCH] update --- CHANGELOG.md | 4 ++++ README.md | 4 ++-- scripts/build_nat_network.sh | 38 ++++++++++++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75410e8..1482e30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # 更新日志 +2023.08.22 + +- 使用ndppd进行独立IPV6映射解决MAC校验的问题,实测成功 + 2023.08.20 - iptables的映射存在重复的问题,已尝试修复 diff --git a/README.md b/README.md index f6f2208..5d22b94 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ ## 更新 -2023.08.22 +2023.08.23 -- 使用ndppd进行独立IPV6映射解决MAC校验的问题,实测成功 +- ndppd增加ARM架构的支持 [更新日志](CHANGELOG.md) diff --git a/scripts/build_nat_network.sh b/scripts/build_nat_network.sh index c40b7a7..5c94db7 100644 --- a/scripts/build_nat_network.sh +++ b/scripts/build_nat_network.sh @@ -43,6 +43,25 @@ check_cdn_file() { fi } +get_system_arch() { + local sysarch="$(uname -m)" + if [ "${sysarch}" = "unknown" ] || [ "${sysarch}" = "" ]; then + local sysarch="$(arch)" + fi + # 根据架构信息设置系统位数并下载文件,其余 * 包括了 x86_64 + case "${sysarch}" in + "i386" | "i686" | "x86_64") + system_arch="x86" + ;; + "armv7l" | "armv8" | "armv8l" | "aarch64") + system_arch="arch" + ;; + *) + system_arch="" + ;; + esac +} + ########## 查询信息 if ! command -v lshw >/dev/null 2>&1; then @@ -56,6 +75,9 @@ fi cdn_urls=("https://cdn.spiritlhl.workers.dev/" "https://cdn3.spiritlhl.net/" "https://cdn1.spiritlhl.net/" "https://ghproxy.com/" "https://cdn2.spiritlhl.net/") check_cdn_file +# 检测架构 +get_system_arch + # 检测IPV6相关的信息 if [ -f /usr/local/bin/pve_check_ipv6 ]; then ipv6_address=$(cat /usr/local/bin/pve_check_ipv6) @@ -67,13 +89,21 @@ fi if [ -f /usr/local/bin/pve_ipv6_gateway ]; then ipv6_gateway=$(cat /usr/local/bin/pve_ipv6_gateway) fi + # 配置 ndpresponder 的守护进程 if [ "$ipv6_prefixlen" -le 64 ]; then if [ ! -z "$ipv6_address" ] && [ ! -z "$ipv6_prefixlen" ] && [ ! -z "$ipv6_gateway" ] && [ ! -z "$ipv6_address_without_last_segment" ]; then - wget ${cdn_success_url}https://github.com/spiritLHLS/pve/releases/download/ndpresponder_x86/ndpresponder -O /usr/local/bin/ndpresponder - wget ${cdn_success_url}https://raw.githubusercontent.com/spiritLHLS/pve/main/extra_scripts/ndpresponder.service -O /etc/systemd/system/ndpresponder.service - chmod 777 /usr/local/bin/ndpresponder - chmod 777 /etc/systemd/system/ndpresponder.service + if [ "$system_arch" = "x86" ]; then + wget ${cdn_success_url}https://github.com/spiritLHLS/pve/releases/download/ndpresponder_x86/ndpresponder -O /usr/local/bin/ndpresponder + wget ${cdn_success_url}https://raw.githubusercontent.com/spiritLHLS/pve/main/extra_scripts/ndpresponder.service -O /etc/systemd/system/ndpresponder.service + chmod 777 /usr/local/bin/ndpresponder + chmod 777 /etc/systemd/system/ndpresponder.service + elif [ "$system_arch" = "arch" ]; then + wget ${cdn_success_url}https://github.com/spiritLHLS/pve/releases/download/ndpresponder_aarch64/ndpresponder -O /usr/local/bin/ndpresponder + wget ${cdn_success_url}https://raw.githubusercontent.com/spiritLHLS/pve/main/extra_scripts/ndpresponder.service -O /etc/systemd/system/ndpresponder.service + chmod 777 /usr/local/bin/ndpresponder + chmod 777 /etc/systemd/system/ndpresponder.service + fi fi fi