Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to send certain port traffic through my ppp0 interface it's a pptp vpn tunnel,

First, I'm using a wireless usb interface, I connect up to my access point, then I initiate my vpn, there is a connection but I do not channel all connexions through that, nor do I want to, so, say I want to channel all port 80 packets through my vpn (interface dev ppp0).

I first run:

iptables -t mangle -A OUTPUT -p tcp --dport 80 -j MARK --set-mark 0xa

to mark the correct packets then I add a table named vpn_table, I then add

ip route add default dev ppp0 table vpn_table

when I do that traffic begins to dribble through the ppp0, but no pages load. I supose I must have caused some sort of coflict, or the route I'm adding in vpn_table isn't quite right.

I'm not sure, I think I'm marking the packets correctly but I can't be sure of that either.

UPDATE: I think i've got part of the issue solved: running tcpdump -i ppp0 showed me that indeed there was outgoing requests via ppp0, now, there is never a response, and pages do not load with using that interface..i'm still missing something.

share|improve this question
add comment

1 Answer 1

I finally solved this issue, I'll try and post precise instructions for other people:

ip address show:

vpn address is 192.191.145.5

some relevant info:

39: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1400 qdisc pfifo_fast state UNKNOWN qlen 3
link/ppp 
inet 10.20.0.42 peer 10.20.0.1/32 scope global ppp0

ip route show table local local 10.20.0.42 dev ppp0 proto kernel scope host src 10.20.0.42

additional commands:

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
ip route add 10.20.0.1/32 dev ppp0 table vpn_table
ip route add 0.0.0.0/1 via 10.20.0.42 dev ppp0 table vpn_table
ip route add 192.191.145.5 via 10.20.0.42 dev ppp0 table vpn_table

that is what is needed in the vpn table

this command

sysctl -w net.ipv4.conf.ppp0.rp_filter=2 is really imporant

otherwise you wont get a reply

same as this:

ip route flush cache

I hope this helps someone out there!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.