通过VPN接口路由Torrentstream量

我试图build立我自己的种子与rTorrent,我想通过我的VPNredirect所有洪stream。

我知道这个问题上有一堆QA和HOWTO。 我读了很多,想出了这个(这根本不工作…):

OpenVPNconfiguration

client dev tun0 proto tcp remote 173.199.65.63 443 resolv-retry infinite nobind persist-key persist-tun ca /etc/openvpn/ca.crt tls-client remote-cert-tls server auth-user-pass /etc/openvpn/pwd.txt comp-lzo verb 1 reneg-sec 0 crl-verify /etc/openvpn/crl.pem script-security 2 route-noexec route-up /etc/openvpn/route_up.sh 

/etc/openvpn/route_up.sh

 #!/bin/sh echo "$dev : $ifconfig_local -> $ifconfig_remote gw: $route_vpn_gateway" ip route add default via $route_vpn_gateway dev $dev table vpn ip route flush cache exit 0 

iptables命令发出

 echo "666 vpn" >> /etc/iproute2/rt_tables ip rule add fwmark 77 table vpn iptables -t mangle -A OUTPUT -p udp --sport 6880 -j MARK --set-mark 77 iptables -t mangle -A INPUT -p udp --dport 6880 -j MARK --set-mark 77 iptables -t mangle -A OUTPUT -p tcp --sport 6881 -j MARK --set-mark 77 iptables -t mangle -A OUTPUT -p udp --sport 6881 -j MARK --set-mark 77 iptables -t mangle -A INPUT -p tcp --dport 6881 -j MARK --set-mark 77 iptables -t mangle -A INPUT -p udp --dport 6881 -j MARK --set-mark 77 

6880和6881是rTorrent使用的端口,因此上述。

当我运行一些类似CheckMyTorrentIP的rTorrent时,报告的IP地址是我的,而不是我的VPN的。 我以为我是理解我读到的iptables和东西,但显然,我不是。

有人可以帮我解释一下我该怎么做吗?

谢谢阅读

编辑

种子箱build立在Ubuntu桌面15.04 64位发行版上。

编辑2

 fwoelffel@homeserver:~$ ifconfig eth0 Link encap:Ethernet HWaddr fc:aa:14:6b:c5:f2 inet addr:192.168.1.17 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::feaa:14ff:fe6b:c5f2/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1754058 errors:0 dropped:0 overruns:0 frame:0 TX packets:599118 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2541473428 (2.5 GB) TX bytes:53167571 (53.1 MB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:443172 errors:0 dropped:0 overruns:0 frame:0 TX packets:443172 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:58217786 (58.2 MB) TX bytes:58217786 (58.2 MB) tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.30.1.6 PtP:10.30.1.5 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) 

您需要在您的openVPN服务器configuration中使用redirect-gateway选项,如此处所述(redirect所有stream量)。

或者,也可以push "route <ip> <mask>"选项,通过VPN将stream量发送到特定IP /范围,如此处所述。