i would like to replicate what openvpn redirect-gateway does, routing all traffic over a internet server into the internet and back. my client pc -> home router -> internet -> 1.2.3.4 -> internet
this is my normal "route -n" output with a working internet connection:
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
mydslip 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
now i would like to send all traffic over 1.2.3.4, so not directly into the internet, but with a router in between.
what i tried:
route add default 1.2.3.4
which results in:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 1.2.3.4 0.0.0.0 UG 0 0 0 ppp0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
mydslip 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
this does not redirect the traffic as i would like, its still going straight into the internet and not over 1.2.3.4 so i tried (from the first routing table above):
route del default gw 0.0.0.0
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
mydslip 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
but now adding:
route add default 1.2.3.4
results in:
SIOCADDRT: Network is unreachable
which makes sense since the default route is gone...how to add it?
the entry with 0.0.0.0 in the first 3 columns doesnt make sense to me:
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
how does that allow traffic to go anywhere?
i also tried this:
0.0.0.0 1.2.3.4 0.0.0.0 UG 0 0 0 ppp0
mydslip 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
1.2.3.4 mydslip 255.255.255.255 UGH 0 0 0 ppp0
1.2.3.4 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
which does not work, packets go straight into the internet