I would like redirect my tcp traffic to IRC throught a VPN.
I mark the packets with iptables and create a new route for this packets:
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/tun0/rp_filter
iptables -t mangle -A OUTPUT ! -d 192.168.0.0/16 -p tcp --dport 6667 -j MARK --set-mark 0x42
ip route add default dev tun0 src 10.5.82.5 table VPN
ip rule add fwmark 0x42 table VPN
The VPN connection:
# ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet adr:10.5.82.5 P-t-P:10.5.82.6 Masque:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:2898 errors:0 dropped:0 overruns:0 frame:0
TX packets:3163 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:100
RX bytes:159644 (155.9 KiB) TX bytes:257601 (251.5 KiB)
The packets are redirected to tun0 on the local machine (iptables tagging and the ip rule are ok) but no packet arrive on the tun0 interface of the VPN.
Have you an idea?
Thank's in advance.
ip route add default via 10.5.82.*6* dev tun0 table VPN
?ip route add table VPN default dev tun0
) without success.ip route flush cache
may help if you try to fiddle with routes.