-此脚本僅與IPv6路由有關, 您購買的CN2/9929/SDWAN/Hiternet均為IPv4生效. IPv4多路由請點我. –
-This script is designed for IPv6 addresses only. CN2/9929/SDWAN/Hiternet means special routing profile for IPv4. CLICK HERE if you are searching for such route specification. –
如果您的 VM 具有多個運行商之 IPv6 地址(如電信 240e: 和 聯通 2408:),但正在經歷下列問題, 此幫助文檔為您之首選:
-
僅單一 IPv6 可從外部連接(某一 IP 無法連接)。
-
PPPoE 重撥或重啟後,默認路由失效或 IP 變動。
-
需要為特定線路(如電信)自動更新 DDNS 記錄。
-
希望指定特定流量(策略路由)走特定線路。
脚本用途: 用於自動掃描並測試所有 IPv6 地址的延遲,允許您指定最佳出口。在安裝為 systemd 服務後,它會在 IP 變動後(如 PPPoE 重撥)自動更新默認路由、策略路由和 DDNS 記錄,實現全自動化管理。
1. (可選) 驗證 DNS 解析
在執行腳本前,請確保您的 VM 可以正常解析域名。
驗證辦法: ping files.leikwanhost.com 若您正在使用 Debian 11 等系統而出現 ”unresolvable/ no such host” 錯誤, 請:
-
nano /etc/resolv.conf -
在文件頂部添加
nameserver 8.8.8.8 -
隨後
Ctrl +X,y,Enter以保存修改。
2. 獲得 Bash File 並執行
wget https://files.leikwanhost.com/v6-mng.sh
chmod +x v6-mng.sh
bash v6-mng.sh
3. 完成後使用辦法 (菜單式)
直接運行 bash v6-mng.sh 會進入交互式菜單。
首次配置 (推薦流程):
-
在菜單中選擇
1. 掃描和測試 IPv6 地址-
查看所有 IP 及其到
2400:3200::1的延遲。
-
-
選擇
2. 手動設置默认出口 IPv6-
從列表中選擇您希望的默認線路(例如「聯通」的最低延遲 IP)。
-
腳本會記住您選擇的運營商。
-
-
(可選) 選擇
3. 配置 DDNS (CF/DNSPOD/AliDNS)-
設置您的 API 密鑰,並將 DDNS 綁定到一個運營商(例如「電信」)。
-
-
(可選) 選擇
5. 開啟/關閉 策略路由-
如果您希望特定目標(如
2400:3200::1)始終走「電信」出口,可以在此配置。
-
-
(重要) 選擇
6. 安裝/更新 systemd 定時服務-
此為安裝步驟。
-
腳本會自動創建一個
systemd定時器。 -
此服務將在後台定期自動運行,執行:
-
檢查 IP 變動,自動更新「默認路由」(基於您在步驟 2 選擇的運營商)。
-
自動更新「策略路由」(如果啟用)。
-
自動更新「DDNS 記錄」(基Nín 您在步驟 3 綁定的運營商)。
-
-
使用中有任何問題, 歡迎先使用人工智慧/Telegram 群組交流, 隨後再提交工單。感謝您的合作。
This help document is your primary resource if your VM has multiple carrier-assigned IPv6 addresses (e.g., 240e: and 2408:) but is experiencing:
-
Only a single IPv6 address is reachable from external networks.
-
The default route fails or IPs change after a PPPoE reconnect or reboot.
-
Needing to auto-update DDNS records for a specific ISP line (e.g., “Telecom”).
-
Wanting to use Policy Routing for specific traffic.
Script Purpose: To automatically scan and latency-test all IPv6 addresses, allowing you to set the optimal egress route. When installed as a systemd service, it fully automates your setup by auto-updating the default route, policy routes, and DDNS records whenever your IPs change (e.g., after a PPPoE event).
1. (Optional) Verify DNS Resolution
Before proceeding, ensure your VM can resolve hostnames.
Verification: ping files.leikwanhost.com If you are using Debian 11 and encounter an “unresolvable/no such host” error, please:
-
nano /etc/resolv.conf -
Add
nameserver 8.8.8.8to the top of the file. -
Press
Ctrl + X, theny, andEnterto save.
2. Obtain and Execute the Bash File
(Replace [URL] with the actual URL where you hosted the script)
wget https://files.leikwanhost.com/v6-mng.sh
chmod +x v6-mng.sh
bash v6-mng.sh
3. Usage Instructions (Menu-Driven)
Running bash v6-mng.sh will launch the interactive menu.
First-Time Setup (Recommended Flow):
-
Select
1. 掃描和測試 IPv6 地址(Scan and Test)-
This shows all your IPs and their latency to
2400:3200::1.
-
-
Select
2. 手動設置默认出口 IPv6(Set Default Egress)-
Choose your preferred default line (e.g., the lowest-latency “Unicom” IP).
-
The script will remember your chosen ISP.
-
-
(Optional) Select
3. 配置 DDNS(Configure DDNS)-
Set up your API keys and bind the DDNS record to an ISP (e.g., “Telecom”).
-
-
(Optional) Select
5. 開啟/關閉 策略路由(Toggle Policy Route)-
Use this if you want specific traffic (e.g., to
2400:3200::1) to always use the “Telecom” egress.
-
-
(Important) Select
6. 安裝/更新 systemd 定時服務(Install Service)-
This is the installation step.
-
It creates a
systemdtimer to run the script automatically in the background. -
This service will:
-
Check for IP changes and auto-update the “Default Route” (based on the ISP you chose in Step 2).
-
Auto-update “Policy Routes” (if enabled).
-
Auto-update “DDNS Records” (based on the ISP you bound in Step 3).
-
-
Should you encounter any issues, you are welcome to first seek assistance through artificial intelligence/Telegram group discussions before submitting a support ticket. We appreciate your cooperation.


没有回复内容