更新 bin/ ZeroWrt.backup
Signed-off-by: zhao <zhao@noreply.localhost>
This commit is contained in:
parent
efd654f44c
commit
9963877f08
@ -51,7 +51,7 @@ show_menu() {
|
|||||||
color_output "\e[36m┃\e[0m 0. 退出 \e[36m┃\e[0m"
|
color_output "\e[36m┃\e[0m 0. 退出 \e[36m┃\e[0m"
|
||||||
color_output "\e[36m┃ ┃\e[0m"
|
color_output "\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
|
case "$choice" in
|
||||||
1) change_ip ;;
|
1) change_ip ;;
|
||||||
2) change_password ;;
|
2) change_password ;;
|
||||||
@ -59,7 +59,7 @@ show_menu() {
|
|||||||
4) reset_config ;;
|
4) reset_config ;;
|
||||||
5) change_source ;;
|
5) change_source ;;
|
||||||
6) install_apps ;;
|
6) install_apps ;;
|
||||||
7) toggle_ipv6 ;;
|
7) configure_ipv6 ;;
|
||||||
7) check_update ;;
|
7) check_update ;;
|
||||||
0) exit 0 ;;
|
0) exit 0 ;;
|
||||||
*) echo "无效选项,请重新输入"; show_menu ;;
|
*) echo "无效选项,请重新输入"; show_menu ;;
|
||||||
@ -322,57 +322,84 @@ install_apps() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# 7. Ipv6 开关
|
# 添加 IPv6 配置功能函数
|
||||||
toggle_ipv6() {
|
configure_ipv6() {
|
||||||
color_output "\e[34m[IPv6 开关]\e[0m"
|
color_output "\e[34m[IPv6 设置]\e[0m"
|
||||||
|
|
||||||
# 检查当前 IPv6 状态
|
# 检查当前状态
|
||||||
local current_status=$(uci -q get network.lan.ipv6)
|
local current_ra=$(uci -q get dhcp.lan.ra)
|
||||||
if [ "$current_status" = "0" ]; then
|
local current_dhcpv6=$(uci -q get dhcp.lan.dhcpv6)
|
||||||
status_text="已禁用"
|
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
|
else
|
||||||
status_text="已启用"
|
status_text="已关闭"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
color_output "\e[36m当前 IPv6 状态: $status_text\e[0m"
|
color_output "\e[36m当前 IPv6 状态: $status_text\e[0m"
|
||||||
color_output "\e[36m请选择操作:\e[0m"
|
color_output "\e[36m请选择操作:\e[0m"
|
||||||
color_output "1. 启用 IPv6"
|
color_output "1. 开启 IPv6"
|
||||||
color_output "2. 禁用 IPv6"
|
color_output "2. 关闭 IPv6"
|
||||||
color_output "0. 返回主菜单"
|
color_output "0. 返回主菜单"
|
||||||
|
|
||||||
read -p "请输入选择 [0-2]: " ipv6_choice
|
read -p "请输入选择 [0-2]: " ipv6_choice
|
||||||
|
|
||||||
case "$ipv6_choice" in
|
case "$ipv6_choice" in
|
||||||
1)
|
1)
|
||||||
# 启用 IPv6
|
# 开启 IPv6
|
||||||
uci set network.lan.ipv6='1'
|
# RA 服务设置为服务模式
|
||||||
uci set network.wan.ipv6='1'
|
|
||||||
uci set dhcp.lan.ra='server'
|
uci set dhcp.lan.ra='server'
|
||||||
|
# DHCPv6 服务设置为服务模式
|
||||||
uci set dhcp.lan.dhcpv6='server'
|
uci set dhcp.lan.dhcpv6='server'
|
||||||
uci set dhcp.lan.ra_management='1'
|
# IPv6 分配长度设置为64
|
||||||
uci set dhcp.lan.ra_default='1'
|
uci set dhcp.lan.ndp='64'
|
||||||
uci commit network
|
# 取消过滤 IPv6 AAAA 记录
|
||||||
|
uci set dhcp.@dnsmasq[0].filter_aaaa='0'
|
||||||
|
# 保存设置
|
||||||
uci commit dhcp
|
uci commit dhcp
|
||||||
/etc/init.d/network restart
|
|
||||||
|
# 重启相关服务
|
||||||
/etc/init.d/odhcpd 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)
|
2)
|
||||||
# 禁用 IPv6
|
# 关闭 IPv6
|
||||||
uci set network.lan.ipv6='0'
|
# RA 服务设置为已禁用
|
||||||
uci set network.wan.ipv6='0'
|
|
||||||
uci set dhcp.lan.ra='disabled'
|
uci set dhcp.lan.ra='disabled'
|
||||||
|
# DHCPv6 服务设置为已禁用
|
||||||
uci set dhcp.lan.dhcpv6='disabled'
|
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
|
uci commit dhcp
|
||||||
/etc/init.d/network restart
|
|
||||||
|
# 重启相关服务
|
||||||
/etc/init.d/odhcpd 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)
|
0)
|
||||||
show_menu
|
show_menu
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
color_output "\e[31m无效选择\e[0m"
|
color_output "\e[31m无效选择\e[0m"
|
||||||
;;
|
;;
|
||||||
@ -382,6 +409,7 @@ toggle_ipv6() {
|
|||||||
read -p "按 Enter 键返回菜单..."
|
read -p "按 Enter 键返回菜单..."
|
||||||
show_menu
|
show_menu
|
||||||
}
|
}
|
||||||
|
|
||||||
# 8. 检测更新
|
# 8. 检测更新
|
||||||
check_update() {
|
check_update() {
|
||||||
color_output "\e[34m[检测更新]\e[0m"
|
color_output "\e[34m[检测更新]\e[0m"
|
||||||
|
Loading…
Reference in New Issue
Block a user