更新 bin/ ZeroWrt.backup

Signed-off-by: zhao <zhao@noreply.localhost>
This commit is contained in:
zhao 2024-12-30 00:10:54 +08:00
parent efd654f44c
commit 9963877f08

View File

@ -51,7 +51,7 @@ show_menu() {
color_output "\e[36m┃\e[0m 0. 退出 \e[36m┃\e[0m"
color_output "\e[36m┃ ┃\e[0m"
color_output "\e[36m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\e[0m"
read -p "$(color_output "\e[33m请输入您的选择 [0-0]: \e[0m")" choice
read -p "$(color_output "\e[33m请输入您的选择 [0-8]: \e[0m")" choice
case "$choice" in
1) change_ip ;;
2) change_password ;;
@ -59,7 +59,7 @@ show_menu() {
4) reset_config ;;
5) change_source ;;
6) install_apps ;;
7) toggle_ipv6 ;;
7) configure_ipv6 ;;
7) check_update ;;
0) exit 0 ;;
*) echo "无效选项,请重新输入"; show_menu ;;
@ -322,57 +322,84 @@ install_apps() {
done
}
# 7. Ipv6 开关
toggle_ipv6() {
color_output "\e[34m[IPv6 开关]\e[0m"
# 添加 IPv6 配置功能函数
configure_ipv6() {
color_output "\e[34m[IPv6 设置]\e[0m"
# 检查当前 IPv6 状态
local current_status=$(uci -q get network.lan.ipv6)
if [ "$current_status" = "0" ]; then
status_text="已禁用"
# 检查当前状态
local current_ra=$(uci -q get dhcp.lan.ra)
local current_dhcpv6=$(uci -q get dhcp.lan.dhcpv6)
local current_ndp=$(uci -q get dhcp.lan.ndp)
local current_filter_aaaa=$(uci -q get dhcp.@dnsmasq[0].filter_aaaa)
if [ "$current_ra" = "server" ] && [ "$current_dhcpv6" = "server" ]; then
status_text="已开启"
else
status_text="已启用"
status_text="已关闭"
fi
color_output "\e[36m当前 IPv6 状态: $status_text\e[0m"
color_output "\e[36m请选择操作\e[0m"
color_output "1. 启 IPv6"
color_output "2. 禁用 IPv6"
color_output "1. 启 IPv6"
color_output "2. 关闭 IPv6"
color_output "0. 返回主菜单"
read -p "请输入选择 [0-2]: " ipv6_choice
case "$ipv6_choice" in
1)
# 启用 IPv6
uci set network.lan.ipv6='1'
uci set network.wan.ipv6='1'
# 开启 IPv6
# RA 服务设置为服务模式
uci set dhcp.lan.ra='server'
# DHCPv6 服务设置为服务模式
uci set dhcp.lan.dhcpv6='server'
uci set dhcp.lan.ra_management='1'
uci set dhcp.lan.ra_default='1'
uci commit network
# IPv6 分配长度设置为64
uci set dhcp.lan.ndp='64'
# 取消过滤 IPv6 AAAA 记录
uci set dhcp.@dnsmasq[0].filter_aaaa='0'
# 保存设置
uci commit dhcp
/etc/init.d/network restart
# 重启相关服务
/etc/init.d/odhcpd restart
color_output "\e[32mIPv6 已启用,网络正在重启...\e[0m"
/etc/init.d/dnsmasq restart
color_output "\e[32mIPv6 已开启!\e[0m"
color_output "\e[32m- RA 服务: 服务模式\e[0m"
color_output "\e[32m- DHCPv6 服务: 服务模式\e[0m"
color_output "\e[32m- IPv6 分配长度: 64\e[0m"
color_output "\e[32m- IPv6 AAAA 记录过滤: 已关闭\e[0m"
;;
2)
# 禁用 IPv6
uci set network.lan.ipv6='0'
uci set network.wan.ipv6='0'
# 关闭 IPv6
# RA 服务设置为已禁用
uci set dhcp.lan.ra='disabled'
# DHCPv6 服务设置为已禁用
uci set dhcp.lan.dhcpv6='disabled'
uci commit network
# IPv6 分配长度设置为已禁用
uci set dhcp.lan.ndp='disabled'
# 开启过滤 IPv6 AAAA 记录
uci set dhcp.@dnsmasq[0].filter_aaaa='1'
# 保存设置
uci commit dhcp
/etc/init.d/network restart
# 重启相关服务
/etc/init.d/odhcpd restart
color_output "\e[32mIPv6 已禁用,网络正在重启...\e[0m"
/etc/init.d/dnsmasq restart
color_output "\e[32mIPv6 已关闭!\e[0m"
color_output "\e[32m- RA 服务: 已禁用\e[0m"
color_output "\e[32m- DHCPv6 服务: 已禁用\e[0m"
color_output "\e[32m- IPv6 分配长度: 已禁用\e[0m"
color_output "\e[32m- IPv6 AAAA 记录过滤: 已开启\e[0m"
;;
0)
show_menu
return
;;
*)
color_output "\e[31m无效选择\e[0m"
;;
@ -382,6 +409,7 @@ toggle_ipv6() {
read -p "按 Enter 键返回菜单..."
show_menu
}
# 8. 检测更新
check_update() {
color_output "\e[34m[检测更新]\e[0m"