I have set up a Ubuntu server, that I want to use as a router for my local office.
- The problem is, that I want to make 2 VPN connections, to remote branches, and then I want to route all traffic to the subnet of these two branches through the VPN connections, ppp0 and ppp1, and route the rest of the traffic to eth0.
How can I do this?
- I also want to route a part of my internet traffic through ppp0, because we have some service subscription, that is based on our IP at one of the branches, and therefor, I need to route this part of the internet traffic through ppp0.
Is this possible to set up in the same way as issue 1?
I have tried to read about iptables, iproute2 and ipchains, and have tried setting it up, but with no success so far.
Thanks a lot for your help.
--- EDITED ---
Ok. I found an answer on this page: http://pptpclient.sourceforge.net/routing.phtml#lan-to-lan-via-adsl
This seems to be working:
route add -net 192.168.0.0 netmask 255.255.0.0 dev ppp0
iptables --insert OUTPUT 1 --source 0.0.0.0/0.0.0.0 --destination 192.168.0.0/16 --jump ACCEPT --out-interface ppp0
iptables --insert INPUT 1 --source 192.168.0.0/16 --destination 0.0.0.0/0.0.0.0 --jump ACCEPT --in-interface ppp0
iptables --insert FORWARD 1 --source 0.0.0.0/0.0.0.0 --destination 192.168.0.0/16 --jump ACCEPT --out-interface ppp0
iptables --insert FORWARD 1 --source 192.168.0.0/16 --destination 0.0.0.0/0.0.0.0 --jump ACCEPT
iptables --table nat --append POSTROUTING --out-interface ppp0 --jump MASQUERADE
iptables --append FORWARD --protocol tcp --tcp-flags SYN,RST SYN --jump TCPMSS --clamp-mss-to-pmtu