Skip to content

utpinfo/psw2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

首次使用

配置網路介面 (/etc/config/network)

  • 配置PPPOE
uci set network.wan.proto='pppoe'
uci set network.wan.username='15618476128' 
uci set network.wan.password='Rh19870128'
uci add_list network.wan.dns='114.114.114.114'
uci add_list network.wan.dns='8.8.8.8'
uci commit network
/etc/init.d/network restart
  • 配置二級路由
uci set network.lan.proto='static'
uci set network.lan.ipaddr='192.168.201.190'
uci set network.lan.netmask='255.255.255.0'
uci set network.lan.gateway='192.168.201.254'
uci add_list network.lan.dns='114.114.114.114'
uci add_list network.lan.dns='8.8.8.8'
uci commit network
/etc/init.d/network restart
opkg update
#wget --no-check-certificate -q https://raw.githubusercontent.com/utpinfo/psw2/main/download.sh && chmod +x download.sh && ./download.sh
bash <(wget -qO- https://raw.githubusercontent.com/utpinfo/psw2/main/download.sh)
opkg install *.ipk --force-reinstall

安裝軟件包 (如果使用訂製包則略過)

opkg install bash tree curl unzip zoneinfo-asia netdata luci-app-netdata luci-i18n-netdata-zh-cn luci-i18n-firewall-zh-cn luci-i18n-filebrowser-zh-cn luci-app-argon-config luci-i18n-argon-config-zh-cn luci-i18n-package-manager-zh-cn luci-i18n-ttyd-zh-cn openssh-sftp-server kmod-nft-socket kmod-nft-tproxy kmod-tcp-bbr

首次启动时运行的脚本(uci-defaults)增加 (version: 25.10.5)

#!/bin/sh
# ===============================
# ImmortalWrt R5C 4GB 高並發極限優化
# ===============================

# 1️⃣ 系統日誌
uci set system.@system[0].conloglevel='4'
uci set system.@system[0].cronloglevel='9'

# 2️⃣ LAN & DHCP
uci set network.lan.ipaddr='192.168.100.1'
uci set network.lan.netmask='255.255.255.0'
uci set dhcp.lan=dhcp
uci set dhcp.lan.interface='lan'
uci set dhcp.lan.start='100'
uci set dhcp.lan.limit='50'
uci set dhcp.lan.leasetime='6h'

# 3️⃣ Conntrack(高並發 NAT)
cat <<'EOF' > /etc/sysctl.d/99-r5c.conf
# Conntrack
net.netfilter.nf_conntrack_max = 524288
net.netfilter.nf_conntrack_tcp_timeout_established = 3600
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
net.netfilter.nf_conntrack_udp_timeout = 60
net.netfilter.nf_conntrack_udp_timeout_stream = 180
# TCP 基礎性能(吞吐 + 穩定)
net.core.default_qdisc = fq_codel
net.ipv4.tcp_congestion_control = bbr
# Socket buffer(高吞吐核心)
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.ipv4.tcp_rmem = 4096 87380 33554432
net.ipv4.tcp_wmem = 4096 65536 33554432
# 網路佇列(抗爆流量 / Cloudflare / HTTP2)
net.core.netdev_max_backlog = 16384
net.core.somaxconn = 8192
net.ipv4.tcp_max_syn_backlog = 8192
# TIME_WAIT / NAT 壓力優化
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_tw_reuse = 1
# Keepalive(VPN / Xray / Reality 穩定)
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 5
# 安全 + 穩定
net.ipv4.tcp_syncookies = 1
# MTU / Path control(避免 UDP / VPN 卡死)
net.ipv4.ip_no_pmtu_disc = 0
# 軟中斷優化(高流量才有感)
net.core.netdev_budget = 600
net.core.netdev_budget_usecs = 8000
# Others
net.core.rps_sock_flow_entries=32768
net.ipv4.tcp_fastopen=3
net.ipv4.tcp_mtu_probing=1
EOF

# 4️⃣ IRQ Balance + Packet Steering
opkg update
opkg install irqbalance
/etc/init.d/irqbalance enable
/etc/init.d/irqbalance start
uci set network.globals.packet_steering='1'
uci commit network
/etc/init.d/firewall restart

# 5️⃣ IPv6 / WAN6 禁用
uci set network.wan6.disabled='1'
uci set dhcp.lan.ra='disabled'
uci set dhcp.lan.dhcpv6='disabled'
uci commit network

# 6️⃣ Flow Offload / NAT
uci set firewall.@defaults[0].flow_offloading='0'
uci set firewall.@defaults[0].flow_offloading_hw='0'
uci set firewall.@defaults[0].fullcone='0'
uci commit firewall
/etc/init.d/firewall restart

# 7️⃣ 網卡 RPS + Softnet / TCP Buffer 極限優化
# 修改 eth0 / eth1 根據實際 WAN/LAN
CPU=$(grep -c '^processor' /proc/cpuinfo)

MASK=0
i=0
while [ $i -lt $CPU ]; do
    MASK=$((MASK | (1 << i)))
    i=$((i + 1))
done

for IF in eth0 eth1 br-lan; do
    [ -d /sys/class/net/$IF ] || continue

    for RXQ in /sys/class/net/$IF/queues/rx-*; do
        [ -w "$RXQ/rps_cpus" ] || continue
        echo $MASK > "$RXQ/rps_cpus" 2>/dev/null
    done
done

for i in /sys/class/net/eth0/queues/tx-*; do
  echo f > $i/xps_cpus
done

# 8️⃣ 配置鏡像源
sed -e 's,https://downloads.immortalwrt.org,https://mirrors.cernet.edu.cn/immortalwrt,g' \
    -e 's,https://mirrors.vsean.net/openwrt,https://mirrors.cernet.edu.cn/immortalwrt,g' \
    -i.bak /etc/opkg/distfeeds.conf

# 9️⃣ 重啟必要服務
/etc/init.d/network restart
/etc/init.d/odhcpd restart
/etc/init.d/firewall restart

# 丟包檢查
#cat /proc/net/softnet_stat

訂製固件

固件下載

https://firmware-selector.immortalwrt.org/?version=24.10.2&target=rockchip%2Farmv8&id=friendlyarm_nanopi-r5c

預安裝軟件包

bash tree curl unzip zoneinfo-asia netdata luci-app-netdata luci-i18n-netdata-zh-cn luci-i18n-firewall-zh-cn luci-i18n-filebrowser-zh-cn luci-app-argon-config luci-i18n-argon-config-zh-cn luci-i18n-package-manager-zh-cn luci-i18n-ttyd-zh-cn openssh-sftp-server kmod-nft-socket kmod-nft-tproxy kmod-tcp-bbr

安裝插件 (第三方)

# 網速測速 (https://github.com/sirpdboy/luci-app-netspeedtest/releases/download/v5.0.5/openwrt-22.03-x86_64.tar.gz)
# 網路嚮導 (https://github.com/sirpdboy/luci-app-netwizard/releases/expanded_assets/v1.9.2)

ESXI VMDK 製作 (二次轉換)

# MAC安裝轉換工具
brew install qemu
# MAC上執行轉換 (img -> vmdk)
qemu-img convert -f raw -O vmdk istoreos-24.10.2-2025071110-x86-64-squashfs-combined-efi.img openwrt.vmdk
# 上傳儲存區 (ESXI)
cd /Users/yangfengkai/Downloads
scp openwrt.vmdk root@192.168.201.210://vmfs/volumes/636ed8f8-89d1b6a0-d723-e0db550e08b4/istoreos
# EXSI上執行轉換 (vmdk -> esxi-vmdk)
ssh root@192.168.201.210
cd /vmfs/volumes/636ed8f8-89d1b6a0-d723-e0db550e08b4/openwrt
vmkfstools -i openwrt.vmdk -d thin openwrt-esxi.vmdk

About

自動下載腳本

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages