github地址
https://github.com/tun2proxy/tun2proxy官方用法
# The proxy type can be either SOCKS4, SOCKS5 or HTTP.
PROXY_TYPE=SOCKS5
PROXY_IP=1.2.3.4
PROXY_PORT=1080
BYPASS_IP=123.45.67.89
# Create a tunnel interface named tun0 which you can bind to,
# so we don't need to run tun2proxy as root.
sudo ip tuntap add name tun0 mode tun
sudo ip link set tun0 up
# To prevent a routing loop, we add a route to the proxy server that behaves
# like the default route.
sudo ip route add "$BYPASS_IP" $(ip route | grep '^default' | cut -d ' ' -f 2-)
# Route all your traffic through tun0 without interfering with the default route.
sudo ip route add 128.0.0.0/1 dev tun0
sudo ip route add 0.0.0.0/1 dev tun0
# If you wish to also route IPv6 traffic through the proxy, these two commands will do.
sudo ip route add ::/1 dev tun0
sudo ip route add 8000::/1 dev tun0
# Make sure that DNS queries are routed through the tunnel.
sudo sh -c "echo nameserver 198.18.0.1 > /etc/resolv.conf"
./target/release/tun2proxy-bin --tun tun0 --proxy "$PROXY_TYPE://$PROXY_IP:$PROXY_PORT"这里只是看看我需要自己手动操作
因为我暂时不需要代理所有流量 所以没怎么配置路由表如果有需要可以自己配置路由表
第一步创建tun网卡 并启用
ip tuntap add name tun0 mode tun
ip link set tun0 up第二部 绕过代理服务器自身的流量
ip route add 服务器IP via 本地网卡网关 dev 本地网卡设备
ip route add 1.2.3.4 via 192.168.2.1 dev enp0s31f6 示例 enp0s31f6 是我的物理网卡名称 192.168.2.1是网关第三部 创建 systemd 服务文件
nano /etc/systemd/system/tun2proxy.service填充一下内容 根据需求自己修改
[Unit]
Description=tun2proxy - SOCKS Proxy to TUN Tunnel
After=network.target
[Service]
ExecStart=/root/tun2proxy/target/release/tun2proxy-bin --tun tun0 --proxy "socks5://1.2.3.4:1080"
WorkingDirectory=/root/tun2proxy
Restart=always
RestartSec=5
User=root
Group=root
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
搞定 可以使用curl 测速
curl -o /dev/null -s -w "Download speed: %{speed_download} bytes/sec\n" http://ftp.us.debian.org/debian/dists/Debian12.10/main/installer-amd64/20230607/images/cdrom/xen/initrd.gz --interface tun0附上另外一个类似项目地址
https://github.com/heiher/hev-socks5-tunnel 

果博东方客服开户联系方式【182-8836-2750—】?薇- cxs20250806】
果博东方公司客服电话联系方式【182-8836-2750—】?薇- cxs20250806】
果博东方开户流程【182-8836-2750—】?薇- cxs20250806】
果博东方客服怎么联系【182-8836-2750—】?薇- cxs20250806】
新盛客服电话是多少?(?183-8890-9465—《?薇-STS5099】【
新盛开户专线联系方式?(?183-8890--9465—《?薇-STS5099】【?扣6011643??】
新盛客服开户电话全攻略,让娱乐更顺畅!(?183-8890--9465—《?薇-STS5099】客服开户流程,华纳新盛客服开户流程图(?183-8890--9465—《?薇-STS5099】