# 🌐 GL-XE3000 路由器設定指南 > ⚠️ **重要提醒**: 本文件包含網路設定、防火牆規則及代理服務設定 --- ## 📋 目錄 - [🔥 防火牆白名單設定](#防火牆白名單設定) - [⚡ TTL 修改(熱點限速破解)](#ttl-修改熱點限速破解) - [🔐 SSH 金鑰設定](#ssh-金鑰設定) - [🚀 Shadowsocks 伺服器設定](#shadowsocks-伺服器設定) - [🔧 系統管理](#系統管理) - [📚 學習資源](#學習資源) --- ## 🔥 防火牆白名單設定 ### 📊 防火牆管理指令總表 | 操作 | 指令 | 生效範圍 | |------|------|----------| | **查詢轉發規則** | `uci show firewall \| grep redirect` | - | | **查詢白名單** | `nft list set inet fw4 whitelist` | - | | **暫時新增 IP** | `nft add element inet fw4 whitelist { 49.216.185.183 }` | ⏱️ 重啟後失效 | | **暫時移除 IP** | `nft delete element inet fw4 whitelist { 49.216.185.183 }` | ⏱️ 重啟後失效 | ### 1️⃣ 建立永久白名單 **完整設定流程**: ```bash # 建立白名單 ipset uci add firewall ipset uci set firewall.@ipset[-1].name='whitelist' uci set firewall.@ipset[-1].family='ipv4' uci set firewall.@ipset[-1].storage='hash' uci set firewall.@ipset[-1].match='src_ip' uci set firewall.@ipset[-1].entry='114.36.10.68 49.216.185.183' # 套用到轉發規則 uci delete firewall.@redirect[0].src_ip uci set firewall.@redirect[0].ipset='whitelist' # 提交設定並重啟防火牆 uci commit firewall /etc/init.d/firewall restart ``` **預設白名單 IP**: - `114.36.10.68` - `49.216.185.183` ### 2️⃣ 永久新增/移除 IP **永久新增**: ```bash uci add_list firewall.@ipset[0].entry='49.216.185.183' uci commit firewall /etc/init.d/firewall restart ``` **永久移除**(精準刪除指定值): ```bash uci del_list firewall.@ipset[0].entry='49.216.185.183' uci commit firewall /etc/init.d/firewall restart ``` --- ## ⚡ TTL 修改(熱點限速破解) ### 📊 TTL 修改指令對照表 | 平台 | 操作 | 指令 | |------|------|------| | **OpenWRT** | 設定 TTL=65 | `/usr/sbin/iptables -t mangle -I POSTROUTING 1 -j TTL --ttl-set 65` | | **OpenWRT** | 查看規則 | `sudo iptables -t mangle -L POSTROUTING -n -v --line-numbers` | | **macOS** | 查詢 TTL | `sysctl net.inet.ip.ttl` | | **macOS** | 設定 TTL=65 | `sysctl -w net.inet.ip.ttl=65` | ### 🎯 OpenWRT 路由器設定 **1. 設定 TTL 為 65**: ```bash /usr/sbin/iptables -t mangle -I POSTROUTING 1 -j TTL --ttl-set 65 ``` **2. 驗證規則**: ```bash sudo iptables -t mangle -L POSTROUTING -n -v --line-numbers ``` ### 🍎 macOS 個別設定 TTL **查詢目前的 TTL**: ```bash sysctl net.inet.ip.ttl ``` **變更 TTL 為指定值(例如 65)**: ```bash sysctl -w net.inet.ip.ttl=65 ``` ### 📸 設定前後對比 **Before**:  **After**:  ### 📊 效果驗證 | 狀態 | 截圖 | |------|------| | 🔧 iptables 規則 |  | | 📊 規則列表 |  | | ✅ 測試結果 |  | --- ## 🔐 SSH 金鑰設定 ### 產生 RSA 金鑰對 ```bash ssh-keygen -t rsa -f id_rsa -s 2048 ``` ### 增加 Keypair 連線 ![SSH Keypair 設定]  (https://hackmd.io/_uploads/BkkQ79aJR.png) **參數說明**: - `-t rsa`: 金鑰類型為 RSA - `-f id_rsa`: 檔案名稱 - `-s 2048`: 金鑰長度 2048 位元 --- ## 🚀 Shadowsocks 伺服器設定 ### 📦 安裝方式對照表 | 安裝類型 | 適用場景 | 套件名稱 | |---------|---------|---------| | **🐳 Docker** | 完整伺服器部署 | `dockerd docker docker-compose luci-app-dockerman` | | **📦 Standalone** | 獨立完整功能 | `shadowsocks-libev-ss-local/redir/rules/tunnel` + `luci-app-shadowsocks-libev` | | **🔀 跳板模式** | 僅轉發功能 | `shadowsocks-libev-ss-redir` + `luci-app-shadowsocks-libev` | ### 1️⃣ Docker 方式安裝 **適用型號**: GL-XE3000 #### 安裝 Docker ```bash opkg update opkg install dockerd docker docker-compose luci-app-dockerman /etc/init.d/dockerd enable /etc/init.d/dockerd start ``` #### Docker Compose 設定 **檔案**: `docker-compose.yml` ```yaml version: '3.8' services: ssserver: image: ghcr.io/shadowsocks/ssserver-rust:latest container_name: ssserver restart: unless-stopped network_mode: host command: > ssserver -s 0.0.0.0:9000 -m chacha20-ietf-poly1305 -k zhimakaimen --udp-timeout 300 --no-delay -v environment: - RUST_LOG=warn - TZ=Asia/Taipei ``` **設定參數說明**: | 參數 | 值 | 說明 | |------|-----|------| | **監聽位址** | `0.0.0.0:9000` | 所有介面,端口 9000 | | **加密方式** | `chacha20-ietf-poly1305` | AEAD 加密 | | **密碼** | `zhimakaimen` | 連線密碼 | | **UDP 逾時** | `300` 秒 | UDP 連線逾時時間 | | **時區** | `Asia/Taipei` | 台北時區 | #### 防火牆規則(允許 SS 連線) ```bash uci add firewall rule uci set firewall.@rule[-1].name='Allow-SS' uci set firewall.@rule[-1].src='wan' uci set firewall.@rule[-1].proto='tcp udp' uci set firewall.@rule[-1].dest_port='9000' uci set firewall.@rule[-1].target='ACCEPT' uci commit firewall /etc/init.d/firewall restart ``` ### 2️⃣ Standalone 方式安裝 **完整功能(含 UI)**: ```bash opkg update opkg install shadowsocks-libev-ss-local \ shadowsocks-libev-ss-redir \ shadowsocks-libev-ss-rules \ shadowsocks-libev-ss-tunnel \ luci-app-shadowsocks-libev ``` ### 3️⃣ 跳板模式安裝 **方式 A(含 UI)**: ```bash opkg update opkg install shadowsocks-libev-ss-redir luci-app-shadowsocks-libev ``` **方式 B(僅核心)**: ```bash opkg update opkg install shadowsocks-libev-ss-redir ``` ### 4️⃣ MT6000 型號特殊安裝 **Docker 安裝(強制覆蓋依賴)**: ```bash opkg update opkg install dockerd --force-depends --force-overwrite /etc/init.d/dockerd enable /etc/init.d/dockerd start ``` --- ## 🔧 系統管理 ### 🔌 關機指令 **使用 ubus 呼叫 MCU 關機**: ```bash ubus call mcu cmd_json '{"power_off":"1"}' ``` **備用指令**: ```bash ubus 呼叫 mcu cmd_json '{"power_off":"1"}' ``` ### 🛠️ 實用工具安裝 **Netcat 安裝**: ```bash opkg update opkg install netcat ``` --- ## 📚 學習資源 ### 📖 官方文件與教學 | 類別 | 標題 | 連結 | |------|------|------| | **TTL 修改** | TTL modification for outgoing traffic with OpenWRT | [🔗 連結](https://www.maroonmed.com/ttl-modification-for-outgoing-traffic-with-openwrt/) | | **T-Mobile ISP** | T-Mobile Home ISP Service Review with OpenWRT | [🔗 連結](https://bostonenginerd.com/posts/tmobile-isp/) | | **GL-X3000** | New GL-X3000 Spitz AX owner (T-Mobile Home Internet) | [🔗 Reddit](https://www.reddit.com/r/GlInet/comments/15ukqvv/new_glx3000_spitz_ax_owner_tmobile_home_internet/) | | **TTL 設定** | Change outgoing TTL | [🔗 GL.iNet Forum](https://forum.gl-inet.com/t/change-outgoing-ttl/2096) | | **Bridge 模式** | GL-X3000 - Bridge Mode WAN IP Passthrough | [🔗 GL.iNet Forum](https://forum.gl-inet.com/t/gl-x3000-bridge-mode-wan-ip-passthrough/32715) | ### 🍎 macOS 相關 | 工具/主題 | 連結 | |----------|------| | **Pythonista 3** | [🔗 App Store](https://apps.apple.com/us/app/pythonista-3/id1085978097) | | **Automator Workflow (TTL 65)** | [🔗 Reddit](https://www.reddit.com/r/Visible/comments/zvfc3l/macos_automator_workflow_to_enable_ttl_65/) | ### 🌏 中文資源 | 主題 | 連結 | |------|------| | **TTL 修改 bypass hotspot quota** | [🔗 美卡論壇](https://www.uscardforum.com/t/topic/233263/12?page=2) | | **4G / 5G 熱點分享 TTL 修改法** | [🔗 WorkXPlay](https://uni.workxplay.net/t/4g-5g-ttl/183) | --- ## 📊 快速參考 ### 🔥 防火牆常用指令 ```bash # 查看所有防火牆規則 uci show firewall # 查看轉發規則 uci show firewall | grep redirect # 查看白名單 nft list set inet fw4 whitelist # 重啟防火牆 /etc/init.d/firewall restart ``` ### 🐳 Docker 常用指令 ```bash # 查看容器狀態 docker ps -a # 查看容器日誌 docker logs ssserver # 重啟容器 docker restart ssserver # 停止容器 docker stop ssserver ``` ### 📦 OpenWRT 套件管理 ```bash # 更新套件列表 opkg update # 搜尋套件 opkg find shadowsocks* # 查看已安裝套件 opkg list-installed | grep shadowsocks # 移除套件 opkg remove shadowsocks-libev-ss-redir ``` --- ## 🔒 安全提醒 ### ⚠️ 重要注意事項 1. **Shadowsocks 密碼**: 預設密碼 `zhimakaimen` 僅供測試,生產環境請更換強密碼 2. **防火牆規則**: 白名單 IP 應定期檢查,移除不再使用的 IP 3. **TTL 修改**: 部分電信商可能偵測 TTL 修改行為,請遵守使用條款 4. **SSH 金鑰**: 生成的私鑰請妥善保管,不要外洩 5. **Docker 安全**: 定期更新容器映像檔,確保安全性 ### 🔐 最佳實踐 - ✅ 使用強密碼和金鑰認證 - ✅ 定期更新系統和套件 - ✅ 最小權限原則開放防火牆 - ✅ 監控系統日誌 - ✅ 備份重要設定 --- **📅 文件最後更新**: 2024-12-05 **🌐 適用型號**: GL-XE3000, MT6000 **📱 韌體版本**: OpenWRT 21.02+ **⚠️ 提醒**: 請遵守當地法規及服務條款 ``` iptables -t nat -I POSTROUTING 1 \ -s 192.168.189.0/24 -o eth0 \ -j SNAT --to-source 59.124.28.235-59.124.28.240 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up