Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Right now I have a PPTP VPN set up on my remote ubuntu VPS. I would like to have certain applications use the VPN to access the internet (rtorrent, irssi, among others). Currently, it is set up like this:

eth0 Link encap:Ethernet HWaddr 00:16:3e:94:38:ce inet Mask:

eth1 Link encap:Ethernet HWaddr 00:16:3e:d7:58:a1 inet addr: Bcast: Mask:

lo Link encap:Local Loopback inet addr: Mask:

ppp0 Link encap:Point-to-Point Protocol inet addr: P-t-P: Mask:

Essentially, the way I've seen this issue manifest is like this.

When I run

curl --interface eth0

I get

<html><head><title>Current IP Check</title></head><body>Current IP Address:</body></html>

And when I run

curl --interface ppp0

I get

<html><head><title>Current IP Check</title></head><body>Current IP Address:</body></html>

Which is correct.

However, when I run

curl --interface

it times out and I get nothing. Which doesn't seem to make any sense, as is the IP address of ppp0, and it doesn't seem to me that it should be any different from the above command. Am I missing something? If I can get this to work in curl, I'll be able to get it to work in rtorrent and irssi as I would like as well, curl is just easier to test for this sort of thing. Are there any good starting points for tackling this problem?

EDIT: Fixed it! Here is how I did it.

First I created a new routing table:

# echo "200 vpn" >> /etc/iproute2/rt_tables

Then, I created a rule for requests sourced from my ppp0 IP address to lookup from that new table

# ip rule add from table 200

Then, I created a rule in that table to use ppp0.

# ip route add default dev ppp0 table 200

It works perfectly! Now when I attempt the previously failing curl command:

# curl --interface
<html><head><title>Current IP Check</title></head><body>Current IP Address:</body></html>
share|improve this question
which commands did you use for that configuration ? i'm looking for a solution but couldn't find anything works. – motto Feb 20 '13 at 1:19

Your reasoning is incorrect. Binding to an IP address only chooses the source IP address. It has no effect on the route taken to the destination, which is what you want to control.

To do what you want to do, you need to set up a form of policy routing called source based routing. This is typically done by creating two routing tables, one for each connection, and deciding the routing table to use based on the local source IP address. See any of the many howtos on policy routing.

share|improve this answer
I tried this, and am having the following issue #echo 200 vpns >> /etc/iproute2/rt_tables #ip rule add from table vpns #ip route add default via dev ppp0 table vpns RTNETLINK answers: No such process – user127658 Apr 11 '12 at 9:52
ugh, tried to make it look correct, but basically when I perform the command "ip route add default via dev ppp0 table vpns" I get "RNETLINK answers: No such process". Is that the incorrect command? – user127658 Apr 11 '12 at 9:56
You mean "table 200", right? Routing tables are numbered. – David Schwartz Apr 11 '12 at 10:16
Still the same result. RNETLINK answers: No such process. – user127658 Apr 12 '12 at 0:12
Maybe your VPS doesn't support policy routing. – David Schwartz Apr 12 '12 at 0:17

Your Answer


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.