1
rrfeng 2020-12-27 13:59:34 +08:00 via Android
bridge 肯定可以的。
|
3
whitegerry 2020-12-27 20:03:12 +08:00
@jemyzhang 有个相反的需求,指定 gitea 容器走 clash 旁路由,用了 redsocks,192.168.100.2 是旁路,你这个需求类似的办法应该也行
docker ``` networks: gitea-net: driver_opts: com.docker.network.bridge.name: br_gitea ``` iptables ``` iptables -t nat -N REDSOCKS iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345 iptables -t nat -A PREROUTING -i br_gitea -j REDSOCKS ``` redsocks.conf ``` redsocks { local_ip = 0.0.0.0; local_port = 12345; ip = 192.168.100.2; port = 7891; type = socks5; } ``` |