Gerardo Arceri
2005-Feb-18 21:16 UTC
Route away packets addressed to the machine itself w/iproute and Netfilter
I have a box with only 1 IP (lets say 10.0.0.1) which has an ipip tunnel to another machine (lets say 10.2.0.1)(different networks) i wan''t all packets coming to 10.0.0.1 destination port 80 be routed thru the tunnel device and be answered by 10.2.0.2 (which has an interface configured with 10.0.0.1). It works if the incoming ip address is not configured on the receiving machine (but is configured to be arpproxied) but not with the "main" ip address. This is what i did to test on 10.0.0.1 ifconfig eth0: main interface tunnel2: ipip tunnel interface to 10.2.0.2 /etc/iproute/rt_tables added: 100 myroute iptables -A PREROUTING -t mangle -d 10.0.0.1 -p tcp --dport 80 -j MARK --set-mark 99 ip route add table test dev tunnel2 ip rule add fwmark 99 table test in 10.0.0.2 ifconfig eth0:101 10.0.0.1 netmask 255.255.255.255 What i''m doing wrong ? Thanks!