From 898d7e98edb0adeb7cdbe79d5bbc7e6ac6186bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E4=BA=8C?= <66155308+miaoermua@users.noreply.github.com> Date: Sun, 29 Sep 2024 21:23:53 +0800 Subject: [PATCH] Update cattools.sh --- cattools.sh | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/cattools.sh b/cattools.sh index 27fa86d..74b3f42 100644 --- a/cattools.sh +++ b/cattools.sh @@ -145,6 +145,31 @@ setip() { echo "默认 IP 已设置为 $input_ip" } +configure_network_interfaces() { + local interfaces="$1" + bridge_ports="" + + for iface in $interfaces; do + if [ "$iface" != "eth0" ]; then + bridge_ports="$bridge_ports $iface" + fi + done + + uci set network.wan.ifname='eth0' + uci set network.wan.proto='dhcp' + uci set network.lan.type='bridge' + uci set network.lan.ifname="$bridge_ports" + uci set network.lan._orig_ifname="$bridge_ports" + uci set network.lan._orig_bridge='true' + uci set network.wan6._orig_bridge='false' + uci set network.wan6._orig_ifname='eth1' + uci set network.wan6.ifname='eth0' + uci set network.wan6.reqaddress='try' + uci set network.wan6.reqprefix='auto' + + echo "[Step10] Network interfaces configured: WAN (ETH0), LAN ($bridge_ports) /// 网口已配置: WAN (ETH0), LAN ($bridge_ports)" +} + # Network Wizard network_wizard() { echo @@ -276,6 +301,7 @@ network_wizard() { echo "" echo "Press [Enter] to skip network configuration, press [1] to configure /// 按 [Enter] 跳过网口配置,按 [1] 确认配置: " read -p "" configure_network + echo interfaces=$(ls /sys/class/net | grep -E 'eth[0-9]+') iface_count=$(echo "$interfaces" | wc -w) @@ -309,31 +335,6 @@ network_wizard() { /etc/init.d/firewall restart /etc/init.d/miniupnpd restart reboot - - configure_network_interfaces() { - local interfaces="$1" - bridge_ports="" - - for iface in $interfaces; do - if [ "$iface" != "eth0" ]; then - bridge_ports="$bridge_ports $iface" - fi - done - - uci set network.wan.ifname='eth0' - uci set network.wan.proto='dhcp' - uci set network.lan.type='bridge' - uci set network.lan.ifname="$bridge_ports" - uci set network.lan._orig_ifname="$bridge_ports" - uci set network.lan._orig_bridge='true' - uci set network.wan6._orig_bridge='false' - uci set network.wan6._orig_ifname='eth1' - uci set network.wan6.ifname='eth0' - uci set network.wan6.reqaddress='try' - uci set network.wan6.reqprefix='auto' - - echo "[Step10] Network interfaces configured: WAN (ETH0), LAN ($bridge_ports) /// 网口已配置: WAN (ETH0), LAN ($bridge_ports)" - } } # BypassGateway