You are not logged in.

#1 2009-09-20 16:35:04

burgulgoth
Member
From: Croatia
Registered: 2009-01-15
Posts: 17
Website

Route only some traffic trough VPN

Is it possible to route only certain traffic through VPN and other through default gw route?

I have tried to google it, i didn't find anything usefull.

Thank you


ArchLinux x86_64 | scripts | .configs | cyber space | Last.FM | deviantART

Offline

#2 2009-09-20 23:56:01

neddie_seagoon
Member
Registered: 2009-08-23
Posts: 121

Re: Route only some traffic trough VPN

If the traffic is all to a certain network you could add a routing entry specifying where to route it through:
route add -net 192.57.66.0 netmask 255.255.255.0 gw 1.2.3.4

Check 'man route' for more examples.

Offline

#3 2009-09-21 13:48:28

burgulgoth
Member
From: Croatia
Registered: 2009-01-15
Posts: 17
Website

Re: Route only some traffic trough VPN

neddie_seagoon wrote:

If the traffic is all to a certain network you could add a routing entry specifying where to route it through:
route add -net 192.57.66.0 netmask 255.255.255.0 gw 1.2.3.4

Check 'man route' for more examples.

Yes, that will route all traffic through that gw. But, what I want is to redirect traffic from certain ports through other gw.


ArchLinux x86_64 | scripts | .configs | cyber space | Last.FM | deviantART

Offline

#4 2009-09-21 23:08:25

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Route only some traffic trough VPN

Replace 'eth1' with 'ppp0' or 'tun0' or whatever your VPN interface is:
http://bbs.archlinux.org/viewtopic.php? … 63#p497763

Then for the ports you want to send via the VPN, add a rule like this:

iptables -t mangle -A OUTPUT -p tcp --dport XX -m state --state NEW -j MARK --set-mark 102

Last edited by fukawi2 (2009-09-21 23:09:11)

Offline

Board footer

Powered by FluxBB