返回列表 發帖
本帖最後由 tomleehk 於 2019-11-5 10:23 編輯
回復  kingwilliam

請問用ss-tproxy 啲啲會唔會簡單一啲

harold 發表於 2019-11-5 09:16



   
純經驗分享

openwrt + ss-client + iptables 做透明代理我試過喺work 嘅
當中亦喺ss-client設定 加上 iptables scripts

測試方法我用bt download去確定 udp 能轉發至 server

但因為無長期實際需要, 純研究性質, 無再深入研究及實踐

TOP

本帖最後由 tomleehk 於 2019-11-5 18:25 編輯

我當年Openwrt + ss-client udp轉發所用嘅script, 不知有無幫助
  1. ip route add local default dev lo table 100
  2. ip rule add fwmark 1 lookup 100
  3. iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 1080 --tproxy-mark 0x01/0x01
  4. iptables -t mangle -A SHADOWSOCKS_MARK -p udp --dport 53 -j MARK --set-mark 1

  5. iptables -t mangle -I  -d 127.0.0.0/24 -j RETURN  
  6. iptables -t mangle -I PREROUTING -d 192.168.0.0/16 -j RETURN  
  7. iptables -t mangle -I PREROUTING -d 10.42.0.0/16 -j RETURN  
  8. iptables -t mangle -I PREROUTING -d 0.0.0.0/8 -j RETURN  
  9. iptables -t mangle -I PREROUTING -d 10.0.0.0/8 -j RETURN  
  10. iptables -t mangle -I PREROUTING -d 172.16.0.0/12 -j RETURN  
  11. iptables -t mangle -I PREROUTING -d 224.0.0.0/4 -j RETURN  
  12. iptables -t mangle -I PREROUTING -d 240.0.0.0/4 -j RETURN  
  13. iptables -t mangle -I PREROUTING -d 169.254.0.0/16 -j RETURN  
  14. iptables -t mangle -I PREROUTING -d 255.255.0.0/8 -j RETURN

  15. iptables -t mangle -A PREROUTING -j SHADOWSOCKS
  16. iptables -t mangle -A PREROUTING -j SHADOWSOCKS
  17. iptables -t mangle -A OUTPUT -j SHADOWSOCKS_MARK
複製代碼
其中  --on-port 1080, 1080 喺 ss-client 嘅 listening port

太耐無研究..而家唔記得d細節

TOP

本帖最後由 tomleehk 於 2019-11-5 19:53 編輯

回復 16# harold

我當年Openwrt + ss-client tcp轉發所用嘅script, 不知有無幫助
  1. #!/bin/sh

  2. #create a new chain named SHADOWSOCKS
  3. iptables -t nat -N SHADOWSOCKS

  4. # Ignore your shadowsocks server's addresses
  5. # It's very IMPORTANT, just be careful.

  6. iptables -t nat -A SHADOWSOCKS -p tcp --dport 993 -j RETURN

  7. # Ignore LANs IP address
  8. iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
  9. iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
  10. iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
  11. iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
  12. iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
  13. iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
  14. iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
  15. iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN

  16. # Anything else should be redirected to shadowsocks's local port
  17. iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 1080
  18. # Apply the rules
  19. iptables -t nat -I PREROUTING -p tcp -j SHADOWSOCKS
複製代碼
其中
iptables -t nat -A SHADOWSOCKS -p tcp --dport 993 -j RETURN
--dport 993, 993 喺 server side 嘅listening port

iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 1080
--to-ports 1080 , 1080 喺 client side 嘅listening port

Good Luck !!

TOP

本帖最後由 tomleehk 於 2019-11-6 21:27 編輯
發現當未能連上v2ray時,dns resolve唔到,即係係v2ray Server address一定要入ip address. ...
harold 發表於 2019-11-6 15:45


喺唔喺講緊呢句 ?
  1. iptables -t nat -A V2RAY -d $hostip2 -j RETURN
複製代碼
如果喺, 參考我嘅ss-client tcp 轉發 script, 試吓改用 v2ray server 嘅 port

TOP

本帖最後由 tomleehk 於 2019-12-21 08:39 編輯

Openwrt V2ray 透明代理 tls + ws (實踐編)
http://www.telecom-cafe.com/forum/viewthread.php?tid=7789
參考網上文章, 左砌右砌加加減減, 初步睇結果喺成功做到tcp+dns轉發, 速度唔算好高, 足夠一般使用

TOP

返回列表