We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大圣你好! 对于多网口设备,初始化时默认第一口为LAN口,第二口为WAN口,其余空着。还需进入WebUI自行修改。我对您的99-custom.sh做了一些小小的调整,可以支持第一口为WAN口,其余全部为LAN口。您看看可以加入您的主分支么?
#!/bin/sh # 以下只显示修改部分 # 计算网卡数量 count=0 ifnames="" for iface in /sys/class/net/*; do iface_name=$(basename "$iface") # 检查是否为物理网卡(排除回环设备和无线设备) if [ -e "$iface/device" ] && echo "$iface_name" | grep -Eq '^eth|^en'; then count=$((count + 1)) ifnames="$ifnames $iface_name" fi done # 删除多余空格 ifnames=$(echo "$ifnames" | awk '{$1=$1};1') # 网络设置 if [ "$count" -eq 1 ]; then # 单网口设备 类似于NAS模式 动态获取ip模式 具体ip地址取决于上一级路由器给它分配的ip 也方便后续你使用web页面设置旁路由 # 单网口设备 不支持修改ip 不要在此处修改ip uci set network.lan.proto='dhcp' elif [ "$count" -gt 1 ]; then # 提取第一个接口作为WAN wan_ifname=$(echo "$ifnames" | awk '{print $1}') # 剩余接口保留给LAN lan_ifnames=$(echo "$ifnames" | cut -d ' ' -f2-) # 设置WAN接口基础配置 uci set network.wan=interface # 提取第一个接口作为WAN uci set network.wan.device="$wan_ifname" # WAN接口默认DHCP uci set network.wan.proto='dhcp' # 设置WAN6接口基础配置 uci set network.wan6=interface uci set network.wan6.device='@wan' # 更新LAN接口成员 # 查找对应设备的section名称 section=$(uci show network | awk -F '[.=]' '/\.@?device\[\d+\]\.name=.br-lan.$/ {print $2; exit}') if [ -z "$section" ]; then echo "error:cannot find device 'br-lan'." >> $LOGFILE else # 删除原来的ports列表 uci -q delete "network.$section.ports" # 添加新的ports列表 for port in $lan_ifnames; do uci add_list "network.$section.ports"="$port" done echo "ports of device 'br-lan' are update." >> $LOGFILE fi # LAN口设置静态IP uci set network.lan.proto='static' # 多网口设备 支持修改为别的ip地址 uci set network.lan.ipaddr='192.168.123.1' uci set network.lan.netmask='255.255.255.0' echo "set 192.168.123.1 at $(date)" >> $LOGFILE # 判断是否启用 PPPoE echo "print enable_pppoe value=== $enable_pppoe" >> $LOGFILE if [ "$enable_pppoe" = "yes" ]; then echo "PPPoE is enabled at $(date)" >> $LOGFILE # 设置宽带拨号信息 uci set network.wan.proto='pppoe' uci set network.wan.username=$pppoe_account uci set network.wan.password=$pppoe_password uci set network.wan.peerdns='1' uci set network.wan.auto='1' echo "PPPoE configuration completed successfully." >> $LOGFILE else echo "PPPoE is not enabled. Skipping configuration." >> $LOGFILE fi fi
The text was updated successfully, but these errors were encountered:
好的 我测一下
Sorry, something went wrong.
你好 我测试了 可以的,多谢你的建议,你看是不是你 将修改的部分 提交pr 我来merge?
No branches or pull requests
大圣你好!
对于多网口设备,初始化时默认第一口为LAN口,第二口为WAN口,其余空着。还需进入WebUI自行修改。我对您的99-custom.sh做了一些小小的调整,可以支持第一口为WAN口,其余全部为LAN口。您看看可以加入您的主分支么?
The text was updated successfully, but these errors were encountered: