寻觅生命中的那一片浅草......

每日存档 十一月 7th, 2020

旁路路由透明代理

方案优点

需要透明代理上网的客户机不需要任何设置,网关地址都不需要改

环境

  • 主路由 华硕刷梅林固件 192.168.0.1
  • 旁路由 CubieTruck刷的ArchLinux 192.168.0.66
  • 需要透明代理上网的客户机 192.168.0.119

数据走向

192.168.0.119 -> 192.168.0.1 -> 192.168.0.66 -> 192.168.0.1

192.168.0.1设置

# 将进入table 10的数据发去192.168.0.66
ip route add default via 192.168.0.66 table 10

# 设置从192.168.0.119来的数据进入table 10
# 就是让192.168.0.119的数据发去192.168.0.66进行处理
ip rule add from 192.168.0.119/32 table 10

# 查看路由规则
ip rule show

192.168.0.66设置

# 设置数据转发
sudo sysctl -w net.ipv4.ip_forward=1

# 开启v2ray
v2ray -config config.json

# 设置防火墙
sudo /usr/sbin/iptables  -t nat -N V2RAY
sudo /usr/sbin/iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 1060
sudo /usr/sbin/iptables -t nat -A PREROUTING -s 192.168.0.119 -p tcp -j V2RAY

主要参考文章

2020年十一月
« 2月   3月 »
 1
2345678
9101112131415
16171819202122
23242526272829
30